Publish distribution image to DockerHub as package-registry-distribution - #1808
Conversation
elastic/distribution on DockerHub is a misleading name since the copy pipeline strips the upstream namespace. Retag the internal docker.elastic.co image as package-registry-distribution alongside the existing distribution tag, and copy the renamed image to DockerHub so it publishes as elastic/package-registry-distribution. See elastic/platform-engineering-productivity#2953.
| if: "build.source == 'ui' || build.env('BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG') == 'fleet-server'" | ||
| command: | | ||
| set -euo pipefail | ||
|
|
There was a problem hiding this comment.
Looking at the previous step, the script manages the case of the environment variable DRY_RUN being true to skip the publication.
Here we should do the same to keep consistency.
What about adding this ?
DRY_RUN="$$(buildkite-agent meta-data get DRY_RUN --default="${DRY_RUN:-"false"}")"
if [[ "$${DRY_RUN:-"false"} == "true" ]]; then
echo "Skip triggering steps to release images to Docker Hub"
exit 0
fiIn case we want to trigger this step from the UI in DRY_RUN true mode.
There was a problem hiding this comment.
Maybe this could be moved to another pull request.
what I'm thinking is to add another input item
- input: ":truffleruby: Input version for docker tag"
key: input
if: "build.source == 'ui'"
fields:
- text: "The docker tag to be published (format: major.minor.patch(-prerelease)?)."
hint: "e.g. 0.0.1"
key: "DOCKER_TAG"
required: true
- text: "DRY_RUN."
key: DRY_RUN
options:
- label: "True"
value: "true"
- label: "False"
value: "false"
default: "true"Then remove the hard-coded value for DRY_RUN from the env key in the pipeline definition:
And update the script for that to include the retrieval of that variable
DRY_RUN="$(buildkite-agent meta-data get DRY_RUN --default="${DRY_RUN:-"false"}")"
if [[ "${DRY_RUN:-"false"} == "true" ]]; then
echo "Skip triggering steps to release images to Docker Hub"
exit 0
fiSo, if the pipeline is triggered from another pipeline (using a trigger step) by default DRY_RUN will get the value false if not defined.
When triggered using the UI, by default will be true this variable (from the input step). Values filled from the input step are retrieved from the meta-data.
There was a problem hiding this comment.
i've added the DRY_RUN guard, i think the other should be part of a dedicated PR as a followup improvement
Rename the "Copy release images to Docker Hub" step's label/key to clarify it only triggers the downstream copy pipeline steps, and skip triggering them when DRY_RUN is true, for consistency with the existing DRY_RUN handling in publish-distribution.sh.
Co-authored-by: Mario Rodriguez Molins <marrodmo@gmail.com>
💚 Build Succeeded
History
|
|
Tick the box to add this pull request to the merge queue (same as
|
Summary
docker.elastic.co/package-registry/distributionimage aspackage-registry/package-registry-distribution(same digest) so it can be published under a non-misleading name.elastic/package-registry-distributioninstead ofelastic/distribution.Related issue
Related to elastic/platform-engineering-productivity#2953, which tracks deleting the old
elastic/distributionimage from DockerHub once this is live.Follow-up of #1692, which added the DockerHub copy step and introduced the
elastic/distributionname.