From 2c24977cb1a42198ed0a818fc7cd3b03af826c78 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Thu, 15 Feb 2024 16:00:22 -0300 Subject: [PATCH] tests/k8s: allow to overwrite the cluster name _print_cluster_name() create a string based information like the pull request number and commit SHA. However, when you are developing the scripts you might want to use an arbitrary name, so it was introduced the $AKS_NAME variable that once exported it will overwrite the generated name. Signed-off-by: Wainer dos Santos Moschetta --- tests/gha-run-k8s-common.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/gha-run-k8s-common.sh b/tests/gha-run-k8s-common.sh index 391970e90a..d91899abfd 100644 --- a/tests/gha-run-k8s-common.sh +++ b/tests/gha-run-k8s-common.sh @@ -27,11 +27,19 @@ function _print_instance_type() { esac } +# Print the cluster name set by $AKS_NAME or generated out of runtime +# metadata (e.g. pull request number, commit SHA, etc). +# function _print_cluster_name() { - test_type="${1:-k8s}" + local test_type="${1:-k8s}" + local short_sha - short_sha="$(git rev-parse --short=12 HEAD)" - echo "${test_type}-${GH_PR_NUMBER}-${short_sha}-${KATA_HYPERVISOR}-${KATA_HOST_OS}-amd64-${K8S_TEST_HOST_TYPE:0:1}" + if [ -n "${AKS_NAME:-}" ]; then + echo "$AKS_NAME" + else + short_sha="$(git rev-parse --short=12 HEAD)" + echo "${test_type}-${GH_PR_NUMBER}-${short_sha}-${KATA_HYPERVISOR}-${KATA_HOST_OS}-amd64-${K8S_TEST_HOST_TYPE:0:1}" + fi } function _print_rg_name() {