Skip to content

Commit

Permalink
gha: delete azure RG only if it exists
Browse files Browse the repository at this point in the history
delete_cluster() has tried to delete the az resources group regardless
if it exists. In some cases the result of that operation is ignored,
i.e., fail to resource group not found, but the log messages get a
little dirty. Let's delete the RG only if it exists then.

Fixes #8989
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
  • Loading branch information
wainersm committed Feb 2, 2024
1 parent bf54a02 commit 8c92832
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/gha-run-k8s-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,14 @@ function get_cluster_credentials() {

function delete_cluster() {
test_type="${1:-k8s}"

az group delete \
-g "$(_print_rg_name ${test_type})" \
--yes
local rg
rg="$(_print_rg_name ${test_type})"

if [ "$(az group exists -n "${rg}")" == "true" ]; then
az group delete \
-g "${rg}" \
--yes
fi
}

function delete_cluster_kcli() {
Expand Down

0 comments on commit 8c92832

Please sign in to comment.