Last active
September 22, 2023 05:03
-
-
Save KoheiKanagu/f8dd1938d6a45b5f6ef1731fb752cbfa to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
set -euxo pipefail | |
echo ' | |
[ | |
{ | |
"name": "delete_all", | |
"action": { | |
"type": "Delete" | |
}, | |
"condition": { | |
"olderThan": "1d" | |
} | |
} | |
] | |
' >policy_delete_all.json | |
PROJECTS=( | |
# FIXME: Add your project IDs here | |
) | |
LOCATIONS=( | |
# FIXME: Add your locations here | |
'asia-northeast1' | |
'us-central1' | |
) | |
for PROJECT in "${PROJECTS[@]}"; do | |
for LOCATION in "${LOCATIONS[@]}"; do | |
gcloud artifacts repositories set-cleanup-policies gcf-artifacts \ | |
--project="$PROJECT" \ | |
--location="$LOCATION" \ | |
--policy="policy_delete_all.json" \ | |
--no-dry-run | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment