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 }}"