Skip to content

Commit aa14637

Browse files
sthulbam29d
andauthored
fix(ci): Update layer balance scripts (#3660)
Co-authored-by: Alexander Schueren <[email protected]>
1 parent 8203016 commit aa14637

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed

Diff for: .github/workflows/bootstrap_region.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ on:
2828
description: AWS region to bootstrap (i.e. eu-west-1)
2929

3030
name: Region Bootstrap
31-
run-name: Region Bootstrap ${{ inputs.region }}
31+
run-name: Region Bootstrap ${{ inputs.region }} - ${{ inputs.environment }}
3232

3333
permissions:
3434
contents: read

Diff for: .github/workflows/layer_balance.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# bootstraps new regions
2+
#
3+
# PURPOSE
4+
# Ensures new regions are deployable in future releases
5+
#
6+
# JOB 1 PROCESS
7+
# 1. Sets up Go
8+
# 2. Installs the balance script
9+
# 3. Runs balance script to copy layers between aws regions
10+
11+
on:
12+
workflow_dispatch:
13+
inputs:
14+
environment:
15+
type: choice
16+
options:
17+
- beta
18+
- prod
19+
description: Deployment environment
20+
region:
21+
type: string
22+
required: true
23+
description: AWS region to deploy into (i.e. eu-west-1)
24+
start_at:
25+
type: string
26+
required: false
27+
description: Layer version to start at
28+
29+
name: Region Balance
30+
run-name: Region Balance ${{ inputs.region }} - ${{ inputs.environment }}
31+
32+
permissions:
33+
contents: read
34+
35+
jobs:
36+
copy_layers:
37+
name: Copy Layers
38+
runs-on: ubuntu-latest
39+
permissions:
40+
contents: read
41+
id-token: write
42+
environment: layer-${{ inputs.environment }}
43+
steps:
44+
- id: credentials
45+
name: AWS Credentials
46+
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722
47+
with:
48+
aws-region: us-east-1
49+
role-to-assume: ${{ secrets.REGION_IAM_ROLE }}
50+
mask-aws-account-id: true
51+
- id: go-setup
52+
name: Setup Go
53+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
54+
with:
55+
go-version: '>=1.23.0'
56+
- id: go-env
57+
name: Go Env
58+
run: go env
59+
- id: go-install-pkg
60+
name: Install
61+
run: go install github.com/aws-powertools/actions/layer-balancer/cmd/balance@29979bc5339bf54f76a11ac36ff67701986bb0f0
62+
- id: run-balance-new-region
63+
name: Run Balance
64+
if: ${{ inputs.start_at == '' }}
65+
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false
66+
- id: run-balance-existing
67+
name: Run Balance (Existing Region)
68+
if: ${{ inputs.start_at != '' }}
69+
run: balance -read-region us-east-1 -start-at ${{ inputs.start_at }} -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false

0 commit comments

Comments
 (0)