Last active
February 4, 2020 23:20
-
-
Save utarn/61da39fd8c62410a1718802e1bda9bde to your computer and use it in GitHub Desktop.
Google cloud script to manage container registry : Quick Remove
This file contains hidden or 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 | |
#TODAY=$(date --date="yesterday" +%Y-%m-%d) | |
IMAGE=${1} | |
TODAY=$(gcloud container images list-tags asia.gcr.io/utarndocker/${IMAGE} | tail -n +2 | head -1 | cut -f3 -d" " | cut -f1 -d"-") | |
NORMALIZE_TODAY=${TODAY:0:4}-${TODAY:4:2}-${TODAY:6:2} | |
gremove $IMAGE $NORMALIZE_TODAY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment