Merge pull request #7 from sartography/staging

Staging
This commit is contained in:
Aaron Louie 2020-05-08 17:37:24 -04:00 committed by GitHub
commit aa9c306cab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View File

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

View File

@ -1,9 +1,22 @@
#!/bin/bash #!/bin/bash
# Build and push Docker image to Docker Hub # Build and push Docker image to Docker Hub
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin || exit 1
docker build --no-cache -t sartography/protocol-builder-mock:latest . || exit 1; REPO="sartography/protocol-builder-mock"
docker push sartography/protocol-builder-mock:latest || exit 1; 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 docker build -f Dockerfile -t "$REPO:$COMMIT" . || exit 1
aws sqs send-message --queue-url 'https://queue.amazonaws.com/474683445819/dcos-refresh' --message-body 'crconnect/pb' || 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/protocol-builder-mock" || exit 1