Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

Commit a98b7f6

Browse files
authored
[DOP-3641/DOP-3644]: Create GitHub Actions to provision and deprovision feature branch infra (#886)
* [DOP-3641]: Add base methods for validating users * [DOP-3641]: Create new workflow * [DOP-3641]: Update workflow * [DOP-3641]: Update workflow * [DOP-3641]: Revert unneeded changes * [DOP-3641]: Revert unneeded changes * [DOP-3641]: Use base ref * [DOP-3641]: Add workflows for cleaning up the branch and conditionally deploying * [DOP-3641]: Update feature branch update conditionals * [DOP-3641]: Change clean up * [DOP-3641]: Use correct ref * [DOP-3641]: Update destroy method to point to the correct stacknames * [DOP-3641]: rename job * [DOP-3641]: Move display resources to a separate step * [DOP-3641]: Update names * [DOP-3641]: Remove extra whitespace * [DOP-3641]: Support only stg at this time for feature branches
1 parent 26d7b61 commit a98b7f6

File tree

3 files changed

+121
-0
lines changed

3 files changed

+121
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- master
5+
types:
6+
- closed
7+
8+
name: Cleanup Feature Branch Infrastructure
9+
jobs:
10+
destroy:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-node@v1
16+
with:
17+
node-version: '18.x'
18+
- name: Configure AWS credentials
19+
uses: aws-actions/configure-aws-credentials@v1
20+
with:
21+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
22+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
23+
aws-region: us-east-2
24+
- name: Cleanup Feature Branch Infrastructure
25+
run: |
26+
cd cdk-infra/
27+
npm ci
28+
npm run cdk destroy -- -c customFeatureName=enhancedApp-stg-${{github.head_ref}} --force \
29+
auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-worker \
30+
auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-queues \
31+
auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-webhooks
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- master
5+
types:
6+
- opened
7+
- reopened
8+
9+
name: Initial Feature Branch Deploy
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-node@v1
17+
with:
18+
node-version: '18.x'
19+
- name: Configure AWS credentials
20+
uses: aws-actions/configure-aws-credentials@v1
21+
with:
22+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
23+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
24+
aws-region: us-east-2
25+
- name: Deploy Feature Branch Infrastructure
26+
run: |
27+
npm ci
28+
cd cdk-infra/
29+
npm ci
30+
npm run deploy:feature -- -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} --outputs-file outputs.json
31+
- name: Display resource URLs
32+
run: cat outputs.json
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- master
5+
types:
6+
- synchronize
7+
8+
concurrency:
9+
group: environment-stg-feature-${{ github.ref }}
10+
cancel-in-progress: true
11+
name: Update Feature Branch Infrastructure
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: actions/setup-node@v1
19+
with:
20+
node-version: '18.x'
21+
- name: Configure AWS credentials
22+
uses: aws-actions/configure-aws-credentials@v1
23+
with:
24+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
25+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
26+
aws-region: us-east-2
27+
28+
- uses: actions/checkout@v2
29+
- uses: dorny/paths-filter@v2
30+
id: filter
31+
with:
32+
filters: |
33+
webhooks:
34+
- 'api/v2/**'
35+
- 'cdk-infra/lib/constructs/api/**'
36+
- 'cdk-infra/utils/**'
37+
worker:
38+
- 'src/**'
39+
- 'cdk-infra/lib/constructs/worker/**'
40+
- 'Dockerfile.enhanced'
41+
- 'modules/**'
42+
- name: Update Webhook Stack
43+
if: steps.filter.outputs.webhooks == 'true'
44+
run: |
45+
npm ci
46+
cd cdk-infra/
47+
npm ci
48+
npm run deploy:feature:stack -- -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} \
49+
auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-webhook
50+
51+
- name: Update Worker Stack
52+
if: steps.filter.outputs.worker == 'true'
53+
run: |
54+
npm ci
55+
cd cdk-infra/
56+
npm ci
57+
npm run deploy:feature:stack -- -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} \
58+
auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-worker

0 commit comments

Comments
 (0)