From 0e9e813851bf7f537b857fde672b16ff8a1954e9 Mon Sep 17 00:00:00 2001 From: xing-yang Date: Thu, 22 Feb 2024 15:29:50 -0500 Subject: [PATCH] Squashed 'release-tools/' changes from b54c1ba49..dc4d0ae20 dc4d0ae20 Merge pull request #249 from jsafrane/use-go-version e681b170e Use .go-version to get Kubernetes go version git-subtree-dir: release-tools git-subtree-split: dc4d0ae20a3dcce17fbfc745fb1f1e3b10cd9644 --- prow.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/prow.sh b/prow.sh index a27c71f3df..0af3fdcd86 100755 --- a/prow.sh +++ b/prow.sh @@ -564,7 +564,15 @@ go_version_for_kubernetes () ( local version="$2" local go_version - # We use the minimal Go version specified for each K8S release (= minimum_go_version in hack/lib/golang.sh). + # Try to get the version for .go-version + go_version="$( cat "$path/.go-version" )" + if [ "$go_version" ]; then + echo "$go_version" + return + fi + + # Fall back to hack/lib/golang.sh parsing. + # This is necessary in v1.26.0 and older Kubernetes releases that do not have .go-version. # More recent versions might also work, but we don't want to count on that. go_version="$(grep minimum_go_version= "$path/hack/lib/golang.sh" | sed -e 's/.*=go//')" if ! [ "$go_version" ]; then