From dbb4ca38cbe5535b42b892b75b6be37f5ec61855 Mon Sep 17 00:00:00 2001 From: Robert Choi Date: Thu, 24 Mar 2022 23:29:48 +0900 Subject: [PATCH] bugfix: check app status using exact matching --- templates/argo-cd/delete-apps-wftpl.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/argo-cd/delete-apps-wftpl.yaml b/templates/argo-cd/delete-apps-wftpl.yaml index 76a61ec..38e45f5 100644 --- a/templates/argo-cd/delete-apps-wftpl.yaml +++ b/templates/argo-cd/delete-apps-wftpl.yaml @@ -102,7 +102,7 @@ spec: --password $ARGO_PASSWORD # Pre-check: validate if the app exists - if ! (./argocd app list | grep $APP); then + if ! (./argocd app list --output name | grep -E "^$APP$"); then echo "No such app: $APP. Skipping app removal.." exit 1 fi @@ -110,7 +110,7 @@ spec: echo "Found app '$APP'. Start deleting it.." ./argocd app delete $APP --cascade -y - while (./argocd app list | grep $APP ) + while (./argocd app list --output name | grep -E "^$APP$" ) do echo "Waiting 20 secs for the app to be deleted.." sleep 20