Skip to content

CFN Tempalte and Lambda to automatically provision and deprovision NAT gateways when Elastio workers are running #27

CFN Tempalte and Lambda to automatically provision and deprovision NAT gateways when Elastio workers are running

CFN Tempalte and Lambda to automatically provision and deprovision NAT gateways when Elastio workers are running #27

Workflow file for this run

name: ci
on:
push:
branches:
- master
pull_request:
permissions:
contents: read
id-token: write
concurrency:
cancel-in-progress: false
group: "${{ github.workflow }}-${{ github.ref }}"
env:
AWS_REGION: us-east-2
jobs:
changes:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
outputs:
ci: "${{ steps.filter.outputs.ci }}"
aws-backup-elastio-integration: "${{ steps.filter.outputs.aws-backup-elastio-integration }}"
elastio-s3-changelog: "${{ steps.filter.outputs.elastio-s3-changelog }}"
elastio-nat-provision-lambda: "${{ steps.filter.outputs.elastio-nat-provision-lambda }}"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if files were modified
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
ci:
- '.github/workflows/**'
aws-backup-elastio-integration:
- 'aws-backup-elastio-integration/**'
elastio-s3-changelog:
- 'elastio-s3-changelog/**'
elastio-nat-provision-lambda:
- 'elastio-nat-provision-lambda/**'
typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@v1.20.10
upload-aws-backup-elastio-integration:
runs-on: ubuntu-latest
needs: changes
if: >-
github.event_name != 'pull_request' && (
needs.changes.outputs.aws-backup-elastio-integration == 'true' ||
needs.changes.outputs.ci == 'true'
)
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: "aws-actions/configure-aws-credentials@v4"
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: "arn:aws:iam::537513441174:role/Github-Actions-Contrib-OIDC-Role"
special-characters-workaround: 'true'
- name: Upload lambda and cfn to bucket
env:
NAME: aws-backup-elastio-integration
CFN_NAME: Elastio_stack.yaml
S3_BUCKET: "elastio-artifacts-us-east-2"
S3_KEY: "contrib"
run: |
aws s3 cp ${NAME}/${CFN_NAME} s3://${S3_BUCKET}/${S3_KEY}/${CFN_NAME}
cd ${NAME}
zip ${NAME}.zip lambda_handler.py
aws s3 cp ${NAME}.zip s3://${S3_BUCKET}/${S3_KEY}/${NAME}.zip
upload-elastio-s3-changelog:
runs-on: ubuntu-latest
needs: changes
if: >-
github.event_name != 'pull_request' && (
needs.changes.outputs.elastio-s3-changelog == 'true' ||
needs.changes.outputs.ci == 'true'
)
env:
S3_BUCKET: elastio-prod-artifacts-us-east-2
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ vars.aws_elastio_prod_artifacts_contrib_role_arn }}
- run: ./elastio-s3-changelog/upload.sh
upload-elastio-nat-provision-lambda:
runs-on: ubuntu-latest
needs: changes
if: >-
github.event_name != 'pull_request' && (
needs.changes.outputs.elastio-nat-provision-lambda == 'true' ||
needs.changes.outputs.ci == 'true'
)
env:
S3_BUCKET: elastio-prod-artifacts-us-east-2
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ vars.aws_elastio_prod_artifacts_contrib_role_arn }}
- run: ./elastio-nat-provision-lambda/upload.sh