Skip to content

Commit 98944f4

Browse files
author
Arik Kfir
committed
Update 'release.sh' to find all Docker images according to the new directory structure & naming conventions.
1 parent f0c6425 commit 98944f4

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

.buildkite/release.sh

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
#!/usr/bin/env bash
22

3-
VERSION="${1}"
4-
[[ -z "${VERSION}" ]] && echo "usage: $0 <version>" >&2 && exit 1
3+
TAG="${1}"
4+
[[ -z "${TAG}" ]] && echo "usage: $0 <version>" >&2 && exit 1
55

6-
set -ex
6+
echo "Building & pushing versioned images..." >&2
7+
$(dirname $0)/build.sh "${TAG}" push
78

8-
echo "Building & pushing versioned images..."
9-
$(dirname $0)/build.sh "${VERSION}" push
9+
# setup
10+
DEPLOYSTER_HOME=$(cd $(dirname $0)/..; pwd)
11+
RESOURCES_HOME="${DEPLOYSTER_HOME}/resources"
12+
TAG_PREFIX="infolinks/deployster"
1013

11-
# tag images as VERSION and 'latest', then push them to Docker Hub
14+
echo "Authenticating to GCR..." >&2
1215
gcloud docker --authorize-only
13-
for docker_file in $(find "./resources" -name "Dockerfile"); do
14-
IMAGE_DIR="${docker_file//\/Dockerfile/}"
15-
IMAGE_PATH="${IMAGE_DIR//\.\/resources\//}"
16-
IMAGE_NAME="infolinks/deployster-${IMAGE_PATH//\//-}"
1716

18-
docker tag "${IMAGE_NAME}:${VERSION}" "${IMAGE_NAME}:latest"
19-
docker push "${IMAGE_NAME}:latest"
17+
# re-tag images with "latest" and push those too
18+
for dockerfile in $(ls -X ${RESOURCES_HOME}/Dockerfile.*|grep -v ".local"); do
19+
20+
IMAGE_NAME=$(echo "${dockerfile}" | sed "s/.*\/Dockerfile\.\(.\+\)$/\1/g")
21+
IMAGE_NAME=${IMAGE_NAME//_/-}
22+
23+
echo "Re-tagging Docker image '${TAG_PREFIX}-${IMAGE_NAME}:${TAG}'..." >&2
24+
docker tag "${TAG_PREFIX}-${IMAGE_NAME}:${TAG}" "${TAG_PREFIX}-${IMAGE_NAME}:latest"
25+
docker push "${TAG_PREFIX}-${IMAGE_NAME}:latest"
2026
done
2127

22-
docker tag "infolinks/deployster:${VERSION}" "infolinks/deployster:latest"
23-
docker push "infolinks/deployster:latest"
28+
# re-tag main deployster image with "latest" and push that too
29+
echo "Re-tagging main Docker image..." >&2
30+
docker tag "${TAG_PREFIX}:${TAG}" "${TAG_PREFIX}:latest"
31+
docker push "${TAG_PREFIX}:latest"

0 commit comments

Comments
 (0)