Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Commit 0675770

Browse files
wagmarceljelyoussefi
authored andcommitted
CircleCI update
* Changed PUSH_DRYRUN behavior. If it is set, there will be no real push * Pushing the renamed images with docker directly instead with docker-compose Signed-off-by: Marcel Wagner <[email protected]>
1 parent 48af03c commit 0675770

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

.circleci/config.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,43 @@ commands:
7474
shell: /bin/bash
7575
name: Push images to docker hub
7676
command: |
77+
# login based on preconfigured env variables
7778
docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
79+
#Start with latest tag, replace later by the real-tags
7880
DOCKER_TAG="latest"
7981
if [ "<< parameters.tag >>" = "date" ]; then
80-
DOCKER_TAG=`date -I`
82+
# Should be nightly build
83+
TARGET_DOCKER_TAG=nightly-`date -I`
8184
DOCKER_PUSH_LATEST=true
8285
fi
8386
if [ "<< parameters.tag >>" = "tag" ]; then
84-
DOCKER_TAG=`git describe --tags --exact-match` || exit 1
87+
# Should be master build
88+
TARGET_DOCKER_TAG=`git describe --tags --exact-match` || exit 1
8589
fi
90+
# First push latest if applicable and then the real tag
8691
echo Now trying to push with Tag ${DOCKER_TAG} push latest ${DOCKER_PUSH_LATEST}
87-
if [ ! -z "$PUSH_DRYRUN" ]; then
88-
make push-images
89-
if [ ! -z "$DOCKER_PUSH_LATEST" ]; then
90-
DOCKER_TAG="latest" make push-images
92+
if [ "$DOCKER_PUSH_LATEST" = "true" ]; then
93+
echo Pushing images with latest tag
94+
if [ -z "$PUSH_DRYRUN" ]; then
95+
make push-images
96+
else
97+
echo Only dry run mode. Not pushing to dockerhub!
9198
fi
92-
else
93-
echo Only dry run mode. Not pushing to dockerhub!
9499
fi
100+
# Now replace all latest tagged images by the real tag
101+
echo Now pushing images with tag $DOCKER_TAG
102+
images=$(docker images --format "{{.Repository}}:{{.Tag}}"| grep :latest)
103+
for image in $images; do
104+
newimage=$(echo $image | sed -r "s/:latest/:$TARGET_DOCKER_TAG/g");
105+
echo tagging $image to $newimage;
106+
docker tag $image $newimage
107+
if [ -z "$PUSH_DRYRUN" ]; then
108+
docker push ${newimage}
109+
else
110+
echo Only dry run mode. Not pushing to dockerhub!
111+
fi
112+
done
113+
95114
check-signed:
96115
description: "Check whether latest commit is signed"
97116
steps:

0 commit comments

Comments
 (0)