From 6e9c1b1c64af831995089bdca6773d16ec7364b6 Mon Sep 17 00:00:00 2001 From: Stephane CHAN-KAM Date: Tue, 4 Oct 2022 19:33:47 +0200 Subject: [PATCH 1/2] Only cleanup revision with tags starting witg 'pr-' --- run/deployment-previews/check_status.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/run/deployment-previews/check_status.py b/run/deployment-previews/check_status.py index f8bad90299d..b1417ac6d25 100644 --- a/run/deployment-previews/check_status.py +++ b/run/deployment-previews/check_status.py @@ -144,6 +144,11 @@ def cleanup( service_obj = get_service(project_id, region, service) revs = get_revision_tags(service_obj) + revs = [ + element for index, element in enumerate(revs) + if (element["rev"].startswith("pr-")) + ] + if not revs: click.echo("No revision tags found, nothing to clean up") sys.exit(0) From ba93fbc2e0e0620d92a0f6acf65825d17684bf03 Mon Sep 17 00:00:00 2001 From: Stephane CHAN-KAM Date: Tue, 4 Oct 2022 19:48:23 +0200 Subject: [PATCH 2/2] Fixing typo 'rev' used instead of 'tag' --- run/deployment-previews/check_status.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run/deployment-previews/check_status.py b/run/deployment-previews/check_status.py index b1417ac6d25..a1e10bfa21e 100644 --- a/run/deployment-previews/check_status.py +++ b/run/deployment-previews/check_status.py @@ -146,7 +146,7 @@ def cleanup( revs = [ element for index, element in enumerate(revs) - if (element["rev"].startswith("pr-")) + if (element["tag"].startswith("pr-")) ] if not revs: