From bd65cb6662fb91eeaeee2b14538a2b0b6c21aa0f Mon Sep 17 00:00:00 2001 From: Alexey Date: Fri, 1 Oct 2021 21:33:41 +0000 Subject: [PATCH] Revert "Minimize number of jobs needed to tag images" This reverts commit 27088be404b70a838b3ed8c9cbb8960cd1265065. Reason for revert: the post jobs failed, e.g. https://zuul.opendev.org/t/openstack/build/fa43594346ec49578d7a91305b97c192/log/job-output.txt#8604 Change-Id: Ib9aba6dc7b28c5afebbf5571c5a0ca1c68a49a34 --- playbooks/airship-image-builder-build.yaml | 14 ++---------- .../airship-image-builder-publish-latest.yaml | 11 +--------- zuul.d/jobs.yaml | 22 ++++++++++++++----- zuul.d/projects.yaml | 4 +++- 4 files changed, 22 insertions(+), 29 deletions(-) diff --git a/playbooks/airship-image-builder-build.yaml b/playbooks/airship-image-builder-build.yaml index d547863..b081185 100644 --- a/playbooks/airship-image-builder-build.yaml +++ b/playbooks/airship-image-builder-build.yaml @@ -38,8 +38,7 @@ when: pre_build_role is defined - name: Publish images block: - - name: Publish Images with Latest and Commit Tags - command: make images clean + - command: make images clean args: chdir: "{{ makefile_chdir }}" environment: @@ -48,7 +47,7 @@ DOCKER_REGISTRY: "{{ docker_registry }}" GCP_SDK: "{{ gcp_sdk }}" IMAGE_PREFIX: "{{ image_prefix | default('airshipit') }}" - IMAGE_TAG: "{{ image_tag | first | default('latest') }}" + IMAGE_TAG: "{{ image_tag | default('latest') }}" LABEL: "{{ image_label | default('org.airshipit.build=community') }}" NO_PROXY: "{{ proxy.noproxy }}" PUSH_IMAGE: "false" @@ -57,13 +56,4 @@ USE_PROXY: "{{ proxy.enabled | lower }}" WORKDIR: "{{ image_work_dir | default('manifests') }}" PROFILE: "{{ image_profile_dir | default('') }}" - - name: Publish the rest of the tags - command: docker tag $DOCKER_REGISTRY/$IMAGE_PREFIX/$IMAGE_NAME:$IMAGE_TAG1 $DOCKER_REGISTRY/$IMAGE_PREFIX/$IMAGE_NAME:$IMAGE_TAG2 - environment: - IMAGE_TAG1: "{{ image_tag | first | default('latest') }}" - IMAGE_TAG2: "{{ item }}" - DOCKER_REGISTRY: "{{ docker_registry }}" - IMAGE_PREFIX: "{{ image_prefix | default('airshipit') }}" - IMAGE_NAME: "{{ IMAGE_NAME | default('image-builder') }}" - with_items: "{{ image_tag[1:] }}" become: True diff --git a/playbooks/airship-image-builder-publish-latest.yaml b/playbooks/airship-image-builder-publish-latest.yaml index dac4b80..2e6c74c 100644 --- a/playbooks/airship-image-builder-publish-latest.yaml +++ b/playbooks/airship-image-builder-publish-latest.yaml @@ -53,7 +53,7 @@ DOCKER_REGISTRY: "{{ docker_registry }}" GCP_SDK: "{{ gcp_sdk }}" IMAGE_PREFIX: "{{ image_prefix | default('airshipit') }}" - IMAGE_TAG: "{{ image_tag | first | default('latest') }}" + IMAGE_TAG: "{{ image_tag | default('latest') }}" LABEL: "{{ image_label | default('org.airshipit.build=community') }}" NO_PROXY: "{{ proxy.noproxy }}" PUSH_IMAGE: "true" @@ -62,13 +62,4 @@ USE_PROXY: "{{ proxy.enabled | lower }}" WORKDIR: "{{ image_work_dir | default('manifests') }}" PROFILE: "{{ image_profile_dir | default('') }}" - - name: Publish the rest of the tags - command: docker tag ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG1} ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG2} && docker push ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME} - environment: - IMAGE_TAG1: "{{ image_tag | first | default('latest') }}" - IMAGE_TAG2: "{{ item }}" - DOCKER_REGISTRY: "{{ docker_registry }}" - IMAGE_PREFIX: "{{ image_prefix | default('airshipit') }}" - IMAGE_NAME: "{{ IMAGE_NAME | default('image-builder') }}" - with_items: "{{ image_tag[1:] }}" become: True diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index a0a9da3..21c2b2c 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -44,9 +44,7 @@ - name: image_builder_quay_creds secret: image_builder_quay_creds vars: - image_tag: - - "k8s-1.18-latest" - - "k8s-1.18-{{ zuul.newrev }}" + image_tag: "k8s-1.18-latest" # Tag the 1.19 job with 1.19 - job: @@ -61,9 +59,21 @@ - name: image_builder_quay_creds secret: image_builder_quay_creds vars: - image_tag: - - "k8s-1.19-latest" - - "k8s-1.18-{{ zuul.newrev }}" + image_tag: "k8s-1.19-latest" + +# Tag the 1.18 job with zuul rev tag +- job: + name: airship-image-builder-publish-commit-k8s-1.18 + parent: airship-image-builder-publish-k8s-1.18 + vars: + image_tag: "k8s-1.18-{{ zuul.newrev }}" + +# Tag the 1.19 job with zuul rev tag +- job: + name: airship-image-builder-publish-commit-k8s-1.19 + parent: airship-image-builder-publish-k8s-1.19 + vars: + image_tag: "k8s-1.19-{{ zuul.newrev }}" - nodeset: name: airship-image-builder-single-node diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index 3b22e19..0561cdc 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -12,7 +12,7 @@ image_config_dir: manifests image_prefix: airshipit image_label: org.airshipit.build=community - image_tag: [latest] + image_tag: latest check: jobs: - airship-image-builder-build-k8s-1.18 @@ -26,6 +26,8 @@ - airship-image-builder-upload-git-mirror - airship-image-builder-publish-k8s-1.18 - airship-image-builder-publish-k8s-1.19 + - airship-image-builder-publish-commit-k8s-1.18 + - airship-image-builder-publish-commit-k8s-1.19 tag: jobs: - airship-image-builder-upload-git-mirror \ No newline at end of file