Skip to content

Commit

Permalink
circleci conf: require DOCKER_DEPLOY=true to do any dockerhubby things
Browse files Browse the repository at this point in the history
  • Loading branch information
Miles Crabill committed May 31, 2017
1 parent 0af4474 commit 466fb44
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ jobs:
bin/ci/deploy-dockerhub.sh "circle_build_$CIRCLE_BUILD_NUM"
fi
if [ -n "${CIRCLE_TAG}"]; then
bin/ci/deploy-dockerhub.sh "$CIRCLE_TAG"j
bin/ci/deploy-dockerhub.sh "$CIRCLE_TAG"
fi
26 changes: 14 additions & 12 deletions bin/ci/deploy-dockerhub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ function retry() {
return 0
}

# configure docker creds
retry 3 docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
if [[ "$DOCKER_DEPLOY" == true ]]; then
# configure docker creds
retry 3 docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"

# docker tag and push git branch to dockerhub
if [ -n "$1" ]; then
[ "$1" == master ] && TAG=latest || TAG="$1"
for image in "socorro_processor" "socorro_webapp"; do
docker tag "local/$image:latest" "mozilla/$image:$TAG" ||
(echo "Couldn't tag local/$image:latest as mozilla/$image:$TAG" && false)
retry 3 docker push "mozilla/$image:$TAG" ||
(echo "Couldn't push mozilla/$image:$TAG" && false)
echo "Pushed mozilla/$image:$TAG"
done
# docker tag and push git branch to dockerhub
if [ -n "$1" ]; then
[ "$1" == master ] && TAG=latest || TAG="$1"
for image in "socorro_processor" "socorro_webapp"; do
docker tag "local/$image:latest" "mozilla/$image:$TAG" ||
(echo "Couldn't tag local/$image:latest as mozilla/$image:$TAG" && false)
retry 3 docker push "mozilla/$image:$TAG" ||
(echo "Couldn't push mozilla/$image:$TAG" && false)
echo "Pushed mozilla/$image:$TAG"
done
fi
fi

0 comments on commit 466fb44

Please sign in to comment.