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 a04b215
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/gha-run-k8s-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,12 @@ function get_cluster_credentials() {

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

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

function delete_cluster_kcli() {
Expand Down

0 comments on commit a04b215

Please sign in to comment.