Skip to content

Commit 4477777

Browse files
authored
ci: Improve CI process (#69)
* chore: change bucket dir for ecs templates * ci: release each template separetly * docs: readme modifications * chore: rename ecs directory * fix: typo * fix: trigger build * fix: lint
1 parent 715a895 commit 4477777

18 files changed

+193
-53
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI - Master AppRunner
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'templates_apprunner/**'
9+
10+
11+
jobs:
12+
build:
13+
name: Build and Upload
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v3
19+
20+
- name: Configure AWS credentials
21+
uses: aws-actions/configure-aws-credentials@v1
22+
with:
23+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
24+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
25+
aws-region: eu-west-1
26+
27+
- name: Build and Upload AppRunner templates
28+
run: make ci
29+
working-directory: ./templates_apprunner
30+
env:
31+
S3_BUCKET: cf-templates-cloudvision-ci
32+
S3_PREFIX: master
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
name: CI - Master
1+
name: CI - Master ECS
22

33
on:
44
push:
55
branches:
6-
- main
6+
- main
7+
paths:
8+
- 'templates_ecs/**'
9+
710

811
jobs:
912
build:
@@ -12,7 +15,7 @@ jobs:
1215

1316
steps:
1417
- name: Check out code
15-
uses: actions/checkout@v2
18+
uses: actions/checkout@v3
1619

1720
- name: Configure AWS credentials
1821
uses: aws-actions/configure-aws-credentials@v1
@@ -21,9 +24,9 @@ jobs:
2124
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
2225
aws-region: eu-west-1
2326

24-
- name: Build and Upload
27+
- name: Build and Upload ECS templates
2528
run: make ci
26-
working-directory: ./templates
29+
working-directory: ./templates_ecs
2730
env:
2831
S3_BUCKET: cf-templates-cloudvision-ci
2932
S3_PREFIX: master
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI - Pull Request AppRunner
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
paths:
8+
- 'templates_apprunner/**'
9+
10+
jobs:
11+
lint:
12+
name: Lint
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v3
18+
19+
- name: cfn-lint
20+
uses: scottbrenner/cfn-lint-action@v2
21+
22+
- name: Print the Cloud Formation Linter Version & run Linter
23+
run: |
24+
cfn-lint --version
25+
cfn-lint -t templates_apprunner/**/*.yaml
26+
27+
build:
28+
name: Build and Upload AppRunner templates
29+
runs-on: ubuntu-latest
30+
needs: [lint]
31+
32+
steps:
33+
- name: Check out code
34+
uses: actions/checkout@v3
35+
36+
- name: Configure AWS credentials
37+
uses: aws-actions/configure-aws-credentials@v1
38+
with:
39+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
40+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
41+
aws-region: eu-west-1
42+
43+
- name: Build and Upload AppRunner Templates
44+
run: make ci
45+
working-directory: templates_apprunner
46+
env:
47+
S3_BUCKET: cf-templates-cloudvision-ci
48+
S3_PREFIX: pr/${{ github.event.pull_request.head.ref }}
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
name: CI - Pull Request
1+
name: CI - Pull Request ECS
22

33
on:
44
pull_request:
55
branches:
6-
- main
6+
- main
7+
paths:
8+
- 'templates_apprunner/**'
79

810
jobs:
911
lint:
@@ -12,24 +14,24 @@ jobs:
1214

1315
steps:
1416
- name: Check out code
15-
uses: actions/checkout@v2
17+
uses: actions/checkout@v3
1618

1719
- name: cfn-lint
1820
uses: scottbrenner/cfn-lint-action@v2
1921

2022
- name: Print the Cloud Formation Linter Version & run Linter
2123
run: |
2224
cfn-lint --version
23-
cfn-lint -t templates/**/*.yaml
25+
cfn-lint -t templates_ecs/**/*.yaml
2426
2527
build:
26-
name: Build and Upload
28+
name: Build and Upload ECS templates
2729
runs-on: ubuntu-latest
2830
needs: [lint]
2931

3032
steps:
3133
- name: Check out code
32-
uses: actions/checkout@v2
34+
uses: actions/checkout@v3
3335

3436
- name: Configure AWS credentials
3537
uses: aws-actions/configure-aws-credentials@v1
@@ -40,7 +42,7 @@ jobs:
4042

4143
- name: Build and Upload ECS Templates
4244
run: make ci
43-
working-directory: templates_apprunner
45+
working-directory: templates_ecs
4446
env:
4547
S3_BUCKET: cf-templates-cloudvision-ci
4648
S3_PREFIX: pr/${{ github.event.pull_request.head.ref }}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release AppRunner
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
paths:
8+
- 'templates_apprunner/**'
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup Go
20+
uses: actions/setup-go@v2
21+
with:
22+
go-version: ^1.16
23+
24+
- name: Setup go-chglog
25+
run: go get -u github.com/git-chglog/git-chglog/cmd/git-chglog
26+
27+
- name: Generate changelog
28+
run: git-chglog -c .github/git-chglog/config.yml -o RELEASE_CHANGELOG.md $(git describe --tags $(git rev-list --tags --max-count=1))
29+
30+
- name: Create release
31+
id: create_release
32+
uses: actions/create-release@v1
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
with:
36+
tag_name: ${{ github.ref }}
37+
release_name: ${{ github.ref }}
38+
draft: true
39+
prerelease: false
40+
body_path: RELEASE_CHANGELOG.md
41+
42+
- name: Configure AWS credentials
43+
uses: aws-actions/configure-aws-credentials@v1
44+
with:
45+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
46+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
47+
aws-region: eu-west-1
48+
49+
- name: Prepare
50+
id: prep
51+
run: |
52+
echo ::set-output name=VERSION::$(echo "${{ github.ref }}" | sed -e 's/.*\/v\(.*\)/\1/')
53+
54+
- name: Build and Upload AppRunner Version
55+
run: make ci
56+
working-directory: ./templates_apprunner
57+
env:
58+
S3_BUCKET: cf-templates-cloudvision-ci
59+
S3_PREFIX: ${{ steps.prep.outputs.VERSION }}
60+
61+
- name: Build and Upload AppRunner Latest
62+
run: make ci
63+
working-directory: ./templates_apprunner
64+
env:
65+
S3_BUCKET: cf-templates-cloudvision-ci
66+
S3_PREFIX: latest

.github/workflows/release.yaml renamed to .github/workflows/release-ecs.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
name: Release
1+
name: Release ECS
22

33
on:
44
push:
55
tags:
66
- v*
7+
paths:
8+
- 'templates_ecs/**'
79

810
jobs:
911
release:
1012
runs-on: ubuntu-latest
1113

1214
steps:
13-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v3
1416
with:
1517
fetch-depth: 0
1618

@@ -49,16 +51,16 @@ jobs:
4951
run: |
5052
echo ::set-output name=VERSION::$(echo "${{ github.ref }}" | sed -e 's/.*\/v\(.*\)/\1/')
5153
52-
- name: Build and Upload Version
54+
- name: Build and Upload ECS Version
5355
run: make ci
54-
working-directory: ./templates
56+
working-directory: ./templates_ecs
5557
env:
5658
S3_BUCKET: cf-templates-cloudvision-ci
5759
S3_PREFIX: ${{ steps.prep.outputs.VERSION }}
5860

59-
- name: Build and Upload Latest
61+
- name: Build and Upload ECS Latest
6062
run: make ci
61-
working-directory: ./templates
63+
working-directory: ./templates_ecs
6264
env:
6365
S3_BUCKET: cf-templates-cloudvision-ci
6466
S3_PREFIX: latest

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
11
# Sysdig CloudVision for AWS
22

33
This repository contains the CloudFormation templates to deploy the Sysdig
4-
CloudVision suite in an AWS Account.
4+
CloudVision suite in an AWS Account using ECS or AppRunner.
55

6-
[Deploy latest version!](https://console.aws.amazon.com/cloudformation/home#/stacks/quickCreate?stackName=Sysdig-CloudVision&templateURL=https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/master/entry-point.yaml)
6+
**[Deploy ECS latest version!](https://console.aws.amazon.com/cloudformation/home#/stacks/quickCreate?stackName=Sysdig-CloudVision&templateURL=https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/ecs/latest/entry-point.yaml)**
77

8+
**[Deploy AppRunner latest version!](https://console.aws.amazon.com/cloudformation/home#/stacks/quickCreate?stackName=Sysdig-CloudVision&templateURL=https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/apprunner/latest/entry-point.yaml)**
89

910
## Contribute
1011

1112

1213
### Release
1314

14-
- Template is [uploaded on the CI release cycle](https://github.com/sysdiglabs/aws-cloudvision-templates/blob/main/.github/workflows/release.yaml#L63) to `cf-templates-cloudvision-ci` on Sysdig `draios-demo` account
15+
Templates are [uploaded on the CI release cycle](https://github.com/sysdiglabs/aws-cloudvision-templates/blob/main/.github/workflows/release.yaml#L63) to `cf-templates-cloudvision-ci` on Sysdig `draios-demo` account.
1516

1617
Leading to the latest entry-point, which will be used on the Sysdig Secure > Getting Started > AWS Cloudformation
1718
<br/>`https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/master/entry-point.yaml`
1819

1920

2021
### Pull Request
2122

22-
When the PR is drafter a new template will be available for testing at
23-
<br/>`https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/pr/<PR_NAME>/entry-point.yaml`
23+
When the PR is drafted, a new template will be available for testing:
24+
- For AppRunner
25+
<br/>`https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/apprunner/pr/<PR_NAME>/entry-point.yaml`
26+
- For ECS
27+
<br/>`https://cf-templates-cloudvision-ci.s3-eu-west-1.amazonaws.com/ecs/pr/<PR_NAME>/entry-point.yaml`
2428

2529

2630
### Testing
2731

28-
see [Makefile](./templates/Makefile)
32+
see [Makefile](templates_ecs/Makefile)
2933

3034
- Validation
3135

templates_apprunner/CloudConnector.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ Parameters:
1515
SysdigSecureAPITokenSsm:
1616
Type: AWS::SSM::Parameter::Name
1717
Description: "Name of the parameter in SSM containing the Sysdig Secure API Token"
18-
S3ConfigBucket:
19-
Type: String
20-
Description: Name of a bucket (must exist) where the configuration YAML files will be stored
2118
VerifySSL:
2219
Type: String
2320
AllowedValues:
@@ -122,8 +119,7 @@ Resources:
122119
- cloudtrail-sns-sqs:
123120
queueURL: ${CloudTrailQueue}
124121
scanners: ${Scanners}
125-
- S3ConfigBucket: !Ref S3ConfigBucket
126-
CloudTrailQueue: !Ref CloudTrailQueue
122+
- CloudTrailQueue: !Ref CloudTrailQueue
127123
Scanners:
128124
'Fn::If':
129125
- DeployCloudScanning

templates_apprunner/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# requires AWS_PROFILE
22
# bucket will be created if it does not exist
33
S3_PREFIX ?= "test"
4+
# using ireland to run App Runner
45
S3_BUCKET ?= "s4c-cft-ireland"
56
# We need the REGION or the TemplateURLs might be created for a different region, resulting in a deployment error
67
S3_REGION = "eu-west-1" # ireland
@@ -13,7 +14,7 @@ validate:
1314
aws cloudformation validate-template --template-body file://./SecureForCloudAppRunner.yaml
1415

1516
lint:
16-
cf-nlint *.yaml
17+
cfn-lint *.yaml
1718

1819

1920
packaged-template.yaml:

0 commit comments

Comments
 (0)