From 7a0558bd78f46c70c6a5059ade5e67715407f962 Mon Sep 17 00:00:00 2001 From: Andrii Ostapenko Date: Mon, 28 Sep 2020 09:49:08 -0500 Subject: [PATCH] Override images provided as artifacts from buildset registry Switch from using images from defined in docker_images to provided as zuul artifacts. Currently to be used in conjunction with [0] in openstack-helm-images pipelines. [0] https://review.opendev.org/741551 Change-Id: I43dbd38906e8854c87a361f2e5e479f57850252f Signed-off-by: Andrii Ostapenko --- playbooks/osh-infra-gate-runner.yaml | 2 +- roles/override-images/tasks/main.yaml | 27 ++++++++++++++++++----- tools/deployment/common/005-deploy-k8s.sh | 3 ++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/playbooks/osh-infra-gate-runner.yaml b/playbooks/osh-infra-gate-runner.yaml index 409176828..69fa89735 100644 --- a/playbooks/osh-infra-gate-runner.yaml +++ b/playbooks/osh-infra-gate-runner.yaml @@ -19,7 +19,7 @@ - name: Override images include_role: name: override-images - when: docker_images is defined + when: buildset_registry is defined - name: Use docker mirror include_role: name: use-docker-mirror diff --git a/roles/override-images/tasks/main.yaml b/roles/override-images/tasks/main.yaml index acb3a523b..566ce38e9 100644 --- a/roles/override-images/tasks/main.yaml +++ b/roles/override-images/tasks/main.yaml @@ -11,13 +11,30 @@ # limitations under the License. --- -- name: Create test images overrides +- name: Use buildset registry + include_role: + name: use-buildset-registry + +- name: Print zuul + debug: + var: zuul + +- name: Override proposed images from artifacts shell: > - find {{ work_dir }}/../openstack-helm*/*/values* -type f -exec sed -i - 's#\({{ item.repository }}\):\({{ item.tags[0] }}\)#\1:{{ prefix }}_\2#g' {} + - loop: "{{ docker_images }}" + find {{ override_paths | join(" ") }} -type f -exec sed -Ei + "s#['\"]?docker\.io/({{ repo }}):({{ tag }})['\"]?\$#{{ buildset_registry_alias }}:{{ buildset_registry.port }}/\1:\2#g" {} + + loop: "{{ zuul.artifacts | default([]) }}" + args: + chdir: "{{ work_dir }}" + loop_control: + loop_var: zj_zuul_artifact + when: "'metadata' in zj_zuul_artifact and zj_zuul_artifact.metadata.type | default('') == 'container_image'" vars: - prefix: "{{ zuul.change | default(false) | ternary('change_' + zuul.change, 'periodic') }}" + tag: "{{ zj_zuul_artifact.metadata.tag }}" + repo: "{{ zj_zuul_artifact.metadata.repository }}" + override_paths: + - ../openstack-helm*/*/values* + - ../openstack-helm-infra/tools/deployment/ - name: Diff shell: | diff --git a/tools/deployment/common/005-deploy-k8s.sh b/tools/deployment/common/005-deploy-k8s.sh index f1e9e82e8..36eaffde7 100755 --- a/tools/deployment/common/005-deploy-k8s.sh +++ b/tools/deployment/common/005-deploy-k8s.sh @@ -15,7 +15,8 @@ set -xe -: ${MINIKUBE_AIO:="docker.io/openstackhelm/minikube-aio:latest-ubuntu_bionic"} +MINIKUBE_AIO_DEFAULT="docker.io/openstackhelm/minikube-aio:latest-ubuntu_bionic" +: ${MINIKUBE_AIO:=${MINIKUBE_AIO_DEFAULT}} export DEBCONF_NONINTERACTIVE_SEEN=true export DEBIAN_FRONTEND=noninteractive