CI Updates (#386)

* Fixed issue with pushing build to dockerhub

* Fixed issue with pushing build to dockerhub
This commit is contained in:
Jesus Federico
2019-02-28 11:54:08 -05:00
committed by GitHub
parent 6f2eef7437
commit a0036e244b
2 changed files with 30 additions and 19 deletions

View File

@ -45,10 +45,10 @@ if [[ ($# == "--help") || $# == "-h" ]]; then
fi
if [ -z "$CD_DEPLOY_SCRIPT" ]; then
echo "Script for deployment is not defined, it has to be defined as an ENV variable. [e.g. CD_DEPLOY_SCRIPT=https://example.com/scripts/deploy.sh]"
echo "#### Script for deployment is not defined, it has to be defined as an ENV variable. [e.g. CD_DEPLOY_SCRIPT=https://example.com/scripts/deploy.sh]"
exit 0
fi
echo "Script for deployment: $CD_DEPLOY_SCRIPT"
echo "#### Script for deployment: $CD_DEPLOY_SCRIPT"
export CD_REF_SLUG=$1
export CD_REF_NAME=$2
@ -56,20 +56,25 @@ export CD_COMMIT_SHA=$3
export CD_COMMIT_BEFORE_SHA=$4
if [ -z $CD_REF_SLUG ]; then
echo "Repository not included, it should have been passed as an argument. [e.g. bigbluebutton/greenlight]"
echo "#### Repository not included, it should have been passed as an argument. [e.g. bigbluebutton/greenlight]"
exit 0
fi
if [ -z $CD_REF_NAME ]; then
echo "Neither branch nor tag were included, the name should have been passed as an argument. [e.g. master|release-2.0.5]"
echo "#### Neither branch nor tag were included, the name should have been passed as an argument. [e.g. master|release-2.0.5]"
exit 0
fi
if [ -z $CD_DOCKER_REPO ]; then
export CD_DOCKER_REPO=$CD_REF_SLUG
fi
if [ "$CD_REF_NAME" != "master" ] && [[ "$CD_REF_NAME" != *"release"* ]] && [ -z $CD_DEPLOY_ALL ];then
echo "Docker image for $CD_REF_SLUG won't be deployed. The conditions for running this build were not met."
echo "#### Docker image for $CD_DOCKER_REPO won't be deployed. The conditions for running this build were not met."
exit 0
fi
echo "Docker image $CD_REF_SLUG:$CD_REF_NAME is being deployed."
echo "#### Docker image $CD_DOCKER_REPO:$CD_REF_NAME is being deployed"
# The actual script should be pulled from an external repository
if [ ! -z $CD_GITHUB_OAUTH_TOKEN ]; then
@ -80,6 +85,6 @@ else
curl -L $CD_DEPLOY_SCRIPT > deploy.sh
fi
chmod +x deploy.sh
./deploy.sh $CD_REF_SLUG $CD_REF_NAME $CD_COMMIT_SHA $CD_COMMIT_BEFORE_SHA
./deploy.sh $CD_DOCKER_REPO $CD_REF_NAME $CD_COMMIT_SHA $CD_COMMIT_BEFORE_SHA
exit 0