From 156bae2940926260b619b13b48b7a55dd357efed Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Wed, 4 Aug 2021 16:34:55 -0700 Subject: [PATCH] Fix PREVIOUS_CHANNEL lookup when current minor release is not stable Signed-off-by: Brad Davidson --- scripts/test-run-compat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test-run-compat b/scripts/test-run-compat index 78ba93f345..1a26375411 100755 --- a/scripts/test-run-compat +++ b/scripts/test-run-compat @@ -28,7 +28,7 @@ export -f test-post-hook REPO=${REPO:-rancher} IMAGE_NAME=${IMAGE_NAME:-k3s} -PREVIOUS_CHANNEL=$(curl -s https://update.k3s.io/v1-release/channels/stable -o /dev/null -w '%{redirect_url}' | awk -F. '{print "v1." ($(NF - 1) - 1)}') +PREVIOUS_CHANNEL=$(grep 'k8s.io/kubernetes v' go.mod | head -n1 | awk '{print $2}' | awk -F. '{print "v1." ($(NF - 1) - 1)}') PREVIOUS_VERSION=$(curl -s https://update.k3s.io/v1-release/channels/${PREVIOUS_CHANNEL} -o /dev/null -w '%{redirect_url}' | awk -F/ '{print gensub(/\+/, "-", "g", $NF)}') STABLE_VERSION=$(curl -s https://update.k3s.io/v1-release/channels/stable -o /dev/null -w '%{redirect_url}' | awk -F/ '{print gensub(/\+/, "-", "g", $NF)}') LATEST_VERSION=$(curl -s https://update.k3s.io/v1-release/channels/latest -o /dev/null -w '%{redirect_url}' | awk -F/ '{print gensub(/\+/, "-", "g", $NF)}')