Merge "Revert "Minimize number of jobs needed to tag images""

This commit is contained in:
Zuul 2021-10-02 17:07:24 +00:00 committed by Gerrit Code Review
commit 30b9815161
4 changed files with 22 additions and 29 deletions

View File

@ -38,8 +38,7 @@
when: pre_build_role is defined when: pre_build_role is defined
- name: Publish images - name: Publish images
block: block:
- name: Publish Images with Latest and Commit Tags - command: make images clean
command: make images clean
args: args:
chdir: "{{ makefile_chdir }}" chdir: "{{ makefile_chdir }}"
environment: environment:
@ -48,7 +47,7 @@
DOCKER_REGISTRY: "{{ docker_registry }}" DOCKER_REGISTRY: "{{ docker_registry }}"
GCP_SDK: "{{ gcp_sdk }}" GCP_SDK: "{{ gcp_sdk }}"
IMAGE_PREFIX: "{{ image_prefix | default('airshipit') }}" 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') }}" LABEL: "{{ image_label | default('org.airshipit.build=community') }}"
NO_PROXY: "{{ proxy.noproxy }}" NO_PROXY: "{{ proxy.noproxy }}"
PUSH_IMAGE: "false" PUSH_IMAGE: "false"
@ -57,13 +56,4 @@
USE_PROXY: "{{ proxy.enabled | lower }}" USE_PROXY: "{{ proxy.enabled | lower }}"
WORKDIR: "{{ image_work_dir | default('manifests') }}" WORKDIR: "{{ image_work_dir | default('manifests') }}"
PROFILE: "{{ image_profile_dir | default('') }}" 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 become: True

View File

@ -53,7 +53,7 @@
DOCKER_REGISTRY: "{{ docker_registry }}" DOCKER_REGISTRY: "{{ docker_registry }}"
GCP_SDK: "{{ gcp_sdk }}" GCP_SDK: "{{ gcp_sdk }}"
IMAGE_PREFIX: "{{ image_prefix | default('airshipit') }}" 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') }}" LABEL: "{{ image_label | default('org.airshipit.build=community') }}"
NO_PROXY: "{{ proxy.noproxy }}" NO_PROXY: "{{ proxy.noproxy }}"
PUSH_IMAGE: "true" PUSH_IMAGE: "true"
@ -62,13 +62,4 @@
USE_PROXY: "{{ proxy.enabled | lower }}" USE_PROXY: "{{ proxy.enabled | lower }}"
WORKDIR: "{{ image_work_dir | default('manifests') }}" WORKDIR: "{{ image_work_dir | default('manifests') }}"
PROFILE: "{{ image_profile_dir | default('') }}" 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 become: True

View File

@ -44,9 +44,7 @@
- name: image_builder_quay_creds - name: image_builder_quay_creds
secret: image_builder_quay_creds secret: image_builder_quay_creds
vars: vars:
image_tag: image_tag: "k8s-1.18-latest"
- "k8s-1.18-latest"
- "k8s-1.18-{{ zuul.newrev }}"
# Tag the 1.19 job with 1.19 # Tag the 1.19 job with 1.19
- job: - job:
@ -61,9 +59,21 @@
- name: image_builder_quay_creds - name: image_builder_quay_creds
secret: image_builder_quay_creds secret: image_builder_quay_creds
vars: vars:
image_tag: image_tag: "k8s-1.19-latest"
- "k8s-1.19-latest"
- "k8s-1.18-{{ zuul.newrev }}" # 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: - nodeset:
name: airship-image-builder-single-node name: airship-image-builder-single-node

View File

@ -12,7 +12,7 @@
image_config_dir: manifests image_config_dir: manifests
image_prefix: airshipit image_prefix: airshipit
image_label: org.airshipit.build=community image_label: org.airshipit.build=community
image_tag: [latest] image_tag: latest
check: check:
jobs: jobs:
- airship-image-builder-build-k8s-1.18 - airship-image-builder-build-k8s-1.18
@ -26,6 +26,8 @@
- airship-image-builder-upload-git-mirror - airship-image-builder-upload-git-mirror
- airship-image-builder-publish-k8s-1.18 - airship-image-builder-publish-k8s-1.18
- airship-image-builder-publish-k8s-1.19 - airship-image-builder-publish-k8s-1.19
- airship-image-builder-publish-commit-k8s-1.18
- airship-image-builder-publish-commit-k8s-1.19
tag: tag:
jobs: jobs:
- airship-image-builder-upload-git-mirror - airship-image-builder-upload-git-mirror