Skip to content

Commit

Permalink
Add a version to the local_tag (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnorro authored Apr 3, 2024
1 parent fe854f6 commit b317183
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions hooks/command
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ read_list_property() {
}

push_tags() {
local tags=("${@}")
local local_tag="${1}"
local tags=("${@:2}")

for region in "${regions[@]}"; do

Expand All @@ -173,7 +174,7 @@ push_tags() {

for tag in "${tags[@]}"; do
echo "Tag: '${tag}'"
docker tag "${BUILDKITE_PLUGIN_DOCKER_ECR_PUBLISH_ECR_NAME}" "${image}:${tag}"
docker tag "${local_tag}" "${image}:${tag}"
docker push "${image}:${tag}" &
local backgrounded_pid=$!
push_tasks[${backgrounded_pid}]="${region}-${image}:${tag}"
Expand Down Expand Up @@ -219,6 +220,7 @@ enable_buildkit=0
build_args=()
caches_from=()
tags=("${BUILDKITE_BUILD_NUMBER}")
local_tag="${BUILDKITE_PLUGIN_DOCKER_ECR_PUBLISH_ECR_NAME}:${BUILDKITE_BUILD_NUMBER}"

regions=()
read_build_driver
Expand Down Expand Up @@ -266,7 +268,7 @@ echo "Target: ${target}"
DOCKER_BUILDKIT=${enable_buildkit} \
docker build \
--file "${dockerfile}" \
--tag "${BUILDKITE_PLUGIN_DOCKER_ECR_PUBLISH_ECR_NAME}" \
--tag "${local_tag}" \
${BUILDKITE_PLUGIN_DOCKER_ECR_PUBLISH_ADDITIONAL_BUILD_ARGS:-} \
${build_args[@]+"${build_args[@]}"} \
${caches_from[@]+"${caches_from[@]}"} \
Expand All @@ -282,4 +284,4 @@ if [[ -n ${save_digest_as_metadata} ]]; then
fi

echo '--- Pushing Docker image'
push_tags "${tags[@]}"
push_tags "${local_tag}" "${tags[@]}"

0 comments on commit b317183

Please sign in to comment.