Skip to content

Commit

Permalink
Updated internal documentation (bigbluebutton#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfederico authored Feb 27, 2019
1 parent 6ebdd43 commit 5553a8f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions scripts/image_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand Down
24 changes: 9 additions & 15 deletions scripts/image_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]"
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 5553a8f

Please sign in to comment.