-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Chandan Pinjani <chandan.pinjani@suse.com>
- Loading branch information
Showing
3 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
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/login@v2 | ||
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 "[?contains(name,'auto-aks-hp-ci')].{Name: name}" | jq -r ".[] | .Name" 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 | ||
if: ${{ false }} | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
steps: | ||
- name: Cleanup | ||
uses: rancher-sandbox/aws-janitor@v0.1.0 | ||
with: | ||
regions: ${{ secrets.EKS_REGION }} | ||
commit: false | ||
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 |
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
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