Skip to content

Janitor

Janitor #226

Workflow file for this run

name: Janitor
on:
schedule:
- cron: "0 3 * * *"
workflow_dispatch:
jobs:
azure-janitor:
name: azure-janitor
runs-on: ubuntu-latest
steps:
- name: Login to Azure
uses: azure/[email protected]
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Cleanup
continue-on-error: true
run: |
# Get the AKS clusters by prefix
for rg in $(az group list --query "[?starts_with(name,'auto-aks-hp-ci')].name" | jq -r ".[]" 2> /dev/null); do
echo "Deleting AKS resource group: $rg"
az group delete --name $rg --yes
done
aws-janitor:
name: aws-janitor
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Cleanup
uses: rancher/[email protected]
with:
regions: ${{ secrets.EKS_REGION }}
commit: true
ignore-tag: janitor-ignore
gcp-janitor:
name: gcp-janitor
runs-on: ubuntu-latest
steps:
- name: Authenticate to GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v2
- name: Cleanup
continue-on-error: true
run: |
# Get the GKE clusters by prefix
for cl in $(gcloud container clusters list --location asia-south2-c --filter="name:auto-gke-hp-ci" --format json | jq -r ".[] | .name" 2> /dev/null); do
echo "Deleting GKE cluster: $cl"
gcloud container clusters delete --location asia-south2-c $cl --async --quiet
done