Skip to content

Commit e3446d0

Browse files
Merge branch 'develop' into feat/parser-cognito-schemas-fix
2 parents 49c2bd8 + 98a5af7 commit e3446d0

File tree

165 files changed

+6790
-4284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+6790
-4284
lines changed

.github/workflows/bootstrap_region.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,19 @@ jobs:
4343
id-token: write
4444
environment: layer-${{ inputs.environment }}
4545
steps:
46+
- name: checkout
47+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
48+
with:
49+
ref: ${{ github.sha }}
50+
- name: Setup Node.js
51+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
52+
with:
53+
node-version: "22"
54+
- name: Setup dependencies
55+
uses: aws-powertools/actions/.github/actions/cached-node-modules@29979bc5339bf54f76a11ac36ff67701986bb0f0
4656
- id: credentials
4757
name: AWS Credentials
48-
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
58+
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df
4959
with:
5060
aws-region: ${{ inputs.region }}
5161
role-to-assume: ${{ secrets.REGION_IAM_ROLE }}
@@ -54,11 +64,6 @@ jobs:
5464
name: Create Workdir
5565
run: |
5666
mkdir -p build/project
57-
- id: cdk-install
58-
name: Install CDK
59-
working-directory: build
60-
run: |
61-
npm i aws-cdk
6267
- id: cdk-project
6368
name: CDK Project
6469
working-directory: build/project
@@ -97,12 +102,14 @@ jobs:
97102
- id: go-setup
98103
name: Setup Go
99104
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
105+
with:
106+
go-version: '>=1.23.0'
100107
- id: go-env
101108
name: Go Env
102109
run: go env
103110
- id: go-install-pkg
104111
name: Install
105-
run: go install github.com/aws-powertools/actions/layer-balancer/cmd/balance@latest
112+
run: go install github.com/aws-powertools/actions/layer-balancer/cmd/balance@29979bc5339bf54f76a11ac36ff67701986bb0f0
106113
- id: run-balance
107114
name: Run Balance
108115
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name ${{ matrix.layer }} -dry-run=false
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# Partition Layer Verification
2+
# ---
3+
# This workflow queries the Partition layer info in production only
4+
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
environment:
9+
description: Deployment environment
10+
type: choice
11+
options:
12+
- Gamma
13+
- Prod
14+
required: true
15+
version:
16+
description: Layer version to verify
17+
type: string
18+
required: true
19+
partition_version:
20+
description: Layer version to verify, this is mostly used in Gamma where a version mismatch might exist
21+
type: string
22+
required: false
23+
partition:
24+
description: Partition to deploy to
25+
type: choice
26+
options:
27+
- China
28+
- GovCloud
29+
workflow_call:
30+
inputs:
31+
environment:
32+
description: Deployment environment
33+
type: string
34+
required: true
35+
version:
36+
description: Layer version to verify
37+
type: string
38+
required: true
39+
partition_version:
40+
description: Partition Layer version to verify, this is mostly used in Gamma where a version mismatch might exist
41+
type: string
42+
required: false
43+
44+
name: Layer Verification (Partition)
45+
run-name: Layer Verification (${{ inputs.partition }}) - ${{ inputs.environment }} / Version - ${{ inputs.version }}
46+
47+
permissions: {}
48+
49+
jobs:
50+
setup:
51+
runs-on: ubuntu-latest
52+
outputs:
53+
regions: ${{ format('{0}{1}', steps.regions_china.outputs.regions, steps.regions_govcloud.outputs.regions) }}
54+
partition: ${{ format('{0}{1}', steps.regions_china.outputs.partition, steps.regions_govcloud.outputs.partition) }}
55+
aud: ${{ format('{0}{1}', steps.regions_china.outputs.aud, steps.regions_govcloud.outputs.aud) }}
56+
steps:
57+
- id: regions_china
58+
name: Partition (China)
59+
if: ${{ inputs.partition == 'China' }}
60+
run: |
61+
echo regions='["cn-north-1"]'>> "$GITHUB_OUTPUT"
62+
echo partition='aws-cn'>> "$GITHUB_OUTPUT"
63+
echo aud='sts.amazonaws.com.cn'>> "$GITHUB_OUTPUT"
64+
- id: regions_govcloud
65+
name: Partition (GovCloud)
66+
if: ${{ inputs.partition == 'GovCloud' }}
67+
run: |
68+
echo regions='["us-gov-east-1", "us-gov-west-1"]'>> "$GITHUB_OUTPUT"
69+
echo partition='aws-us-gov'>> "$GITHUB_OUTPUT"
70+
echo aud='sts.amazonaws.com'>> "$GITHUB_OUTPUT"
71+
commercial:
72+
runs-on: ubuntu-latest
73+
permissions:
74+
id-token: write
75+
contents: read
76+
environment: Prod (Readonly)
77+
strategy:
78+
matrix:
79+
layer:
80+
- AWSLambdaPowertoolsPythonV3-python39
81+
- AWSLambdaPowertoolsPythonV3-python310
82+
- AWSLambdaPowertoolsPythonV3-python311
83+
- AWSLambdaPowertoolsPythonV3-python312
84+
- AWSLambdaPowertoolsPythonV3-python313
85+
arch:
86+
- arm64
87+
- x86_64
88+
steps:
89+
- name: Configure AWS Credentials
90+
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
91+
with:
92+
role-to-assume: ${{ secrets.AWS_IAM_ROLE }}
93+
aws-region: us-east-1
94+
mask-aws-account-id: true
95+
- name: Output ${{ matrix.layer }}-${{ matrix.arch }}
96+
# fetch the specific layer version information from the us-east-1 commercial region
97+
run: |
98+
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'
99+
- name: Store Metadata
100+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
101+
with:
102+
name: ${{ matrix.layer }}-${{ matrix.arch }}.json
103+
path: ${{ matrix.layer }}-${{ matrix.arch }}.json
104+
retention-days: 1
105+
if-no-files-found: error
106+
107+
verify:
108+
name: Verify
109+
needs:
110+
- setup
111+
- commercial
112+
runs-on: ubuntu-latest
113+
permissions:
114+
id-token: write
115+
contents: read
116+
# Environment should interperlate as "GovCloud Prod" or "China Beta"
117+
environment: ${{ inputs.partition }} ${{ inputs.environment }}
118+
strategy:
119+
matrix:
120+
region: ${{ fromJson(needs.setup.outputs.regions) }}
121+
layer:
122+
- AWSLambdaPowertoolsPythonV3-python39
123+
- AWSLambdaPowertoolsPythonV3-python310
124+
- AWSLambdaPowertoolsPythonV3-python311
125+
- AWSLambdaPowertoolsPythonV3-python312
126+
- AWSLambdaPowertoolsPythonV3-python313
127+
arch:
128+
- arm64
129+
- x86_64
130+
steps:
131+
- name: Download Metadata
132+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
133+
with:
134+
name: ${{ matrix.layer }}-${{ matrix.arch }}.json
135+
- id: transform
136+
run: |
137+
echo 'CONVERTED_REGION=${{ matrix.region }}' | tr 'a-z\-' 'A-Z_' >> "$GITHUB_OUTPUT"
138+
- name: Configure AWS Credentials
139+
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
140+
with:
141+
role-to-assume: ${{ secrets[format('IAM_ROLE_{0}', steps.transform.outputs.CONVERTED_REGION)] }}
142+
aws-region: ${{ matrix.region}}
143+
mask-aws-account-id: true
144+
audience: ${{ needs.setup.outputs.aud }}
145+
- id: partition_version
146+
name: Partition Layer Version
147+
run: |
148+
echo 'partition_version=$([[ -n "${{ inputs.partition_version}}" ]] && echo ${{ inputs.partition_version}} || echo ${{ inputs.version }} )' >> "$GITHUB_OUTPUT"
149+
- name: Verify Layer
150+
run: |
151+
export layer_output='${{ matrix.layer }}-${{ matrix.arch }}-${{matrix.region}}.json'
152+
aws --region ${{ matrix.region}} lambda get-layer-version-by-arn --arn "arn:${{ needs.setup.outputs.partition }}:lambda:${{ matrix.region}}:${{ secrets[format('AWS_ACCOUNT_{0}', steps.transform.outputs.CONVERTED_REGION)] }}:layer:${{ matrix.layer }}-${{ matrix.arch }}:${{ steps.partition_version.outputs.partition_version }}" > $layer_output
153+
REMOTE_SHA=$(jq -r '.Content.CodeSha256' $layer_output)
154+
LOCAL_SHA=$(jq -r '.Content.CodeSha256' ${{ matrix.layer }}-${{ matrix.arch }}.json)
155+
test "$REMOTE_SHA" == "$LOCAL_SHA" && echo "SHA OK: ${LOCAL_SHA}" || exit 1
156+
jq -s -r '["Layer Arn", "Runtimes", "Version", "Description", "SHA256"], ([.[0], .[1]] | .[] | [.LayerArn, (.CompatibleRuntimes | join("/")), .Version, .Description, .Content.CodeSha256]) |@tsv' ${{ matrix.layer }}-${{ matrix.arch }}.json $layer_output | column -t -s $'\t'

0 commit comments

Comments
 (0)