From 0626c1554d4e9b5909495a5e91d99b6093ae4c72 Mon Sep 17 00:00:00 2001 From: Simon Thulbourn Date: Tue, 25 Feb 2025 12:29:21 +0100 Subject: [PATCH 1/3] fix(ci): Append env to workflow name --- .github/workflows/bootstrap_region.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_region.yml b/.github/workflows/bootstrap_region.yml index 61cc174eab..1bac0f82fa 100644 --- a/.github/workflows/bootstrap_region.yml +++ b/.github/workflows/bootstrap_region.yml @@ -28,7 +28,7 @@ on: description: AWS region to bootstrap (i.e. eu-west-1) name: Region Bootstrap -run-name: Region Bootstrap ${{ inputs.region }} +run-name: Region Bootstrap ${{ inputs.region }} - ${{ inputs.environment }} permissions: contents: read From c15abea8a0014f73bf480d9d9ea3f89ab204981b Mon Sep 17 00:00:00 2001 From: Simon Thulbourn Date: Tue, 25 Feb 2025 12:38:46 +0100 Subject: [PATCH 2/3] add region layer balance --- .github/workflows/layer_balance.yml | 74 +++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/layer_balance.yml diff --git a/.github/workflows/layer_balance.yml b/.github/workflows/layer_balance.yml new file mode 100644 index 0000000000..b81104ad55 --- /dev/null +++ b/.github/workflows/layer_balance.yml @@ -0,0 +1,74 @@ +# bootstraps new regions +# +# PURPOSE +# Ensures new regions are deployable in future releases +# +# JOB 1 PROCESS +# +# 1. Installs CDK +# 2. Bootstraps region +# +# JOB 2 PROCESS +# 1. Sets up Go +# 2. Installs the balance script +# 3. Runs balance script to copy layers between aws regions + +on: + workflow_dispatch: + inputs: + environment: + type: choice + options: + - beta + - prod + description: Deployment environment + region: + type: string + required: true + description: AWS region to deploy into (i.e. eu-west-1) + start_at: + type: string + required: false + description: Layer version to start at + +name: Region Balance +run-name: Region Balance ${{ inputs.region }} - ${{ inputs.environment }} + +permissions: + contents: read + +jobs: + copy_layers: + name: Copy Layers + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + environment: layer-${{ inputs.environment }} + steps: + - id: credentials + name: AWS Credentials + uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 + with: + aws-region: us-east-1 + role-to-assume: ${{ secrets.REGION_IAM_ROLE }} + mask-aws-account-id: true + - id: go-setup + name: Setup Go + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 + with: + go-version: '>=1.23.0' + - id: go-env + name: Go Env + run: go env + - id: go-install-pkg + name: Install + run: go install github.com/aws-powertools/actions/layer-balancer/cmd/balance@29979bc5339bf54f76a11ac36ff67701986bb0f0 + - id: run-balance-new-region + name: Run Balance + if: ${{ inputs.start_at == '' }} + run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false + - id: run-balance-existing + name: Run Balance (Existing Region) + if: ${{ inputs.start_at != '' }} + 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 From 8293bcc53adf1f52967a5ad8e26342f0565f412c Mon Sep 17 00:00:00 2001 From: Simon Thulbourn Date: Tue, 25 Feb 2025 12:57:59 +0100 Subject: [PATCH 3/3] Update .github/workflows/layer_balance.yml Co-authored-by: Alexander Schueren --- .github/workflows/layer_balance.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/layer_balance.yml b/.github/workflows/layer_balance.yml index b81104ad55..a1df2a8f44 100644 --- a/.github/workflows/layer_balance.yml +++ b/.github/workflows/layer_balance.yml @@ -4,11 +4,6 @@ # Ensures new regions are deployable in future releases # # JOB 1 PROCESS -# -# 1. Installs CDK -# 2. Bootstraps region -# -# JOB 2 PROCESS # 1. Sets up Go # 2. Installs the balance script # 3. Runs balance script to copy layers between aws regions