From d0fe60e784d601ae06db6091161e41f9c5f213bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Mon, 26 Jan 2026 12:25:00 +0100 Subject: [PATCH] tests: Fix empty string handling for helm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix empty string handling in format conversion When HELM_ALLOWED_HYPERVISOR_ANNOTATIONS, HELM_AGENT_HTTPS_PROXY, or HELM_AGENT_NO_PROXY are empty, the pattern matching condition `!= *:*` or `!= *=*` evaluates to true, causing the conversion loop to create invalid entries like "qemu-tdx: qemu-snp:". Add -n checks to ensure conversion only runs when variables are non-empty. Signed-off-by: Fabiano FidĂȘncio --- tests/gha-run-k8s-common.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/gha-run-k8s-common.sh b/tests/gha-run-k8s-common.sh index 5e4329cbe5..1e4a367383 100644 --- a/tests/gha-run-k8s-common.sh +++ b/tests/gha-run-k8s-common.sh @@ -679,7 +679,7 @@ function helm_helper() { # HELM_ALLOWED_HYPERVISOR_ANNOTATIONS: if not in per-shim format (no colon), convert to per-shim format # Output format: "qemu:foo,bar clh:foo" (space-separated entries, each with shim:annotations where annotations are comma-separated) # Example: "foo bar" with shim "qemu-tdx" -> "qemu-tdx:foo,bar" - if [[ "${HELM_ALLOWED_HYPERVISOR_ANNOTATIONS}" != *:* ]]; then + if [[ -n "${HELM_ALLOWED_HYPERVISOR_ANNOTATIONS}" && "${HELM_ALLOWED_HYPERVISOR_ANNOTATIONS}" != *:* ]]; then # Simple format: convert to per-shim format for all enabled shims # "default_vcpus" -> "qemu-tdx:default_vcpus" (single shim) # "image kernel default_vcpus" -> "qemu-tdx:image,kernel,default_vcpus" (single shim) @@ -697,7 +697,7 @@ function helm_helper() { fi # HELM_AGENT_HTTPS_PROXY: if not in per-shim format (no equals), convert to per-shim format - if [[ "${HELM_AGENT_HTTPS_PROXY}" != *=* ]]; then + if [[ -n "${HELM_AGENT_HTTPS_PROXY}" && "${HELM_AGENT_HTTPS_PROXY}" != *=* ]]; then # Simple format: convert to per-shim format for all enabled shims # "http://proxy:8080" -> "qemu-tdx=http://proxy:8080;qemu-snp=http://proxy:8080" local converted_proxy="" @@ -711,7 +711,7 @@ function helm_helper() { fi # HELM_AGENT_NO_PROXY: if not in per-shim format (no equals), convert to per-shim format - if [[ "${HELM_AGENT_NO_PROXY}" != *=* ]]; then + if [[ -n "${HELM_AGENT_NO_PROXY}" && "${HELM_AGENT_NO_PROXY}" != *=* ]]; then # Simple format: convert to per-shim format for all enabled shims # "localhost,127.0.0.1" -> "qemu-tdx=localhost,127.0.0.1;qemu-snp=localhost,127.0.0.1" local converted_noproxy=""