From d844d6378914685d5a5e37e1568624aaa255ff9b Mon Sep 17 00:00:00 2001 From: jmarchel Date: Tue, 9 Jan 2024 09:40:03 +0100 Subject: [PATCH] [image-promote] Push also timestamped Change-Id: Ib32c7b54d198f5013b930fadcb61e742f259dd03 --- .../tasks/promote-registry.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/roles/nebulous-promote-container-image/tasks/promote-registry.yaml b/roles/nebulous-promote-container-image/tasks/promote-registry.yaml index 2af30ca..db0e685 100644 --- a/roles/nebulous-promote-container-image/tasks/promote-registry.yaml +++ b/roles/nebulous-promote-container-image/tasks/promote-registry.yaml @@ -32,6 +32,21 @@ retries: 3 delay: 30 + - name: Generate current timestamp + shell: date +%Y%m%d%H%M%S + register: current_timestamp + + - name: Copy image using branch name, commit id and current timestamp + loop: "{{ zj_image.tags | default(['latest']) }}" + loop_control: + loop_var: zj_image_tag + command: >- + skopeo --insecure-policy copy --all {{ zj_artifact_map[zj_image.repository + ':' + zj_image_tag] }} docker://{{ zj_image.repository }}:{{ zuul.branch }}-{{ zuul.commit_id }}-{{ current_timestamp.stdout }} + register: result + until: result.rc == 0 + retries: 3 + delay: 30 + always: - name: Log out of registry command: "skopeo logout {{ zj_image.registry }}"