diff --git a/.travis.yml b/.travis.yml index dc2f28b1..5476ccac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ jobs: - stage: build name: build docker image script: bash scripts/image_build.sh $TRAVIS_REPO_SLUG $TRAVIS_BRANCH $TRAVIS_COMMIT - if: type NOT IN (pull_request) AND env(CD_BUILD_IGNORE) IS NOT present AND env(CD_DOCKER_USERNAME) IS present AND env(CD_DOCKER_PASSWORD) IS present + if: env(CD_BUILD_IGNORE) IS NOT present AND type NOT IN (pull_request) AND env(CD_DOCKER_USERNAME) IS present AND env(CD_DOCKER_PASSWORD) IS present notifications: email: false diff --git a/scripts/image_build.sh b/scripts/image_build.sh index 024a75e9..546c9f45 100755 --- a/scripts/image_build.sh +++ b/scripts/image_build.sh @@ -20,6 +20,8 @@ # as part of the development process. # +echo "v2019022601" + display_usage() { echo "This script should be used as part of a CI strategy." echo -e "Usage:\n build_image.sh [ARGUMENTS]" diff --git a/scripts/image_deploy.sh b/scripts/image_deploy.sh index 768c49b4..1b1c1368 100755 --- a/scripts/image_deploy.sh +++ b/scripts/image_deploy.sh @@ -12,7 +12,7 @@ # OAuth token will be required. e.g CD_GITHUB_OAUTH_TOKEN when the script is stored in GitHub. # # CD_GITHUB_OAUTH_TOKEN -# A GitHub token for granting access to https://github.com/blindsidenetworks/greenlight-scripts +# A GitHub token for granting access to https://github.com/blindsidenetworks/bn-cloud-scripts # # CD_DEPLOY_ALL # As the deployment is supposed to be normaly done only for master (for a nightly deployments) and @@ -21,6 +21,8 @@ # or reviewing work as part of development process. # +echo "v2019022601" + display_usage() { echo "This script should be used as part of a CI strategy." echo -e "Usage:\n build_image.sh [ARGUMENTS]" @@ -43,38 +45,31 @@ if [[ ($# == "--help") || $# == "-h" ]]; then fi if [ -z "$CD_DEPLOY_SCRIPT" ]; then - echo "Script for deployment is not defined" + 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 "Source for deployment script: $CD_DEPLOY_SCRIPT" +echo "Script for deployment: $CD_DEPLOY_SCRIPT" export CD_REF_SLUG=$1 export CD_REF_NAME=$2 export CD_COMMIT_SHA=$3 export CD_COMMIT_BEFORE_SHA=$4 - -if [ -z $CD_DEPLOY_SCRIPT ]; then - echo "Source for deployment script is not defined" - exit 0 -fi - if [ -z $CD_REF_SLUG ]; then - echo "Repository not included [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 [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 [ "$CD_REF_NAME" != "master" ] && [[ "$CD_REF_NAME" != *"release"* ]] && [ -z $CD_DEPLOY_ALL ];then - echo "Docker image for $CD_REF_SLUG won't be deployed" + echo "Docker image for $CD_REF_SLUG 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_REF_SLUG:$CD_REF_NAME is being deployed." # The actual script should be pulled from an external repository if [ ! -z $CD_GITHUB_OAUTH_TOKEN ]; then @@ -84,7 +79,6 @@ else echo "Script from a any other public repo: $CD_DEPLOY_SCRIPT" 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