Skip to content

Janitor Clusters

Janitor Clusters #220

name: Janitor Clusters
on:
schedule:
# At the end of every day
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
clean-cluster:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
strategy:
matrix:
project: ["prod-images-c6e5", "staging-images-183e"]
include:
- project: "prod-images-c6e5"
fq_service_account: prod-images-ci@prod-images-c6e5.iam.gserviceaccount.com
workload_identity_provider: "projects/618116202522/locations/global/workloadIdentityPools/prod-shared-e350/providers/prod-shared-gha"
- project: "staging-images-183e"
fq_service_account: staging-images-ci@staging-images-183e.iam.gserviceaccount.com
workload_identity_provider: "projects/567187841907/locations/global/workloadIdentityPools/staging-shared-9bd2/providers/staging-shared-gha"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4.1.1
- uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ matrix.workload_identity_provider }}
service_account: ${{ matrix.fq_service_account }}
- uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ matrix.project }}
- run: ./scripts/janitor-clusters.sh ${{ matrix.project }}
# Notify on failures
- uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844 # v1.23.0
if: failure()
with:
payload: '{"text": "[janitor] failure: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"}'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK