#!/bin/bash -x -e
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

for SERVICE in "$@"; do
  gcloud app versions list \
    --format="table[no-heading](VERSION.ID)" \
    --filter="SERVICE=${SERVICE} AND
              TRAFFIC_SPLIT=0 AND
              LAST_DEPLOYED.date()<$(date -I --date='-3 day')" \
  | xargs --no-run-if-empty gcloud app versions delete -s ${SERVICE}
done
#!/bin/bash -x -e
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

for SERVICE in "$*"; do
  gcloud app versions list \
    --format="table[no-heading](VERSION.ID)" \
    --filter="SERVICE=${SERVICE} AND
              TRAFFIC_SPLIT=0 AND
              LAST_DEPLOYED.date()<$(date -I --date='-3 day')" \
  | xargs --no-run-if-empty gcloud app versions delete -s ${SERVICE}
done
--- 
+++ 
@@ -3,7 +3,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-for SERVICE in "$*"; do
+for SERVICE in "$@"; do
   gcloud app versions list \
     --format="table[no-heading](VERSION.ID)" \
     --filter="SERVICE=${SERVICE} AND
Fix bug for cleanup multiple services

Split argument by space to cleanup multiple services.

Change-Id: I4f12dbf2602db677150b20d0b9e5549b26d5f9e0
Reviewed-on: https://chromium-review.googlesource.com/c/catapult/+/2153406
Commit-Queue: Chenlin Fan <ade7e59805b81f027d537665b2c12c1956198b97@chromium.org>
Auto-Submit: Chenlin Fan <ade7e59805b81f027d537665b2c12c1956198b97@chromium.org>
Reviewed-by: Andrew Bennetts <f07c55753dac44d78e0294a1d64ea321baaa78f4@google.com>
