Checking for expired review app environments #462
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: review-app-scan | |
run-name: Checking for expired review app environments | |
on: | |
schedule: | |
- cron: "0 1 * * *" | |
workflow_dispatch: | |
env: | |
NAMESPACE_REGEX: ^review-[0-9]{0,4}-{0,1}energy-apps$ | |
MAX_AGE: 72 # Age in hours after last update | |
CLUSTER: dev-eks-platform | |
jobs: | |
scan: | |
name: Scan Review Environments | |
runs-on: ubuntu-22.04 | |
permissions: | |
id-token: write | |
contents: read | |
outputs: | |
matrix: ${{ steps.scan.outputs.matrix }} | |
steps: | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: "arn:aws:iam::979633842206:role/EnergyAppsDeployment" | |
role-session-name: energy-apps-actions-workflow | |
aws-region: eu-west-1 | |
- name: Get Kube Config | |
run: aws eks update-kubeconfig --name=${{ env.CLUSTER }} | |
- name: Check Review Environments | |
id: scan | |
run: | | |
pip3 install git+https://github.com/citizensadvice/[email protected] | |
python3 -m review_app_scan energy-apps dev-energy-apps | |
trigger_destroy: | |
if: needs.scan.outputs.matrix != '{"pr_numbers":[]}' | |
needs: scan | |
secrets: inherit | |
strategy: | |
matrix: ${{ fromJson(needs.scan.outputs.matrix) }} | |
fail-fast: false | |
uses: ./.github/workflows/review-app-destroy.yml | |
with: | |
pr_number: ${{ matrix.pr_numbers }} |