File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,14 @@ cache:
10
10
script : mvn clean test -Dspring.profiles.active=test
11
11
12
12
before_deploy :
13
+ # install aws cli
13
14
- sudo apt-get -y install python-pip
14
15
- sudo pip install awscli
16
+ # Parse branch name and determine an environment to deploy
15
17
- export ENV=$(echo "${TRAVIS_BRANCH}" | perl -ne "print $& if /(?<=deploy\/).*/")
18
+ # Switch AWS Role when ENV is prod
19
+ - test "${ENV}" = "prod" && source scripts/switch-production-role.sh
20
+ # Create an archive to deploy
16
21
- scripts/create-archives.sh
17
22
deploy :
18
23
# upload jar and codedeploy scripts
Original file line number Diff line number Diff line change @@ -15,5 +15,5 @@ cat << EOF > inventory
15
15
localhost
16
16
EOF
17
17
18
- ansible-playbook -i inventory --connection= local -e " deploy_bucket=${S3_DEPLOY_BUCKET} " site.yml --tags deploy
18
+ ansible-playbook -i inventory -c local -e " deploy_bucket=${S3_DEPLOY_BUCKET} " site.yml --tags deploy
19
19
)
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ credentials=$( aws sts assume-role --role-arn ${PROD_ROLE_ARN} --role-session-name travisci)
4
+
5
+ export AWS_ACCESS_KEY_ID=$( echo ${credentials} | jq --raw-output .Credentials.AccessKeyId)
6
+ export AWS_SECRET_ACCESS_KEY=$( echo ${credentials} | jq --raw-output .Credentials.SecretAccessKey)
7
+ export AWS_SESSION_TOKEN=$( echo ${credentials} | jq --raw-output .Credentials.SessionToken)
8
+
9
+ unset credentials
You can’t perform that action at this time.
0 commit comments