mirror of
https://github.com/google/nomulus
synced 2026-09-20 15:04:24 +00:00
Correctly delete all stopped versions except for the most recent 3 (#1511)
The gcloud command does some weird stuff with sorting when custom format is used. Here we instead rely on linux sort and head command to sort the versions list. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/google/nomulus/1511) <!-- Reviewable:end -->
This commit is contained in:
@@ -52,8 +52,8 @@ steps:
|
|||||||
do
|
do
|
||||||
for version in $(gcloud app versions list \
|
for version in $(gcloud app versions list \
|
||||||
--filter="SERVICE:$service AND SERVING_STATUS:STOPPED" \
|
--filter="SERVICE:$service AND SERVING_STATUS:STOPPED" \
|
||||||
--sort-by=LAST_DEPLOYED --format="value(VERSION.ID)" \
|
--format="value(VERSION.ID,LAST_DEPLOYED)" \
|
||||||
--project=$project_id | head -n -3)
|
--project=$project_id | sort -k 2 | head -n -3)
|
||||||
do
|
do
|
||||||
gcloud app versions delete $version --service=$service \
|
gcloud app versions delete $version --service=$service \
|
||||||
--project=$project_id --quiet;
|
--project=$project_id --quiet;
|
||||||
|
|||||||
Reference in New Issue
Block a user