Add exclude_containers in container-build role

For content-provider jobs we use container-build role to build
containers, We are not passing tripleo_container_image_build_excludes
in [1] this is causing the issue in Closes-bug as the default value is
an empty list[2].

In old container image build workflow(build-containers role(toci))
we were setting excludes here[3] defined in vars[4]

To avoid duplication of exclude list, Importing vars from
build-containers to get access to "exclude_containers" and importing
task set_ci_branch.yml to get access to "ci_branch" var needed to set
"branch" var.

[1] https://opendev.org/openstack/tripleo-quickstart-extras/src/branch/master/roles/container-build/tasks/main.yaml#L86-L97
[2] https://opendev.org/openstack/tripleo-operator-ansible/src/branch/master/roles/tripleo_container_image_build/defaults/main.yml#L10
[3] https://opendev.org/openstack/tripleo-ci/src/branch/master/roles/build-containers/templates/tripleo-build.sh.j2#L67-L69
[4] https://github.com/openstack/tripleo-ci/blob/master/roles/build-containers/vars/main.yaml#L15-L52

Closes-Bug: #1926160
Change-Id: Ib1aaacbfa001ebb544b0decd38d5789df16e35e7
This commit is contained in:
Sandeep Yadav 2021-05-11 14:19:43 +05:30
parent 7178744e79
commit 368069a884

View File

@ -77,6 +77,20 @@
'{{ container_image_build_volumes + ["/opt/gating_repo:/opt/gating_repo:z"] }}'
when: gating_stat.stat.exists|bool
- name: Include exclude_containers and ci_branch from build-containers role
when: zuul is defined
block:
- name: Include vars from build-containers to include exclude_containers
include_vars: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/tripleo-ci'].src_dir }}/roles/build-containers/vars/main.yaml"
- name: Set ci_branch for building containers check jobs
include_tasks: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/tripleo-ci'].src_dir }}/roles/build-containers/tasks/set_ci_branch.yml"
- name: Set branch
set_fact:
branch: "{{ osp_release | default(ci_branch) }}"
- name: Build and push container images to the local registry
collections:
- tripleo.operator
@ -95,6 +109,7 @@
tripleo_container_image_build_prefix: "{{ docker_prep_prefix }}"
tripleo_container_image_build_timeout: 10000
tripleo_container_image_build_base: "{{ containers_base_image }}"
tripleo_container_image_build_excludes: "{{ exclude_containers[branch]|default([]) }}"
- name: Pull and push non *tripleo* container images to local registry
import_tasks: non_tripleo_containers.yml