Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3f2a3df

Browse files
authoredDec 20, 2024··
Merge branch 'develop' into automation
2 parents 74af8a9 + 4e2e452 commit 3f2a3df

30 files changed

+469
-238
lines changed
 
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# bootstraps new regions
2+
#
3+
# PURPOSE
4+
# Ensures new regions are deployable in future releases
5+
#
6+
# JOB 1 PROCESS
7+
#
8+
# 1. Installs CDK
9+
# 2. Bootstraps region
10+
#
11+
# JOB 2 PROCESS
12+
# 1. Sets up Go
13+
# 2. Installs the balance script
14+
# 3. Runs balance script to copy layers between aws regions
15+
16+
on:
17+
workflow_dispatch:
18+
inputs:
19+
environment:
20+
type: choice
21+
options:
22+
- beta
23+
- prod
24+
description: Deployment environment
25+
region:
26+
type: string
27+
required: true
28+
description: AWS region to bootstrap (i.e. eu-west-1)
29+
30+
name: Region Bootstrap
31+
run-name: Region Bootstrap ${{ inputs.region }}
32+
33+
permissions:
34+
contents: read
35+
36+
jobs:
37+
cdk:
38+
name: Install CDK
39+
runs-on: ubuntu-latest
40+
permissions:
41+
contents: write
42+
id-token: write
43+
environment: layer-${{ inputs.environment }}
44+
steps:
45+
- id: credentials
46+
name: AWS Credentials
47+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
48+
with:
49+
aws-region: ${{ inputs.region }}
50+
role-to-assume: ${{ secrets.REGION_IAM_ROLE }}
51+
mask-aws-account-id: true
52+
- id: workdir
53+
name: Create Workdir
54+
run: |
55+
mkdir -p build/project
56+
- id: cdk-install
57+
name: Install CDK
58+
working-directory: build
59+
run: |
60+
npm i aws-cdk
61+
- id: cdk-project
62+
name: CDK Project
63+
working-directory: build/project
64+
run: |
65+
npx cdk init app --language=typescript
66+
AWS_REGION="${{ inputs.region }}" npx cdk bootstrap
67+
68+
copy_layers:
69+
name: Copy Layers
70+
runs-on: ubuntu-latest
71+
permissions:
72+
contents: write
73+
id-token: write
74+
strategy:
75+
matrix:
76+
layer:
77+
- AWSLambdaPowertoolsPythonV3-python38-arm64
78+
- AWSLambdaPowertoolsPythonV3-python39-arm64
79+
- AWSLambdaPowertoolsPythonV3-python310-arm64
80+
- AWSLambdaPowertoolsPythonV3-python311-arm64
81+
- AWSLambdaPowertoolsPythonV3-python312-arm64
82+
- AWSLambdaPowertoolsPythonV3-python313-arm64
83+
- AWSLambdaPowertoolsPythonV3-python38-x86_64
84+
- AWSLambdaPowertoolsPythonV3-python39-x86_64
85+
- AWSLambdaPowertoolsPythonV3-python310-x86_64
86+
- AWSLambdaPowertoolsPythonV3-python311-x86_64
87+
- AWSLambdaPowertoolsPythonV3-python312-x86_64
88+
- AWSLambdaPowertoolsPythonV3-python313-x86_64
89+
environment: layer-${{ inputs.environment }}
90+
steps:
91+
- id: credentials
92+
name: AWS Credentials
93+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
94+
with:
95+
aws-region: us-east-1
96+
role-to-assume: ${{ secrets.REGION_IAM_ROLE }}
97+
mask-aws-account-id: true
98+
- id: go-setup
99+
name: Setup Go
100+
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
101+
- id: go-env
102+
name: Go Env
103+
run: go env
104+
- id: go-install-pkg
105+
name: Install
106+
run: go install github.com/aws-powertools/actions/layer-balancer/cmd/balance@latest
107+
- id: run-balance
108+
name: Run Balance
109+
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name ${{ matrix.layer }} -dry-run=false

‎.github/workflows/layer_govcloud.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ jobs:
6666
aws --region us-east-1 lambda get-layer-version-by-arn --arn arn:aws:lambda:us-east-1:017000801446:layer:${{ matrix.layer }}-${{ matrix.arch }}:${{ inputs.version }} --query 'Content.Location' | xargs curl -L -o ${{ matrix.layer }}_${{ matrix.arch }}.zip
6767
aws --region us-east-1 lambda get-layer-version-by-arn --arn arn:aws:lambda:us-east-1:017000801446:layer:${{ matrix.layer }}-${{ matrix.arch }}:${{ inputs.version }} > ${{ matrix.layer }}_${{ matrix.arch }}.json
6868
- name: Store Zip
69-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
69+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
7070
with:
7171
name: ${{ matrix.layer }}_${{ matrix.arch }}.zip
7272
path: ${{ matrix.layer }}_${{ matrix.arch }}.zip
7373
retention-days: 1
7474
if-no-files-found: error
7575
- name: Store Metadata
76-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
76+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
7777
with:
7878
name: ${{ matrix.layer }}_${{ matrix.arch }}.json
7979
path: ${{ matrix.layer }}_${{ matrix.arch }}.json

