diff --git a/roles/upload-docker-image/README.rst b/roles/upload-docker-image/README.rst index 2b04c2e42..836c77bfd 100644 --- a/roles/upload-docker-image/README.rst +++ b/roles/upload-docker-image/README.rst @@ -1,3 +1,13 @@ Upload one or more docker images. .. include:: ../../roles/build-docker-image/common.rst + +.. zuul:rolevar:: upload_docker_image_promote + :type: bool + :default: true + + If ``true`` (the default), then this role will upload the image(s) + to Docker Hub with special tags designed for use by the + :zuul:role:`promote-docker-image` role. Set to ``false`` to use + this role to directly upload images with the final tag (e.g., as + part of an un-gated release job). diff --git a/roles/upload-docker-image/defaults/main.yaml b/roles/upload-docker-image/defaults/main.yaml index d702500de..0c5fa0c84 100644 --- a/roles/upload-docker-image/defaults/main.yaml +++ b/roles/upload-docker-image/defaults/main.yaml @@ -1,2 +1,3 @@ zuul_work_dir: "{{ zuul.project.src_dir }}" docker_dockerfile: "Dockerfile" +upload_docker_image_promote: true diff --git a/roles/upload-docker-image/tasks/push.yaml b/roles/upload-docker-image/tasks/push.yaml index 574cebe34..dac3b45e1 100644 --- a/roles/upload-docker-image/tasks/push.yaml +++ b/roles/upload-docker-image/tasks/push.yaml @@ -1,5 +1,5 @@ - name: Upload tag to dockerhub - command: "docker push {{ zj_image.repository }}:change_{{ zuul.change }}_{{ zj_image_tag }}" + command: "docker push {{ zj_image.repository }}:{{ upload_docker_image_promote | ternary('change_' + zuul.change + '_', '') }}{{ zj_image_tag }}" loop: "{{ zj_image.tags | default(['latest']) }}" loop_control: loop_var: zj_image_tag