Creating Serverless Environment by @gurevichdmitry #97
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Serverless Environment | |
run-name: Creating Serverless Environment by @${{ github.actor }} | |
on: | |
workflow_dispatch: # TODO: remove | |
schedule: | |
- cron: '0 2 * * *' # every day at 02:00 | |
jobs: | |
naming: | |
runs-on: ubuntu-latest | |
outputs: | |
deployment_name: ${{ steps.set_deployment_name.outputs.date-name }} | |
steps: | |
- name: Set deployment name | |
id: set_deployment_name | |
run: | | |
date_name=$(echo "prd-env-$(date +'%d%b%H%M')" | tr '[:upper:]' '[:lower:]') | |
echo "date-name=$date_name" >> $GITHUB_OUTPUT | |
deploy: | |
needs: naming | |
uses: ./.github/workflows/test-environment.yml | |
secrets: inherit | |
# Required for the 'Deploy' job in the 'test-environment.yml' to authenticate with Google Cloud (gcloud). | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
with: | |
deployment_name: ${{ needs.naming.outputs.deployment_name }} | |
# For now, the region is not used because it's overridden in the tf, but it's here for future compatibility. | |
ess-region: "aws-us-east-1" | |
elk-stack-version: 9.0.0-SNAPSHOT | |
serverless_mode: true | |
run-sanity-tests: true | |
expiration_days: 0 | |
destroy_environment: | |
needs: ["naming", "deploy"] | |
uses: ./.github/workflows/destroy-environment.yml | |
secrets: inherit | |
# Required for the 'Destroy' job in the 'destroy-environment.yml' | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
if: success() | |
with: | |
prefix: ${{ needs.naming.outputs.deployment_name }} |