From 9ca2595bab8b6d8dc2044477032bf503d3a157fc Mon Sep 17 00:00:00 2001 From: klinch0 <68821526+klinch0@users.noreply.github.com> Date: Tue, 22 Apr 2025 16:35:54 +0300 Subject: [PATCH] [ci] Fix escaping for gen_versions_map.sh script (#836) Backport of #836 fixes errors like this: ``` make: Entering directory '/home/runner/work/cozystack/cozystack/packages/apps' find . -maxdepth 2 -name Chart.yaml | awk -F/ '{print $2}' | while read i; do sed -i "s/^name: .*/name: $i/" "$i/Chart.yaml"; done ../../hack/gen_versions_map.sh ../../hack/gen_versions_map.sh: 34: [: !=: unexpected operator fatal: Needed a single revision make: *** [Makefile:17: gen-versions-map] Error 128 make: Leaving directory '/home/runner/work/cozystack/cozystack/packages/apps' ``` https://github.com/cozystack/cozystack/actions/runs/14591720553/job/40928276862?pr=835 Improved reliability of version generation by handling empty or special values safely in the process. (cherry picked from commit 7a9a1fcba47cecb3a9f02eb9e3f6b1369a12b279) Signed-off-by: Nick Volynkin --- hack/gen_versions_map.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/gen_versions_map.sh b/hack/gen_versions_map.sh index 3b65bb4f..c325cff3 100755 --- a/hack/gen_versions_map.sh +++ b/hack/gen_versions_map.sh @@ -30,7 +30,7 @@ resolved_miss_map=$( fi # if commit is not HEAD, check if it's valid - if [ $commit != "HEAD" ]; then + if [ "x$commit" != "xHEAD" ]; then if [ $(git show "${commit}:./${chart}/Chart.yaml" 2>/dev/null | awk '$1 == "version:" {print $2}') != "${version}" ]; then echo "Commit $commit for $chart $version is not valid" >&2 exit 1