Skip to content

Commit

Permalink
Simplifying deployment for containered apps. (#442)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradchoate committed Jul 10, 2017
1 parent 24be71b commit 88ce112
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions .buildkite/steps/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

set -eo pipefail

function slackpost {
# Usage: slackpost <channel> <message>
# Requires SLACK_WEBOOK_URL environment variable to be set
# to a valid incoming webhook URL

if [ -n "$SLACK_WEBHOOK_URL" ]; then
channel=$1
shift
text=$*

escapedText=$(echo $text | sed 's/"/\"/g' | sed "s/'/\'/g" )
json="{\"channel\": \"$channel\", \"icon_emoji\": \":mltshp:\", \"text\": \"$escapedText\"}"
curl -s -d "payload=$json" "$SLACK_WEBHOOK_URL" > /dev/null
fi
}

# Grab CI images
docker pull mltshp/mltshp-web:build-${BUILDKITE_BUILD_NUMBER}
docker tag mltshp/mltshp-web:build-${BUILDKITE_BUILD_NUMBER} mltshp/mltshp-web:latest
Expand All @@ -11,10 +27,4 @@ docker pull mltshp/mltshp-worker:build-${BUILDKITE_BUILD_NUMBER}
docker tag mltshp/mltshp-worker:build-${BUILDKITE_BUILD_NUMBER} mltshp/mltshp-worker:latest
docker push mltshp/mltshp-worker:latest

# Rebuild Linode instances...
docker build -t linode .buildkite/linode-cli
export DEPLOY_PUBLIC_KEY="/tmp/setup/production/mltshp-web-key.pub"
alias linode="docker run -i --volume $PWD/setup/production:/tmp/setup/production --rm -e LINODE_API_KEY linode"

# Then deploy (rebuild script waits for user to press enter)
source ./setup/linode-rebuild.sh mltshp/mltshp-web:build-${BUILDKITE_BUILD_NUMBER}
slackpost "#operations" "Build ${BUILDKITE_BUILD_NUMBER} has been pushed to Docker cloud: ${BUILDKITE_BUILD_URL}"

0 comments on commit 88ce112

Please sign in to comment.