From 1c4b853468aa6354c53099d2f272fa90f2d718de Mon Sep 17 00:00:00 2001 From: "Chandan Kumar (raukadah)" Date: Wed, 10 Aug 2022 15:09:42 +0530 Subject: [PATCH] Add support for container_extra_config Additional parameters to tcib tool like Dockerfile Args can be passed via tcib extra_config[1]. It can be used while building tripleo-ansible-ee container[2]. [1].https://docs.openstack.org/project-deploy-guide/tripleo-docs/latest/deployment/3rd_party.html#tips-and-tricks-with-tripleo-container-image-build [2]. https://review.opendev.org/c/openstack/tripleo-common/+/776674 Signed-off-by: Chandan Kumar (raukadah) Change-Id: I0173fef41b50831cc7cfb77ba043e305b09cc953 --- roles/container-build/defaults/main.yaml | 6 ++++++ roles/container-build/tasks/main.yaml | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/roles/container-build/defaults/main.yaml b/roles/container-build/defaults/main.yaml index 5bace610d..05f6048c7 100644 --- a/roles/container-build/defaults/main.yaml +++ b/roles/container-build/defaults/main.yaml @@ -33,3 +33,9 @@ containers_base_image: "{{ job.containers_base_image|default('ubi8') }}" container_registry_image: quay.io/tripleoci/registry:2 container_registry_image_fallback: trunk.registry.rdoproject.org/ceph/registry:2 container_exclude_distro: "{{ ansible_distribution|lower }}{{ ansible_distribution_major_version}}" +# Extra config needs to be passed to tcib tool +# https://docs.openstack.org/tripleo-ansible/latest/roles/role-tripleo_container_image_build.html#r-o-l-e-d-e-f-a-u-l-t-s +container_extra_config: + tcib_args: + TRIPLEO_ANSIBLE_REQ: /usr/share/openstack-tripleo-common-containers/container-images/kolla/tripleo-ansible-ee/requirements.yaml + ANSIBLE_RUNNER_IMAGE: quay.io/tripleoansible/ansible-runner:stream9 diff --git a/roles/container-build/tasks/main.yaml b/roles/container-build/tasks/main.yaml index 00bfead7d..48d72189d 100644 --- a/roles/container-build/tasks/main.yaml +++ b/roles/container-build/tasks/main.yaml @@ -99,6 +99,22 @@ - "tcib_python_version={{ (ansible_distribution_major_version|int < 9) | ternary ('3.6', '3.9') }}" when: release not in ['train', 'ussuri', 'victoria'] +- name: Add tcib extra config params + when: + - container_extra_config is defined + - release not in ['train', 'wallaby'] + block: + - name: Generate config params + copy: + dest: "{{ ansible_user_dir }}/extra_config.yaml" + content: | + {{ container_extra_config | to_nice_yaml }} + + - name: Set tcib config params + set_fact: + tcib_extra_config: "{{ ansible_user_dir }}/extra_config.yaml" + + - name: Build and push container images to the local registry collections: - tripleo.operator @@ -119,6 +135,7 @@ tripleo_container_image_build_base: "{{ containers_base_image }}" tripleo_container_image_build_excludes: "{{ exclude_containers[branch][container_exclude_distro]|default([]) }}" tripleo_container_image_build_tcib_extras: "{{ tcib_extras | default([]) }}" + tripleo_container_image_build_extra_config: "{{ tcib_extra_config | default('') }}" tripleo_container_image_build_distro: "{{ (ansible_distribution == 'RedHat') | ternary('rhel', 'centos') }}" - name: Pull and push non *tripleo* container images to local registry