Skip to content
8 changes: 5 additions & 3 deletions .github/workflows/autobuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ jobs:
architecture: [x86_64, arm64]
uses: ./.github/workflows/push-to-s3.yml
with:
region: 'us-east-1'
environment: PROD
architecture: ${{ matrix.architecture }}
secrets:
role: ${{ secrets.AWS_ROLE_TO_ASSUME }}
prodRegion: ${{ secrets.AWS_PROD_REGION }}

trigger-push-to-ecr:
needs: trigger-push-to-s3
Expand All @@ -30,8 +31,9 @@ jobs:
architecture: [x86_64, arm64]
uses: ./.github/workflows/push-to-ecr.yml
with:
region: 'us-east-1'
environment: PROD
architecture: ${{ matrix.architecture }}
secrets:
role: ${{ secrets.AWS_ROLE_TO_ASSUME }}
account_id: ${{ secrets.AWS_ACCOUNT_ID }}
account_id: ${{ secrets.AWS_ACCOUNT_ID }}
prodRegion: ${{ secrets.AWS_PROD_REGION }}
25 changes: 9 additions & 16 deletions .github/workflows/aws-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,12 @@ permissions:
on:
workflow_dispatch:
inputs:
region:
description: 'region on which you want to deploy'
environment:
description: 'Environment to deploy'
type: choice
options:
- eu-west-1
- us-east-1
required: true
lambdaPerfEnv:
description: 'environment on which you want to deploy'
type: choice
options:
- staging
- production
- DEV
- PROD
required: true

