-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding .travis.yml to repo to configure automated builds
- Loading branch information
1 parent
b55cdf3
commit 5454db4
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# whitelist | ||
branches: | ||
only: | ||
- master | ||
sudo: required | ||
services: | ||
- docker | ||
language: java | ||
jdk: | ||
- openjdk8 | ||
before_install: | ||
#Set up Docker exports | ||
- export AUTHOR=`git --no-pager show -s --format='%an <%ae>'` | ||
- export DATE=`TZ=America/New_York date "+%m-%d-%y-%H%M"` | ||
- export DOCKER_IMAGE="ctrp/ctrp_import_ct_api" | ||
- echo "TravisBuild=$TRAVIS_BUILD_NUMBER" > build_number.html && | ||
echo "Commit=$TRAVIS_COMMIT" >> build_number.html && | ||
echo "TravisBuildID=$TRAVIS_BUILD_ID" >> build_number.html && | ||
echo "Author=$AUTHOR" >> build_number.html && | ||
echo "BuildTime=$DATE" >> build_number.html && | ||
echo "Docker=$DOCKER_IMAGE:$DATE" >> build_number.html | ||
- cat ./build_number.html | ||
script: | ||
- gradlew clean build | ||
#Build Docker image | ||
- docker build -t $DOCKER_IMAGE:$DATE -t $DOCKER_IMAGE:latest . | ||
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" | ||
after_success: | ||
- docker images | ||
- docker push $DOCKER_IMAGE # Pushes both date and latest | ||
#Deploy to AWS IntTest | ||
- docker run -it --rm -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY -e AWS_DEFAULT_REGION=us-east-1 silintl/ecs-deploy --cluster CTAPI-IntTest-Backend --service-name CTAPI-evsrestapi-INTTEST -i $DOCKER_IMAGE:$DATE --timeout 900 | ||
#Trigger BDD Test and deploy in UAT if test passes | ||
#- curl -s -X POST -H "Content-Type:application/json" -H "Accept:application/json" -H "Travis-API-Version:3" -H "Authorization:token $TRAVIS_TOKEN" -d "{\"request\":{\"message\":\"Triggered by CTRP_ctrp_import_ct_api $TRAVIS_COMMIT\", \"branch\":\"master\", \"config\":{\"env\":{\"matrix\":[\"TRIGGER_REPO=ctrp_import_ct_api;TRIGGER_VER=$DATE;CUC_TAG=@CT_API;AUTHOR=$AUTHOR\"]}}}}" https://api.travis-ci.org/repo/CBIIT%2Fctrp-bddtests/requests | ||
notifications: | ||
#slack: clinicalbiomed:W5L3wQ69vtL1XJCo8uT3oQgY | ||
#addons: | ||
# code_climate: | ||
# repo_token: 265d803327b2e66971bf6df85cb05445913ec3164bd88d28d12de70added55bb |