‎.github/workflows/layer_govcloud_python313.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ jobs:
6161
aws --region us-east-1 lambda get-layer-version-by-arn --arn arn:aws:lambda:us-east-1:017000801446:layer:${{ matrix.layer }}-${{ matrix.arch }}:${{ inputs.version }} --query 'Content.Location' | xargs curl -L -o ${{ matrix.layer }}_${{ matrix.arch }}.zip
6262
aws --region us-east-1 lambda get-layer-version-by-arn --arn arn:aws:lambda:us-east-1:017000801446:layer:${{ matrix.layer }}-${{ matrix.arch }}:${{ inputs.version }} > ${{ matrix.layer }}_${{ matrix.arch }}.json
6363
- name: Store Zip
64-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
64+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
6565
with:
6666
name: ${{ matrix.layer }}_${{ matrix.arch }}.zip
6767
path: ${{ matrix.layer }}_${{ matrix.arch }}.zip
6868
retention-days: 1
6969
if-no-files-found: error
7070
- name: Store Metadata
71-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
71+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
7272
with:
7373
name: ${{ matrix.layer }}_${{ matrix.arch }}.json
7474
path: ${{ matrix.layer }}_${{ matrix.arch }}.json

‎.github/workflows/layer_rename.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ jobs:
6666
aws --region us-east-1 lambda get-layer-version-by-arn --arn arn:aws:lambda:us-east-1:017000801446:layer:${{ matrix.layer }}-x86:${{ inputs.version }} --query 'Content.Location' | xargs curl -L -o ${{ matrix.layer }}_x86_64.zip
6767
aws --region us-east-1 lambda get-layer-version-by-arn --arn arn:aws:lambda:us-east-1:017000801446:layer:${{ matrix.layer }}-x86:${{ inputs.version }} > ${{ matrix.layer }}_x86_64.json
6868
- name: Store Zip
69-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
69+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
7070
with:
7171
name: ${{ matrix.layer }}_x86_64.zip
7272
path: ${{ matrix.layer }}_x86_64.zip
7373
retention-days: 1
7474
if-no-files-found: error
7575
- name: Store Metadata
76-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
76+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
7777
with:
7878
name: ${{ matrix.layer }}_x86_64.json
7979
path: ${{ matrix.layer }}_x86_64.json

‎.github/workflows/ossf_scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
repo_token: ${{ secrets.SCORECARD_TOKEN }} # read-only fine-grained token to read branch protection settings
3636

3737
- name: "Upload results"
38-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
38+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
3939
with:
4040
name: SARIF file
4141
path: results.sarif

‎.github/workflows/publish_v2_layer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ jobs:
146146
- name: zip output
147147
run: zip -r cdk.out.zip cdk.out
148148
- name: Archive CDK artifacts
149-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
149+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
150150
with:
151151
name: cdk-layer-artefact
152152
path: layer/cdk.out.zip

‎.github/workflows/publish_v3_layer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ jobs:
149149
- name: zip output
150150
run: zip -r cdk.py${{ matrix.python-version }}.out.zip cdk.out
151151
- name: Archive CDK artifacts
152-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
152+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
153153
with:
154154
name: cdk-layer-artifact-py${{ matrix.python-version }}
155155
path: layer_v3/cdk.py${{ matrix.python-version }}.out.zip

‎.github/workflows/quality_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
- name: Complexity baseline
7575
run: make complexity-baseline
7676
- name: Upload coverage to Codecov
77-
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # 5.1.1
77+
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # 5.1.2
7878
with:
7979
token: ${{ secrets.CODECOV_TOKEN }}
8080
file: ./coverage.xml

‎.github/workflows/record_pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
script: |
5454
const script = require('.github/scripts/save_pr_details.js')
5555
await script({github, context, core})
56-
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
56+
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
5757
with:
5858
name: pr
5959
path: pr.txt

‎.github/workflows/reusable_deploy_v2_layer_stack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ jobs:
197197
cat cdk-layer-stack/${{ matrix.region }}-layer-version.txt
198198
- name: Save Layer ARN artifact
199199
if: ${{ inputs.stage == 'PROD' }}
200-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
200+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
201201
with:
202202
name: cdk-layer-stack-${{ matrix.region }}
203203
path: ./layer/cdk-layer-stack/* # NOTE: upload-artifact does not inherit working-directory setting.

‎.github/workflows/reusable_deploy_v3_layer_stack.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ jobs:
102102
has_arm64_support: "true"
103103
- region: "ap-southeast-4"
104104
has_arm64_support: "true"
105+
- region: "ap-southeast-5"
106+
has_arm64_support: "true"
105107
- region: "ca-central-1"
106108
has_arm64_support: "true"
107109
- region: "ca-west-1"
@@ -204,7 +206,7 @@ jobs:
204206
cat cdk-layer-stack/${{steps.constants.outputs.LAYER_VERSION}}
205207
- name: Save Layer ARN artifact
206208
if: ${{ inputs.stage == 'PROD' }}
207-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
209+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
208210
with:
209211
name: cdk-layer-stack-${{ matrix.region }}-${{ matrix.python-version }}
210212
path: ./layer_v3/cdk-layer-stack/* # NOTE: upload-artifact does not inherit working-directory setting.

0 commit comments

Comments
 (0)
Please sign in to comment.