jobs:
Expand Down Expand Up @@ -62,12 +55,12 @@ jobs:
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: GitHub_Action_LambdaPerf_Session
aws-region: ${{ inputs.region }}
aws-region: ${{ inputs.environment == 'DEV' && secrets.AWS_DEV_REGION || inputs.environment == 'PROD' && secrets.AWS_PROD_REGION }}
- name: deploy
env:
AWS_REGION: ${{ inputs.region }}
LAMBDA_PERF_ENV: ${{ inputs.lambdaPerfEnv }}
SKIP_SNAPSTART: ${{ (inputs.region == 'eu-west-1') && secrets.SKIP_SNAPSTART_DEV || 'false' }}
GITHUB_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }}
AWS_REGION: ${{ inputs.environment == 'DEV' && secrets.AWS_DEV_REGION || inputs.environment == 'PROD' && secrets.AWS_PROD_REGION }}
LAMBDA_PERF_ENV: ${{ inputs.environment == 'PROD' && 'production' || 'dev' }}
SKIP_SNAPSTART: ${{ (inputs.environment == 'DEV') && secrets.SKIP_SNAPSTART_DEV || 'false' }}
GITHUB_AUTH_TOKEN: ${{ inputs.environment == 'PROD' && secrets.GH_AUTH_TOKEN || 'no-token-needed' }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
run: cd cdk && yarn install && cdk bootstrap && cdk deploy LambdaPerfStack --require-approval never
15 changes: 8 additions & 7 deletions .github/workflows/aws-publish-artifact-to-ecr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ permissions:
on:
workflow_dispatch:
inputs:
region:
description: 'region on which you want to deploy'
environment:
description: 'Environment to deploy'
type: choice
options:
- eu-west-1
- us-east-1
- DEV
- PROD
required: true
architecture:
description: 'architecture'
description: 'Architecture'
type: choice
options:
- x86_64
Expand All @@ -26,9 +26,10 @@ jobs:
trigger-push-to-ecr:
uses: ./.github/workflows/push-to-ecr.yml
with:
region: ${{ inputs.region }}
architecture: ${{ inputs.architecture }}
environment: ${{ inputs.environment }}
secrets:
role: ${{ secrets.AWS_ROLE_TO_ASSUME }}
account_id: ${{ secrets.AWS_ACCOUNT_ID }}

devRegion: ${{ secrets.AWS_DEV_REGION }}
prodRegion: ${{ secrets.AWS_PROD_REGION }}
15 changes: 8 additions & 7 deletions .github/workflows/aws-publish-artifact-to-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ permissions:
on:
workflow_dispatch:
inputs:
region:
description: 'region on which you want to deploy'
environment:
description: 'Environment to deploy'
type: choice
options:
- eu-west-1
- us-east-1
- DEV
- PROD
required: true
architecture:
description: 'architecture'
description: 'Architecture'
type: choice
options:
- x86_64
Expand All @@ -26,8 +26,9 @@ jobs:
trigger-push-to-s3:
uses: ./.github/workflows/push-to-s3.yml
with:
region: ${{ inputs.region }}
architecture: ${{ inputs.architecture }}
environment: ${{ inputs.environment }}
secrets:
role: ${{ secrets.AWS_ROLE_TO_ASSUME }}

devRegion: ${{ secrets.AWS_DEV_REGION }}
prodRegion: ${{ secrets.AWS_PROD_REGION }}
22 changes: 14 additions & 8 deletions .github/workflows/push-to-ecr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,27 @@ permissions:
on:
workflow_call:
inputs:
region:
description: 'region on which you want to deploy'
type: string
required: true
architecture:
description: 'architecture'
type: string
required: true
environment:
description: 'environment'
type: string
required: true
secrets:
role:
description: 'AWS role to assume'
required: true
account_id:
description: 'AWS account id'
required: true
devRegion:
description: 'AWS region for DEV'
required: false
prodRegion:
description: 'AWS region for PROD'
required: false

jobs:
setup:
Expand Down Expand Up @@ -60,7 +66,7 @@ jobs:
with:
role-to-assume: ${{ secrets.role }}
role-session-name: GitHub_Action_LambdaPerf_Session
aws-region: ${{ inputs.region }}
aws-region: ${{ inputs.environment == 'DEV' && secrets.devRegion || inputs.environment == 'PROD' && secrets.prodRegion }}
- name: Delete huge unnecessary folders
run: |
rm -rf /opt/hostedtoolcache
Expand All @@ -75,7 +81,7 @@ jobs:
- name: build and deploy
env:
ARCHITECTURE: ${{ inputs.architecture }}
AWS_REGION: ${{ inputs.region }}
AWS_REGION: ${{ inputs.environment == 'DEV' && secrets.devRegion || inputs.environment == 'PROD' && secrets.prodRegion }}
RUNTIME_ID: ${{ matrix.runtime_id }}
AWS_ACCOUNT_ID: ${{ secrets.account_id }}
run: |
Expand All @@ -92,10 +98,10 @@ jobs:
with:
role-to-assume: ${{ secrets.role }}
role-session-name: GitHub_Action_LambdaPerf_Session
aws-region: ${{ inputs.region }}
aws-region: ${{ inputs.environment == 'DEV' && secrets.devRegion || inputs.environment == 'PROD' && secrets.prodRegion }}
- name: clean untagged images
env:
AWS_REGION: ${{ inputs.region }}
AWS_REGION: ${{ inputs.environment == 'DEV' && secrets.devRegion || inputs.environment == 'PROD' && secrets.prodRegion }}
run: |
UNTAGGED_IMAGES=$(aws ecr list-images --region "${AWS_REGION}" --repository-name lambda-perf --filter "tagStatus=UNTAGGED" --query 'imageIds[*]' --output json)
if [[ "$UNTAGGED_IMAGES" == "[]" ]]; then
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/push-to-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,24 @@ permissions:
on:
workflow_call:
inputs:
region:
description: 'region on which you want to deploy'
type: string
required: true
architecture:
description: 'architecture'
type: string
required: true
environment:
description: 'environment'
type: string
required: true
secrets:
role:
description: 'AWS role to assume'
required: true
devRegion:
description: 'AWS region for DEV'
required: false
prodRegion:
description: 'AWS region for PROD'
required: false

jobs:
setup:
Expand Down Expand Up @@ -56,7 +62,7 @@ jobs:
with:
role-to-assume: ${{ secrets.role }}
role-session-name: GitHub_Action_LambdaPerf_Session
aws-region: ${{ inputs.region }}
aws-region: ${{ inputs.environment == 'DEV' && secrets.devRegion || inputs.environment == 'PROD' && secrets.prodRegion }}
- uses: actions/checkout@v4
- name: Set up Docker
uses: docker/setup-docker-action@v4
Expand All @@ -66,7 +72,7 @@ jobs:
- name: build and deploy
env:
ARCHITECTURE: ${{ inputs.architecture }}
AWS_REGION: ${{ inputs.region }}
AWS_REGION: ${{ inputs.environment == 'DEV' && secrets.devRegion || inputs.environment == 'PROD' && secrets.prodRegion }}
RUNTIME_ID: ${{ matrix.runtime_id }}
run: |
cd s3-uploader
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ jobs:
architecture: [x86_64, arm64]
uses: ./.github/workflows/push-to-s3.yml
with:
region: 'us-east-1'
environment: DEV
architecture: ${{ matrix.architecture }}
secrets:
role: ${{ secrets.AWS_ROLE_TO_ASSUME }}
devRegion: ${{ secrets.AWS_DEV_REGION }}