-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
36 lines (31 loc) · 1.89 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
language: python
env:
global:
- AWS_S3_BUCKET=oanhnn-aws-cfn
- AWS_DEFAULT_REGION=ap-southeast-1
# - AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
# - AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
install:
- pip install yamllint
- pip install awscli
- pip install cfn-lint
before_script:
- yamllint -v
- cfn-lint -v
- aws --version
- export AWS_S3_KEY=commit-${TRAVIS_COMMIT::8}
script:
- yamllint .
- find templates -type f -name *.yml | while read file; do set -ex && cfn-lint -i E2520 -t "$file"; done;
- find stacks -type f -name *.yml | while read file; do set -ex && cfn-lint -i E2520 -t "$file"; done;
- find templates -type f -name *.yml | while read file; do set -ex && aws s3 cp "$file" "s3://$AWS_S3_BUCKET/$AWS_S3_KEY/$file" && aws cloudformation validate-template --template-url "https://s3.amazonaws.com/$AWS_S3_BUCKET/$AWS_S3_KEY/$file" > /dev/null; done;
- find stacks -type f -name *.yml | while read file; do set -ex && aws s3 cp "$file" "s3://$AWS_S3_BUCKET/$AWS_S3_KEY/$file" && aws cloudformation validate-template --template-url "https://s3.amazonaws.com/$AWS_S3_BUCKET/$AWS_S3_KEY/$file" > /dev/null; done;
after_success:
- if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then
find templates -type f -name *.yml | while read file; do set -ex && aws s3 cp "$file" "s3://$AWS_S3_BUCKET/master/$file" > /dev/null; done;
find stacks -type f -name *.yml | while read file; do set -ex && aws s3 cp "$file" "s3://$AWS_S3_BUCKET/master/$file" > /dev/null; done;
fi
- if [[ ! -z "$TRAVIS_TAG" ]]; then
find templates -type f -name *.yml | while read file; do set -ex && aws s3 cp "$file" "s3://$AWS_S3_BUCKET/$TRAVIS_TAG/$file" > /dev/null; done;
find stacks -type f -name *.yml | while read file; do set -ex && aws s3 cp "$file" "s3://$AWS_S3_BUCKET/$TRAVIS_TAG/$file" > /dev/null; done;
fi