Moves deploy logic into a script like the other repos
This commit is contained in:
parent
c3771d4dfc
commit
7ce45c55bd
27
.travis.yml
27
.travis.yml
|
@ -7,23 +7,18 @@ env:
|
|||
global:
|
||||
- COMMIT=${TRAVIS_COMMIT::8}
|
||||
|
||||
before_install:
|
||||
- sudo pip install --upgrade pip
|
||||
- pip install --user awscli
|
||||
- export PATH=$PATH:$HOME/.local/bin
|
||||
- echo $DOCKER_TOKEN | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||
|
||||
install:
|
||||
- export REPO=sartography/cr-connect-db
|
||||
- export TAG=`if [$TRAVIS_BRANCH == "master"]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
|
||||
- docker build --build-arg GIT_COMMIT="$REPO:$COMMIT" -f Dockerfile -t $REPO:$COMMIT .
|
||||
- echo "REPO:TAG = $REPO:$TAG"
|
||||
- echo "$REPO:$COMMIT = $REPO:$TAG"
|
||||
- echo "$REPO:travis-$TRAVIS_BUILD_NUMBER"
|
||||
- docker tag $REPO:$COMMIT $REPO:$TAG
|
||||
- docker tag $REPO:$COMMIT $REPO:travis-$TRAVIS_BUILD_NUMBER
|
||||
- docker push $REPO
|
||||
- aws sqs send-message --region '$AWS_DEFAULT_REGION' --queue-url '$AWS_SQS_URL' --message-body 'crconnect/$TRAVIS_BRANCH/db'
|
||||
- pip install pipenv pytest coverage awscli
|
||||
- export PATH=$PATH:$HOME/.local/bin;
|
||||
- pipenv install
|
||||
|
||||
deploy:
|
||||
provider: script
|
||||
script: bash deploy.sh
|
||||
skip_cleanup: true
|
||||
on:
|
||||
all_branches: true
|
||||
condition: $TRAVIS_BRANCH =~ ^(testing|staging|master)$
|
||||
|
||||
notifications:
|
||||
email:
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Build and push Docker image to Docker Hub
|
||||
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||
APP="db"
|
||||
REPO="sartography/cr-connect-$APP";
|
||||
TAG=$(if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo "$TRAVIS_BRANCH" ; fi;)
|
||||
docker build --build-arg GIT_COMMIT="$REPO:$COMMIT" -f Dockerfile -t "$REPO:$COMMIT" .;
|
||||
docker tag "$REPO:$COMMIT" "$REPO:$TAG";
|
||||
docker tag "$REPO:$COMMIT" "$REPO:travis-$TRAVIS_BUILD_NUMBER";
|
||||
docker push "$REPO";
|
||||
|
||||
# Wait for Docker Hub
|
||||
echo "Publishing to Docker Hub..."
|
||||
sleep 30
|
||||
|
||||
# Notify UVA DCOS that Docker image has been updated
|
||||
echo "Refreshing DC/OS..."
|
||||
aws sqs send-message --region "$AWS_DEFAULT_REGION" --queue-url "$AWS_SQS_URL" --message-body "crconnect/$TRAVIS_BRANCH/$APP";
|
Loading…
Reference in New Issue