From 8894d4e07961839b36710a3c97595c88282d5dbe Mon Sep 17 00:00:00 2001 From: Jackson West Date: Mon, 29 Mar 2021 22:33:24 -0500 Subject: [PATCH] introduce golang-version file for kubernetes release branches (#269) * introduce golang-version file for kubernetes release branches * space --- .../kubernetes/kubernetes/1-18/GOLANG_VERSION | 1 + .../kubernetes/kubernetes/1-19/GOLANG_VERSION | 1 + .../kubernetes/kubernetes/1-20/GOLANG_VERSION | 1 + projects/kubernetes/kubernetes/Makefile | 7 ++++--- .../kubernetes/build/create_attribution.sh | 3 ++- .../kubernetes/build/create_binaries.sh | 5 +++-- .../kubernetes/kubernetes/build/lib/binaries.sh | 16 ---------------- .../kubernetes/kubernetes/build/run_tests.sh | 5 ++++- 8 files changed, 16 insertions(+), 23 deletions(-) create mode 100644 projects/kubernetes/kubernetes/1-18/GOLANG_VERSION create mode 100644 projects/kubernetes/kubernetes/1-19/GOLANG_VERSION create mode 100644 projects/kubernetes/kubernetes/1-20/GOLANG_VERSION diff --git a/projects/kubernetes/kubernetes/1-18/GOLANG_VERSION b/projects/kubernetes/kubernetes/1-18/GOLANG_VERSION new file mode 100644 index 0000000000..d3456a90f7 --- /dev/null +++ b/projects/kubernetes/kubernetes/1-18/GOLANG_VERSION @@ -0,0 +1 @@ +1.13 diff --git a/projects/kubernetes/kubernetes/1-19/GOLANG_VERSION b/projects/kubernetes/kubernetes/1-19/GOLANG_VERSION new file mode 100644 index 0000000000..d40acaaea0 --- /dev/null +++ b/projects/kubernetes/kubernetes/1-19/GOLANG_VERSION @@ -0,0 +1 @@ +1.15 diff --git a/projects/kubernetes/kubernetes/1-20/GOLANG_VERSION b/projects/kubernetes/kubernetes/1-20/GOLANG_VERSION new file mode 100644 index 0000000000..d40acaaea0 --- /dev/null +++ b/projects/kubernetes/kubernetes/1-20/GOLANG_VERSION @@ -0,0 +1 @@ +1.15 diff --git a/projects/kubernetes/kubernetes/Makefile b/projects/kubernetes/kubernetes/Makefile index 2a7c59d3c7..6edc2c9cf8 100644 --- a/projects/kubernetes/kubernetes/Makefile +++ b/projects/kubernetes/kubernetes/Makefile @@ -3,6 +3,7 @@ RELEASE_BRANCH?=$(shell cat $(BASE_DIRECTORY)/release/DEFAULT_RELEASE_BRANCH) RELEASE?=$(shell cat $(BASE_DIRECTORY)/release/$(RELEASE_BRANCH)/RELEASE) ARTIFACT_BUCKET?=my-s3-bucket GIT_TAG?=$(shell cat ./$(RELEASE_BRANCH)/GIT_TAG) +GOLANG_VERSION?=$(shell cat ./$(RELEASE_BRANCH)/GOLANG_VERSION) REPO=kubernetes COMPONENT=kubernetes/$(REPO) @@ -44,7 +45,7 @@ update-checksums: binaries .PHONY: binaries binaries: - build/create_binaries.sh $(CLONE_URL) $(RELEASE_BRANCH) $(GIT_TAG) + build/create_binaries.sh $(CLONE_URL) $(RELEASE_BRANCH) $(GIT_TAG) $(GOLANG_VERSION) .PHONY: tarballs tarballs: @@ -117,11 +118,11 @@ all: release .PHONY: test test: binaries - build/run_tests.sh $(RELEASE_BRANCH) + build/run_tests.sh $(RELEASE_BRANCH) $(GOLANG_VERSION) .PHONY: attribution attribution: - build/create_attribution.sh $(RELEASE_BRANCH) + build/create_attribution.sh $(RELEASE_BRANCH) $(GOLANG_VERSION) .PHONY: clean-repo clean-repo: diff --git a/projects/kubernetes/kubernetes/build/create_attribution.sh b/projects/kubernetes/kubernetes/build/create_attribution.sh index 491cd60882..3537caf18f 100755 --- a/projects/kubernetes/kubernetes/build/create_attribution.sh +++ b/projects/kubernetes/kubernetes/build/create_attribution.sh @@ -22,7 +22,8 @@ source "${MAKE_ROOT}/build/lib/init.sh" source "${MAKE_ROOT}/../../../build/lib/common.sh" RELEASE_BRANCH="$1" -GOLANG_VERSION=$(build::binaries::get_go_version_k8s "$RELEASE_BRANCH") +GOLANG_VERSION="$2" + OUTPUT_RELEASE_DIR="${OUTPUT_DIR}/${RELEASE_BRANCH}" # a number of k8s.io dependencies which come from the main repo show diff --git a/projects/kubernetes/kubernetes/build/create_binaries.sh b/projects/kubernetes/kubernetes/build/create_binaries.sh index d409cd4797..98995412de 100755 --- a/projects/kubernetes/kubernetes/build/create_binaries.sh +++ b/projects/kubernetes/kubernetes/build/create_binaries.sh @@ -22,7 +22,8 @@ MAKE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" CLONE_URL="$1" RELEASE_BRANCH="$2" -GIT_TAG="${3:-$(cat ${MAKE_ROOT}/${RELEASE_BRANCH}/GIT_TAG)}" +GIT_TAG="$3" +GOLANG_VERSION="$4" source "${MAKE_ROOT}/build/lib/init.sh" source "${MAKE_ROOT}/../../../build/lib/common.sh" @@ -36,7 +37,7 @@ if [ -d ${OUTPUT_DIR}/${RELEASE_BRANCH}/bin ]; then fi build::git::clone "$CLONE_URL" "$SOURCE_DIR" build::git::patch "$SOURCE_DIR" "$GIT_TAG" "$PATCH_DIR" -build::binaries::use_go_version_k8s "$RELEASE_BRANCH" +build::common::use_go_version $GOLANG_VERSION build::binaries::kube_bins "$SOURCE_DIR" mkdir -p ${OUTPUT_DIR}/${RELEASE_BRANCH}/bin diff --git a/projects/kubernetes/kubernetes/build/lib/binaries.sh b/projects/kubernetes/kubernetes/build/lib/binaries.sh index 6ffde769f3..ac10315112 100644 --- a/projects/kubernetes/kubernetes/build/lib/binaries.sh +++ b/projects/kubernetes/kubernetes/build/lib/binaries.sh @@ -13,22 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -function build::binaries::get_go_version_k8s() { - local -r releasebranch="$1" - - if [[ "$releasebranch" == "1-18" ]]; then - echo "1.13" - else - echo "1.15" - fi -} - -function build::binaries::use_go_version_k8s() { - local -r releasebranch="$1" - - build::common::use_go_version $(build::binaries::get_go_version_k8s $releasebranch) -} - function build::binaries::kube_bins() { local -r repository="$1" # Build all core components for linux arm64 and amd64 diff --git a/projects/kubernetes/kubernetes/build/run_tests.sh b/projects/kubernetes/kubernetes/build/run_tests.sh index b24e512964..edcfc4548f 100755 --- a/projects/kubernetes/kubernetes/build/run_tests.sh +++ b/projects/kubernetes/kubernetes/build/run_tests.sh @@ -21,13 +21,16 @@ MAKE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${MAKE_ROOT}/build/lib/init.sh" source "${MAKE_ROOT}/../../../build/lib/common.sh" +RELEASE_BRANCH="$1" +GOLANG_VERSION="$2" + export ARTIFACTS=${ARTIFACTS:-"./_artifacts"} export KUBE_JUNIT_REPORT_DIR="${ARTIFACTS}" export KUBE_KEEP_VERBOSE_TEST_OUTPUT=y export LOG_LEVEL=4 export KUBE_TIMEOUT=${KUBE_TIMEOUT:-"--timeout=600s"} -build::binaries::use_go_version_k8s "$RELEASE_BRANCH" +build::common::use_go_version $GOLANG_VERSION go get gotest.tools/gotestsum