From 3615d73433d6cc943097b72157e9bbba51c19b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 13 Jul 2023 14:06:05 +0200 Subject: [PATCH] ci: Add get_from_kata_deps() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First of all, I'm 100% aware that I'm duplicating this function here as I've copied it from the packaging stuff, and I'm not exactly proud of that. However, right now it seems a little bit premature to combine that set of scripts with this set of scripts in a single one and make them used by both pieces of our project. Anyways, this functions helps to get information from the `versions.yaml` file, and it'll be used as part of the cri-containerd tests and a few others in the future. Signed-off-by: Fabiano FidĂȘncio --- tests/common.bash | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/common.bash b/tests/common.bash index 554c04427..71487e00f 100644 --- a/tests/common.bash +++ b/tests/common.bash @@ -341,4 +341,13 @@ function ensure_yq() { INSTALL_IN_GOPATH=true "${repo_root_dir}/ci/install_yq.sh" } +# dependency: What we want to get the version from the versions.yaml file +function get_from_kata_deps() { + local dependency="$1" + versions_file="${repo_root_dir}/versions.yaml" + command -v yq &>/dev/null || die 'yq command is not in your $PATH' + result=$("yq" read -X "$versions_file" "$dependency") + [ "$result" = "null" ] && result="" + echo "$result" +}