From 6adb0ce99b6bb1cf871212e78e9a037522925e67 Mon Sep 17 00:00:00 2001 From: Anupama <38144301+anupama2501@users.noreply.github.com> Date: Wed, 13 Nov 2024 14:55:58 -0800 Subject: [PATCH] Debugging rancher versions script --- .../pipeline/Jenkinsfile.release.upgrade.local | 11 ++++++++++- .../pipeline/scripts/rancher_k8s_version.sh | 8 ++++---- 2 files changed, 14 insertions(+), 5 deletions(-) mode change 100644 => 100755 tests/v2/validation/pipeline/scripts/rancher_k8s_version.sh diff --git a/tests/v2/validation/pipeline/Jenkinsfile.release.upgrade.local b/tests/v2/validation/pipeline/Jenkinsfile.release.upgrade.local index 0ccb40a486..22da83f2e6 100644 --- a/tests/v2/validation/pipeline/Jenkinsfile.release.upgrade.local +++ b/tests/v2/validation/pipeline/Jenkinsfile.release.upgrade.local @@ -169,9 +169,18 @@ node { def configContents = env.CONFIG def rancherK8sVersions = "" + + echo "Printing the contents of the directory" + + sh "ls -l" + + sh "pwd" + + echo "Before the start of script." + try{ rancherK8sVersions= sh ( - script: "${workPath}pipeline/scripts/rancher_k8s_version.sh", + script: "./pipeline/scripts/rancher_k8s_version.sh", returnStdout: true ) } catch(err){ diff --git a/tests/v2/validation/pipeline/scripts/rancher_k8s_version.sh b/tests/v2/validation/pipeline/scripts/rancher_k8s_version.sh old mode 100644 new mode 100755 index 238bd6462b..927f497a88 --- a/tests/v2/validation/pipeline/scripts/rancher_k8s_version.sh +++ b/tests/v2/validation/pipeline/scripts/rancher_k8s_version.sh @@ -4,13 +4,13 @@ latest_rancher_version=$(curl -s https://prime.ribs.rancher.io/index.html | grep echo "Latest Rancher Version: $latest_rancher_version" k8s_versions=$(curl -s "https://prime.ribs.rancher.io/rancher/${latest_rancher_version}/rancher-images.txt" | grep "rancher/hardened-kubernetes:" | awk -F':' '{print $2}' | awk -F '-build' '{print $1}' | sort -V | awk -F '.' ' - {versions[$1"."$2] = $0} # Keep only the latest version for each major.minor + {versions[$1"."$2] = $0} END { - for (v in versions) print versions[v]"," + for (v in versions) print versions[v]"" }' | sort -V | tail -n 2) # Output the results -echo "Latest Kubernetes Versions:" -echo "$k8s_versions" +echo "Latest Kubernetes Versions: " +echo "$k8s_versions"