Tags Docker image with branch, commit, and Travis build number. Deploys to appropriate DC/OS stage after successful Docker push.

This commit is contained in:
Aaron Louie 2020-05-08 11:42:21 -04:00
parent 43b1de1f73
commit 1664645555
4 changed files with 24 additions and 17 deletions

View File

@ -28,7 +28,8 @@ deploy:
script: bash ./deploy.sh
skip_cleanup: true
on:
branch: master
all_branches: true
condition: $TRAVIS_BRANCH =~ ^(testing|staging|master)$
notifications:
email:

View File

@ -1,16 +1,22 @@
#!/bin/bash
# Install AWS CLI
pip install --user awscli;
export PATH=$PATH:$HOME/.local/bin;
# Build and push Docker image to Docker Hub
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin;
docker build \
--build-arg build_config="$DEPLOY_BUILD_CONFIG" \
--no-cache -t sartography/cr-connect-bpmn:latest . \
|| exit 1;
docker push sartography/cr-connect-bpmn:latest || exit 1;
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin || exit 1
REPO="sartography/cr-connect-bpmn"
TAG=$(if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo "$TRAVIS_BRANCH" ; fi)
COMMIT=${TRAVIS_COMMIT::8}
# Notify UVA DCOS that Docker image has been updated
aws sqs send-message --queue-url 'https://queue.amazonaws.com/474683445819/dcos-refresh' --message-body 'crconnect/bpmn' || exit 1;
docker build -f Dockerfile -t "$REPO:$COMMIT" . || exit 1
docker tag "$REPO:$COMMIT" "$REPO:$TAG" || exit 1
docker tag "$REPO:$COMMIT" "$REPO:travis-$TRAVIS_BUILD_NUMBER" || exit 1
docker push "$REPO" || exit 1
# Wait for Docker Hub
echo "Publishing to Docker Hub..."
sleep 30
# Notify DC/OS that Docker image has been updated
echo "Refreshing DC/OS..."
STAGE=$(if [ "$TRAVIS_BRANCH" == "master" ]; then echo "production"; else echo "$TRAVIS_BRANCH" ; fi)
echo "STAGE = $STAGE"
aws sqs send-message --region "$AWS_DEFAULT_REGION" --queue-url "$AWS_SQS_URL" --message-body "crconnect/$STAGE/bpmn" || exit 1

6
package-lock.json generated
View File

@ -12291,9 +12291,9 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"sartography-workflow-lib": {
"version": "0.0.137",
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.137.tgz",
"integrity": "sha512-qfmhuNXZNyxu3BiCNNmbXXTHj7UOPFSUVqx2RJDUoYC0o+xxPKxNysC6M1MizGyQciiXFWd8xlnQBOixbHQHeQ=="
"version": "0.0.147",
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.147.tgz",
"integrity": "sha512-CaueuOhiZgYmp4NjPsKt9zad3yAqzT/ibnIqC+sIQHt99UKmSzsaFuuDN2l5ux4E/Xe4D33Ew6djXtrgcGROTw=="
},
"sass": {
"version": "1.23.3",

View File

@ -49,7 +49,7 @@
"ngx-file-drop": "^8.0.8",
"ngx-markdown": "^9.0.0",
"rxjs": "~6.5.4",
"sartography-workflow-lib": "^0.0.137",
"sartography-workflow-lib": "^0.0.147",
"tslib": "^1.11.1",
"uuid": "^7.0.2",
"zone.js": "^0.10.3"