diff --git a/.zuul.d/base.yaml b/.zuul.d/base.yaml index df550672bd..98c54f74cf 100644 --- a/.zuul.d/base.yaml +++ b/.zuul.d/base.yaml @@ -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 diff --git a/roles/kolla-build/defaults/main.yml b/roles/kolla-build/defaults/main.yml new file mode 100644 index 0000000000..fe7c33a339 --- /dev/null +++ b/roles/kolla-build/defaults/main.yml @@ -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" diff --git a/roles/kolla-build/tasks/main.yml b/roles/kolla-build/tasks/main.yml new file mode 100644 index 0000000000..329507b311 --- /dev/null +++ b/roles/kolla-build/tasks/main.yml @@ -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" diff --git a/tests/playbooks/run.yml b/tests/playbooks/run.yml index c9f5fa1a04..19c9c8ca93 100644 --- a/tests/playbooks/run.yml +++ b/tests/playbooks/run.yml @@ -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