From f4dd15286345cbc7d1454b8677ececbed136fd05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bombo?= Date: Wed, 16 Aug 2023 13:29:54 -0700 Subject: [PATCH] tests: k8s: Call ensure_yq() in setup.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It wasn't the `common.bash` import in `run_kubernetes_tests.sh` causing the yq error so let's try this instead. Reference: https://github.com/kata-containers/kata-containers/actions/runs/5674941359/job/15379797568#step:10:341 Signed-off-by: Aurélien Bombo --- tests/common.bash | 1 + tests/integration/kubernetes/setup.sh | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/common.bash b/tests/common.bash index bdb63c77cc..5e5f833ef3 100644 --- a/tests/common.bash +++ b/tests/common.bash @@ -338,6 +338,7 @@ function ensure_yq() { export GOPATH export PATH="${GOPATH}/bin:${PATH}" INSTALL_IN_GOPATH=true "${repo_root_dir}/ci/install_yq.sh" + hash -d yq # yq is preinstalled on GHA Ubuntu 22.04 runners so we clear Bash's PATH cache. } # dependency: What we want to get the version from the versions.yaml file diff --git a/tests/integration/kubernetes/setup.sh b/tests/integration/kubernetes/setup.sh index 67a2599643..0731e83f7a 100755 --- a/tests/integration/kubernetes/setup.sh +++ b/tests/integration/kubernetes/setup.sh @@ -18,18 +18,20 @@ reset_workloads_work_dir() { set_kernel_path() { if [[ "${KATA_HOST_OS}" = "cbl-mariner" ]]; then mariner_kernel_path="/usr/share/cloud-hypervisor/vmlinux.bin" - find ${kubernetes_dir}/runtimeclass_workloads_work/*.yaml -exec yq write -i {} 'metadata.annotations[io.katacontainers.config.hypervisor.kernel]' "${mariner_kernel_path}" \; + # Not using find -exec as that still returns 0 on failure. + find ${kubernetes_dir}/runtimeclass_workloads_work/*.yaml -print0 | xargs -0 -I% yq write -i % 'metadata.annotations[io.katacontainers.config.hypervisor.kernel]' "${mariner_kernel_path}" fi } set_initrd_path() { if [[ "${KATA_HOST_OS}" = "cbl-mariner" ]]; then initrd_path="/opt/kata/share/kata-containers/kata-containers-initrd-mariner.img" - find ${kubernetes_dir}/runtimeclass_workloads_work/*.yaml -exec yq write -i {} 'metadata.annotations[io.katacontainers.config.hypervisor.initrd]' "${initrd_path}" \; + find ${kubernetes_dir}/runtimeclass_workloads_work/*.yaml -print0 | xargs -0 -I% yq write -i % 'metadata.annotations[io.katacontainers.config.hypervisor.initrd]' "${initrd_path}" fi } main() { + ensure_yq reset_workloads_work_dir set_kernel_path set_initrd_path