Skip to content
This repository was archived by the owner on May 29, 2024. It is now read-only.

Commit d1bbeb2

Browse files
authored
Merge pull request #2 from aws-samples/ci
Add travis, lint some cfn, integrate cfn-publish
2 parents d85452d + a8e52c5 commit d1bbeb2

File tree

6 files changed

+50
-35
lines changed

6 files changed

+50
-35
lines changed

.travis.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
language: python
2+
3+
python:
4+
- "3.7"
5+
6+
before_script:
7+
- python --version
8+
- pip install -r requirements.txt
9+
10+
script:
11+
- |
12+
if [ $TRAVIS_PULL_REQUEST == true ] && [ $TRAVIS_BRANCH != "master" ]; then
13+
VERSION="v$(cat main/main.template | shyaml get-value Metadata.Version)"
14+
git tag $VERSION
15+
fi
16+
17+
before_deploy:
18+
- VERSION="v$(cat main/main.template | shyaml get-value Metadata.Version)"
19+
- if [ -z "$TRAVIS_TAG" ]; then git tag $VERSION; fi
20+
- zip -r "$VERSION.zip" -@ < ci/include.lst
21+
22+
deploy:
23+
- provider: releases
24+
api_key:
25+
secure: Yf9p3yVj85V3Ur9rt7SrNPkYTN1bfPaW1nWMtIjfEYdeKAHDOJGasJ/6flPj2WXkAyho7tPrp3QupV+c37hZkdJK0ZxhQYvIzrE19BBTo1BuXF6z10lOInC1oF+tKuFHNKmmtYa/0wJK4gyF251xKqS+Q3HaBM86aLS3ZNHJVlVQM4rVh/O139y7Ar+cXxfpAugpSKljWKmPC7tKV9nZvQvUrpyXZ/HbHDdNNSwhxcb38OcRUtbP6klSMzBRa4Es2l9uFgepyJytsFeRx3w4DUUXFDhkk8rXeOMnkatKnpzyuS9yrChLL/h95TE2jlB4vPe+yB4JLbqyNd1dq5KrHpG8XDVtm3d7lqLQ3/IAc+VgrMVG/3TAJjSjY+pKZIBv0B0LGqlbYLORCUB8x/ip+DfeM222y8d/BDeHUhw2jFRAaRt5WBAoFJ2S+Bw0sjjWO2SElxBcAAPBYSc9h16AQhkgZj9cMfwcZniwu6BbAppKFUM9C1pLT6DN8McYg77eHY3zmTCYzgIkQ/b7fnmf8zCXNqUkRe2wW3poqTspEGeoJiqp7cUGGC4qBnvNWXvVxAGn1ZNahVOrhVJI8OzPxc1jlnEheQFNidW522SNDJX+9od7RuI32MO9U0uwgzJNGQuANRddCWA8Y+T2frbnC46hVWi9jsOvSyoZiV0XAxs=
26+
file: $VERSION.zip
27+
skip_cleanup: true
28+
on:
29+
branch: master
30+
condition: type != pull_request
31+
- provider: script
32+
script: aws s3 cp ./$VERSION.zip s3://$CFN_BUCKET/aws-waf-workshop/$VERSION/aws-waf-workshop.zip
33+
skip_cleanup: true
34+
on:
35+
tags: true
36+
37+
notifications:
38+
email: false
39+
40+
cache: pip

cfn-publish.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
template=templates/main.template
2+
acl="public-read"
3+
bucket_name_prefix="solution-builders"
4+
regions="eu-west-1 eu-west-2 us-east-1 us-east-2 us-west-2"

ci/include.lst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cfn-publish.config
2+
templates

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
awscli>=1.16.244
2+
shyaml==0.6.1

templates/instance.template

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ Resources:
5555
ManagedPolicyArns:
5656
- arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM
5757
TheInstanceProfile:
58-
DependsOn:
59-
- TheRole
6058
Type: AWS::IAM::InstanceProfile
6159
Properties:
6260
Path: /
@@ -77,9 +75,6 @@ Resources:
7775
Value: !Sub '${AWS::StackName}-ALB'
7876
Type: application
7977
TheListener:
80-
DependsOn:
81-
- TheTargetGroup
82-
- TheLoadBalancer
8378
Type: AWS::ElasticLoadBalancingV2::Listener
8479
Properties:
8580
DefaultActions:
@@ -89,8 +84,6 @@ Resources:
8984
Port: !Ref 'TheWebPort'
9085
Protocol: HTTP
9186
TheRule:
92-
DependsOn:
93-
- TheListener
9487
Type: AWS::ElasticLoadBalancingV2::ListenerRule
9588
Properties:
9689
Actions:
@@ -101,7 +94,7 @@ Resources:
10194
Values:
10295
- /
10396
ListenerArn: !Ref 'TheListener'
104-
Priority: '1'
97+
Priority: 1
10598
TheTargetGroup:
10699
Type: AWS::ElasticLoadBalancingV2::TargetGroup
107100
Properties:
@@ -146,8 +139,6 @@ Resources:
146139
MinSize: '1'
147140
MaxSize: '3'
148141
TheLaunchConfig:
149-
DependsOn:
150-
- TheInstanceProfile
151142
Type: AWS::AutoScaling::LaunchConfiguration
152143
Properties:
153144
IamInstanceProfile: !Ref 'TheInstanceProfile'

templates/main.template

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
AWSTemplateFormatVersion: '2010-09-09'
22
Description: create all non-WAF resources for the Summit WAF session
33
Metadata:
4+
Version: '0.1'
45
AWS::CloudFormation::Interface:
56
ParameterGroups:
67
- Label:
@@ -45,26 +46,6 @@ Parameters:
4546
Description: subnet CIDR
4647
Default: 10.0.3.32/28
4748
Type: String
48-
TheSubnetId:
49-
Description: for load balancer
50-
Type: String
51-
Default: ''
52-
TheVpcId:
53-
Description: for load balancer
54-
Type: String
55-
Default: ''
56-
TheOtherSubnetId:
57-
Description: for load balancer
58-
Default: ''
59-
Type: String
60-
WebSecurityGroup:
61-
Description: output from security template
62-
Type: String
63-
Default: ''
64-
ALBSecurityGroup:
65-
Description: output from security template
66-
Type: String
67-
Default: ''
6849
TheWebPort:
6950
Description: port application is listening at
7051
Default: 80
@@ -86,8 +67,6 @@ Resources:
8667
TemplateURL: ./network.template
8768
TimeoutInMinutes: 20
8869
TheSecurityStack:
89-
DependsOn:
90-
- TheNeworkStack
9170
Type: AWS::CloudFormation::Stack
9271
Properties:
9372
Parameters:
@@ -100,9 +79,6 @@ Resources:
10079
TemplateURL: ./security.template
10180
TimeoutInMinutes: 20
10281
TheInstanceStack:
103-
DependsOn:
104-
- TheSecurityStack
105-
- TheNeworkStack
10682
Type: AWS::CloudFormation::Stack
10783
Properties:
10884
Parameters:

0 commit comments

Comments
 (0)