From 2d226f864ed3a12b9614ec030d2f35006d16c716 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Thu, 18 Aug 2022 16:15:26 +0200 Subject: [PATCH] ci-automation/packages.sh: Fix access to unbound variable We were running the run_sdk_container script with passing a value of a variable named version to the script through the -v flag. But nowhere is the variable defined. This worked under jenkins, because jenkins job has a version parameter that gets exported into environment under the same name. But running it manually outside jenkins revealed the bug. The script should have been using a vernum variable. Now, the difference between this variable and the version variable is that "version" was in form of --, whereas "vernum" comes without the channel part. Fortunately, "run_sdk_container" was stripping the channel part before using this value, so it makes no difference whether we pass main-3333.0.0.0-some-id or just 3333.0.0-some-id. --- ci-automation/packages.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-automation/packages.sh b/ci-automation/packages.sh index 5389b04aaf..029b1f4c56 100644 --- a/ci-automation/packages.sh +++ b/ci-automation/packages.sh @@ -82,10 +82,10 @@ function _packages_build_impl() { local packages_container="flatcar-packages-${arch}-${docker_vernum}" # Build packages; store packages and torcx output in container - ./run_sdk_container -x ./ci-cleanup.sh -n "${packages_container}" -v "${version}" \ + ./run_sdk_container -x ./ci-cleanup.sh -n "${packages_container}" -v "${vernum}" \ -C "${sdk_image}" \ mkdir -p "${CONTAINER_TORCX_ROOT}" - ./run_sdk_container -n "${packages_container}" -v "${version}" \ + ./run_sdk_container -n "${packages_container}" -v "${vernum}" \ -C "${sdk_image}" \ ./build_packages --board="${arch}-usr" \ --torcx_output_root="${CONTAINER_TORCX_ROOT}" @@ -94,7 +94,7 @@ function _packages_build_impl() { local torcx_tmp="__build__/torcx_tmp" rm -rf "${torcx_tmp}" mkdir "${torcx_tmp}" - ./run_sdk_container -n "${packages_container}" -v "${version}" \ + ./run_sdk_container -n "${packages_container}" -v "${vernum}" \ -C "${sdk_image}" \ cp -r "${CONTAINER_TORCX_ROOT}/" \ "${torcx_tmp}"