CI: Move image building to a role

This role can be then used in kolla-ansible instead of setup_gate.sh

Change-Id: Ibf04bd90a15e7d3949214d15a8b8e25f2050bb65
This commit is contained in:
Michal Nasiadka 2024-06-17 21:48:27 +02:00
parent 9b10b7d235
commit 20cdc32537
4 changed files with 23 additions and 10 deletions

View File

@ -146,6 +146,7 @@
kolla_logs_dir: "{{ zuul_output_dir }}/logs/kolla"
kolla_build_logs_dir: "{{ kolla_logs_dir }}/build"
virtualenv_path: "/tmp/kolla-virtualenv"
kolla_build_template_overrides_path: "{{ zuul.executor.work_root }}/{{ zuul.projects['opendev.org/openstack/kolla'].src_dir }}/tests/templates/template_overrides.j2"
- job:
name: kolla-base-podman

View File

@ -0,0 +1,4 @@
---
kolla_build_logs_dir: "{{ zuul_output_dir }}/logs/kolla/build"
kolla_build_template_overrides_path: ""
kolla_build_venv_path: "/tmp/kolla-virtualenv"

View File

@ -0,0 +1,16 @@
---
- name: Template template_overrides.j2
ansible.builtin.template:
src: "{{ kolla_build_template_overrides_path }}"
dest: /etc/kolla/template_overrides.j2
when: kolla_build_template_overrides_path | length > 0
- name: Run kolla-build to template out dockerfiles
ansible.builtin.command:
cmd: >-
{{ kolla_build_venv_path }}/bin/kolla-build --template-only
--work-dir {{ kolla_build_logs_dir }}/work_dir
- name: Run kolla-build
ansible.builtin.command:
cmd: "{{ kolla_build_venv_path }}/bin/kolla-build"

View File

@ -38,13 +38,5 @@
- import_role:
name: kolla-build-config
- name: Template template_overrides.j2
template:
src: "{{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}/tests/templates/template_overrides.j2"
dest: /etc/kolla/template_overrides.j2
- name: Run kolla-build to template out dockerfiles
command: "{{ virtualenv_path }}/bin/kolla-build --template-only --work-dir {{ kolla_build_logs_dir }}/work_dir"
- name: Run kolla-build
command: "{{ virtualenv_path }}/bin/kolla-build"
- import_role:
name: kolla-build