From 9ba00c1320db22d62684c8ed12f452701102983e Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Thu, 7 May 2020 10:42:19 -0400 Subject: [PATCH 1/3] Moves commit var back up to global --- .travis.yml | 2 ++ deploy.sh | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 913400c6..e17b1f61 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,8 @@ install: env: - PB_BASE_URL='http://workflow.sartography.com:5001/pb/' + global: + - COMMIT=${$TRAVIS_COMMIT::8} script: - pipenv run coverage run -m pytest diff --git a/deploy.sh b/deploy.sh index 86845e93..aa52808d 100755 --- a/deploy.sh +++ b/deploy.sh @@ -4,7 +4,6 @@ echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin REPO="sartography/cr-connect-workflow" TAG=$(if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo "$TRAVIS_BRANCH" ; fi) -COMMIT=${$TRAVIS_COMMIT::8} docker build -f Dockerfile -t "$REPO:$COMMIT" . docker tag "$REPO:$COMMIT" "$REPO:$TAG" docker tag "$REPO:$COMMIT" "$REPO:travis-$TRAVIS_BUILD_NUMBER" From 559494aee238f46204f98aea7b88603605534462 Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Thu, 7 May 2020 10:47:24 -0400 Subject: [PATCH 2/3] Fails build if any docker or aws command errors out --- deploy.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/deploy.sh b/deploy.sh index aa52808d..a4a83231 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,13 +1,13 @@ #!/bin/bash # 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 REPO="sartography/cr-connect-workflow" TAG=$(if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo "$TRAVIS_BRANCH" ; fi) -docker build -f Dockerfile -t "$REPO:$COMMIT" . -docker tag "$REPO:$COMMIT" "$REPO:$TAG" -docker tag "$REPO:$COMMIT" "$REPO:travis-$TRAVIS_BUILD_NUMBER" -docker push "$REPO" +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..." @@ -16,4 +16,4 @@ 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) -aws sqs send-message --region "$AWS_DEFAULT_REGION" --queue-url "$AWS_SQS_URL" --message-body "crconnect/$STAGE/backend" +aws sqs send-message --region "$AWS_DEFAULT_REGION" --queue-url "$AWS_SQS_URL" --message-body "crconnect/$STAGE/backend" || exit 1 From 5c510c5a9a9705395ffac2bff9b3d7f14f4818e7 Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Thu, 7 May 2020 10:56:09 -0400 Subject: [PATCH 3/3] Moves PB_BASE_URL into matrix env var --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e17b1f61..d5dbd199 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,9 +22,10 @@ install: - pipenv install env: - - PB_BASE_URL='http://workflow.sartography.com:5001/pb/' global: - COMMIT=${$TRAVIS_COMMIT::8} + matrix: + - PB_BASE_URL='http://workflow.sartography.com:5001/pb/' script: - pipenv run coverage run -m pytest