mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 15:12:02 +00:00
release: handle more registries for promotion (#62269)
* release: handle more registries for promotion * shellcheck * review comments
This commit is contained in:
parent
be8a441d19
commit
b07c81bfc9
@ -125,7 +125,7 @@ func bazelPushImagesCmd(c Config, isCandidate bool, opts ...bk.StepOpt) func(*bk
|
||||
bk.Env("CLOUD_EPHEMERAL", cloudEphemeral),
|
||||
bk.Env("DEV_REGISTRY", devRegistry),
|
||||
bk.Env("PROD_REGISTRY", prodRegistry),
|
||||
bk.Env("ADDITIONAL_PROD_REGISTRY", additionalProdRegistry),
|
||||
bk.Env("ADDITIONAL_PROD_REGISTRIES", additionalProdRegistry),
|
||||
bk.Cmd(bazelStampedCmd(fmt.Sprintf(`build $$(bazel --bazelrc=%s --bazelrc=.aspect/bazelrc/ci.sourcegraph.bazelrc query 'kind("oci_push rule", //...)')`, bazelRC))),
|
||||
bk.ArtifactPaths("build_event_log.bin"),
|
||||
bk.AnnotatedCmd(
|
||||
|
||||
@ -21,7 +21,7 @@ func releasePromoteImages(c Config) operations.Operation {
|
||||
bk.Env("VERSION", c.Version),
|
||||
bk.Env("INTERNAL_REGISTRY", images.SourcegraphInternalReleaseRegistry),
|
||||
bk.Env("PUBLIC_REGISTRY", images.SourcegraphDockerPublishRegistry),
|
||||
bk.Env("ADDITIONAL_PROD_REGISTRY", images.SourcegraphArtifactRegistryPublicRegistry),
|
||||
bk.Env("ADDITIONAL_PROD_REGISTRIES", images.SourcegraphArtifactRegistryPublicRegistry),
|
||||
bk.AnnotatedCmd(
|
||||
fmt.Sprintf("./tools/release/promote_images.sh %s", image_args),
|
||||
bk.AnnotatedCmdOpts{
|
||||
|
||||
@ -76,9 +76,9 @@ prod_registries=(
|
||||
"$PROD_REGISTRY"
|
||||
)
|
||||
|
||||
additional_prod_registry=${ADDITIONAL_PROD_REGISTRY:-""}
|
||||
if [ -n "$additional_prod_registry" ]; then
|
||||
prod_registries+=("$additional_prod_registry")
|
||||
if [ -n "${ADDITIONAL_PROD_REGISTRIES}" ]; then
|
||||
IFS=' ' read -r -a registries <<< "$ADDITIONAL_PROD_REGISTRIES"
|
||||
prod_registries+=("${registries[@]}")
|
||||
fi
|
||||
|
||||
date_fragment="$(date +%Y-%m-%d)"
|
||||
|
||||
@ -12,6 +12,12 @@ if [ "$#" -lt 1 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We're transitioning to GAR because of DockerHub new rate limiting affecting GCP
|
||||
# See https://github.com/sourcegraph/sourcegraph/issues/61696
|
||||
# Set IFS to space and read into an array
|
||||
IFS=' ' read -r -a PROMOTION_REGISTRIES <<< "$ADDITIONAL_PROD_REGISTRIES"
|
||||
PROMOTION_REGISTRIES=("$PUBLIC_REGISTRY" "${PROMOTION_REGISTRIES[@]}" )
|
||||
|
||||
echo -e "## Release: image promotions" > ./annotations/image_promotions.md
|
||||
echo -e "\n| Name | From | To |\n|---|---|---|" >> ./annotations/image_promotions.md
|
||||
for name in "${@:1}"; do
|
||||
@ -21,13 +27,13 @@ for name in "${@:1}"; do
|
||||
docker pull "${INTERNAL_REGISTRY}/${name}:${VERSION}"
|
||||
|
||||
# Push it on the classic public registry (DockerHub)
|
||||
docker tag "${INTERNAL_REGISTRY}/${name}:${VERSION}" "${PUBLIC_REGISTRY}/${name}:${VERSION}"
|
||||
docker push "${PUBLIC_REGISTRY}/${name}:${VERSION}"
|
||||
pushed=""
|
||||
for registry in "${PROMOTION_REGISTRIES[@]}"; do
|
||||
target="${registry}/${name}:${VERSION}"
|
||||
docker tag "${INTERNAL_REGISTRY}/${name}:${VERSION}" "$target"
|
||||
docker push "$target"
|
||||
pushed="$pushed \`$target\`"
|
||||
done
|
||||
|
||||
# We're transitioning to GAR because of DockerHub new rate limiting affecting GCP
|
||||
# See https://github.com/sourcegraph/sourcegraph/issues/61696
|
||||
docker tag "${INTERNAL_REGISTRY}/${name}:${VERSION}" "${ADDITIONAL_PROD_REGISTRY}/${name}:${VERSION}"
|
||||
docker push "${ADDITIONAL_PROD_REGISTRY}/${name}:${VERSION}"
|
||||
|
||||
echo -e "| ${name} | \`${INTERNAL_REGISTRY}/${name}:${VERSION}\` | \`${PUBLIC_REGISTRY}/${name}:${VERSION}\` \`${ADDITIONAL_PROD_REGISTRY}/${name}:${VERSION}\` |" >>./annotations/image_promotions.md
|
||||
echo -e "| ${name} | \`${INTERNAL_REGISTRY}/${name}:${VERSION}\` | ${pushed} |" >>./annotations/image_promotions.md
|
||||
done
|
||||
|
||||
Loading…
Reference in New Issue
Block a user