Skip to content

Commit 41f8489

Browse files
author
Artem
authored
Merge pull request #2972 from RedisInsight/feature/RI-5323-release-docker
Feature/ri 5323 release docker
2 parents 85b0650 + 08d7410 commit 41f8489

File tree

2 files changed

+91
-1
lines changed

2 files changed

+91
-1
lines changed

.circleci/build/release-docker.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
set -e
3+
4+
HELP="Args:
5+
-v - Semver (2.42.0)
6+
-d - Build image repository (Ex: -d redisinsight)
7+
-r - Target repository (Ex: -r redis/redisinsight)
8+
"
9+
10+
while getopts "v:d:r:h:" opt; do
11+
case $opt in
12+
v) VERSION="$OPTARG";;
13+
d) DEV_REPO="$OPTARG";;
14+
r) RELEASE_REPO="$OPTARG";;
15+
h) echo "$HELP"; exit 0;;
16+
?) echo "$HELP" >&2; exit 1 ;;
17+
esac
18+
done
19+
20+
V_ARR=( ${VERSION//./ } )
21+
TAGS[0]=$VERSION
22+
TAGS[1]="${V_ARR[0]}.${V_ARR[1]}"
23+
TAGS[2]="latest"
24+
25+
DEV_IMAGE_AMD64=$DEV_REPO:amd64
26+
DEV_IMAGE_ARM64=$DEV_REPO:arm64
27+
RELEASE_IMAGE_AMD64=$RELEASE_REPO:$VERSION-amd64
28+
RELEASE_IMAGE_ARM64=$RELEASE_REPO:$VERSION-arm64
29+
30+
echo "
31+
TAGS: [${TAGS[0]}, ${TAGS[1]}, ${TAGS[2]}]
32+
DEV_REPO: $DEV_REPO
33+
RELEASE_REPO: $RELEASE_REPO
34+
35+
DEV_IMAGE_AMD64: $DEV_IMAGE_AMD64
36+
DEV_IMAGE_ARM64: $DEV_IMAGE_ARM64
37+
38+
RELEASE_IMAGE_AMD64: $RELEASE_IMAGE_AMD64
39+
RELEASE_IMAGE_ARM64: $RELEASE_IMAGE_ARM64
40+
"
41+
42+
# Load images from tar archives
43+
docker rmi $DEV_IMAGE_AMD64 || true
44+
docker rmi $DEV_IMAGE_ARM64 || true
45+
docker load -i release/docker/docker-linux-alpine.amd64.tar
46+
docker load -i release/docker/docker-linux-alpine.arm64.tar
47+
48+
echo "Push AMD64 image"
49+
docker tag $DEV_IMAGE_AMD64 $RELEASE_IMAGE_AMD64
50+
docker push $RELEASE_IMAGE_AMD64
51+
52+
echo "Push ARM64 image"
53+
docker tag $DEV_IMAGE_ARM64 $RELEASE_IMAGE_ARM64
54+
docker push $RELEASE_IMAGE_ARM64
55+
56+
for TAG in "${TAGS[@]}"; do
57+
echo "Releasing: $RELEASE_REPO:$TAG"
58+
docker manifest rm $RELEASE_REPO:$TAG || true
59+
docker manifest create --amend "$RELEASE_REPO:$TAG" $RELEASE_IMAGE_AMD64 $RELEASE_IMAGE_ARM64
60+
docker manifest push "$RELEASE_REPO:$TAG"
61+
done
62+
63+
echo "Success"

.circleci/config.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,11 @@ jobs:
956956
at: .
957957
- run:
958958
command: |
959-
aws s3 cp release/ s3://${AWS_BUCKET_NAME_TEST}/public/manual-builds/${CIRCLE_BUILD_NUM} --recursive --exclude "*" --include "RedisInsight*"
959+
aws s3 cp release/ s3://${AWS_BUCKET_NAME_TEST}/public/manual-builds/${CIRCLE_BUILD_NUM} --recursive \
960+
--exclude "*" \
961+
--include "RedisInsight*" \
962+
--include "web/*" \
963+
--include "docker/*"
960964
961965
release-aws-private:
962966
executor: linux-executor
@@ -980,6 +984,24 @@ jobs:
980984
981985
aws s3 cp release/ s3://${AWS_BUCKET_NAME}/private/${applicationVersion} --recursive
982986
987+
release-docker:
988+
executor: linux-executor
989+
steps:
990+
- checkout
991+
- attach_workspace:
992+
at: .
993+
- run:
994+
name: Release docker images
995+
command: |
996+
appVersion=$(jq -r '.version' redisinsight/package.json)
997+
998+
docker login -u $DOCKER_USER -p $DOCKER_PASS
999+
1000+
./.circleci/build/release-docker.sh \
1001+
-d redisinsight \
1002+
-r $DOCKER_REPO \
1003+
-v $appVersion
1004+
9831005
publish-prod-aws:
9841006
executor: linux-executor
9851007
steps:
@@ -1613,6 +1635,11 @@ workflows:
16131635
requires:
16141636
- Approve Publish Release (prod)
16151637
<<: *prodFilter # double check for "latest"
1638+
- release-docker:
1639+
name: Release docker images
1640+
requires:
1641+
- Approve Publish Release (prod)
1642+
<<: *prodFilter # double check for "latest"
16161643
# Nightly tests
16171644
nightly:
16181645
triggers:

0 commit comments

Comments
 (0)