Skip to content

Commit b39abbc

Browse files
committed
release-tools: update
Commit summary: Squashed 'release-tools/' changes from 227577e0..734c2b95 [734c2b95](kubernetes-csi/csi-release-tools@734c2b95) Merge [pull request #265](kubernetes-csi/csi-release-tools#265) from Rakshith-R/consider-main-branch [f95c855b](kubernetes-csi/csi-release-tools@f95c855b) Merge [pull request #262](kubernetes-csi/csi-release-tools#262) from huww98/golang-toolchain [3c8d966f](kubernetes-csi/csi-release-tools@3c8d966f) Treat main branch as equivalent to master branch [e31de525](kubernetes-csi/csi-release-tools@e31de525) Merge [pull request #261](kubernetes-csi/csi-release-tools#261) from huww98/golang [fd153a9e](kubernetes-csi/csi-release-tools@fd153a9e) Bump golang to 1.23.1 [a8b3d050](kubernetes-csi/csi-release-tools@a8b3d050) pull-test.sh: fix "git subtree pull" errors [6b05f0fc](kubernetes-csi/csi-release-tools@6b05f0fc) use new GOTOOLCHAIN env to manage go version git-subtree-dir: release-tools git-subtree-split: 734c2b950c4b31f64b63052c64ffa5929d1c9b97 Signed-off-by: Mario Valderrama <[email protected]>
2 parents ef3b511 + 5344947 commit b39abbc

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

release-tools/build.make

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ REV=$(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git r
4545
# Determined dynamically.
4646
IMAGE_TAGS=
4747

48-
# A "canary" image gets built if the current commit is the head of the remote "master" branch.
48+
# A "canary" image gets built if the current commit is the head of the remote "master" or "main" branch.
4949
# That branch does not exist when building some other branch in TravisCI.
5050
IMAGE_TAGS+=$(shell if [ "$$(git rev-list -n1 HEAD)" = "$$(git rev-list -n1 origin/master 2>/dev/null)" ]; then echo "canary"; fi)
51+
IMAGE_TAGS+=$(shell if [ "$$(git rev-list -n1 HEAD)" = "$$(git rev-list -n1 origin/main 2>/dev/null)" ]; then echo "canary"; fi)
5152

5253
# A "X.Y.Z-canary" image gets built if the current commit is the head of a "origin/release-X.Y.Z" branch.
5354
# The actual suffix does not matter, only the "release-" prefix is checked.
@@ -143,7 +144,7 @@ DOCKER_BUILDX_CREATE_ARGS ?=
143144
# Windows binaries can be built before adding a Dockerfile for it.
144145
#
145146
# BUILD_PLATFORMS determines which individual images are included in the multiarch image.
146-
# PULL_BASE_REF must be set to 'master', 'release-x.y', or a tag name, and determines
147+
# PULL_BASE_REF must be set to 'master', 'main', 'release-x.y', or a tag name, and determines
147148
# the tag for the resulting multiarch image.
148149
$(CMDS:%=push-multiarch-%): push-multiarch-%: check-pull-base-ref build-%
149150
set -ex; \
@@ -191,7 +192,7 @@ $(CMDS:%=push-multiarch-%): push-multiarch-%: check-pull-base-ref build-%
191192
done; \
192193
docker manifest push -p $(IMAGE_NAME):$$tag; \
193194
}; \
194-
if [ $(PULL_BASE_REF) = "master" ]; then \
195+
if [ $(PULL_BASE_REF) = "master" ] || [ $(PULL_BASE_REF) = "main" ]; then \
195196
: "creating or overwriting canary image"; \
196197
pushMultiArch canary; \
197198
elif echo $(PULL_BASE_REF) | grep -q -e 'release-*' ; then \
@@ -209,7 +210,7 @@ $(CMDS:%=push-multiarch-%): push-multiarch-%: check-pull-base-ref build-%
209210
.PHONY: check-pull-base-ref
210211
check-pull-base-ref:
211212
if ! [ "$(PULL_BASE_REF)" ]; then \
212-
echo >&2 "ERROR: PULL_BASE_REF must be set to 'master', 'release-x.y', or a tag name."; \
213+
echo >&2 "ERROR: PULL_BASE_REF must be set to 'master', 'main', 'release-x.y', or a tag name."; \
213214
exit 1; \
214215
fi
215216

release-tools/prow.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ configvar CSI_PROW_BUILD_PLATFORMS "linux amd64 amd64; linux ppc64le ppc64le -pp
8686
# which is disabled with GOFLAGS=-mod=vendor).
8787
configvar GOFLAGS_VENDOR "$( [ -d vendor ] && echo '-mod=vendor' )" "Go flags for using the vendor directory"
8888

89-
configvar CSI_PROW_GO_VERSION_BUILD "1.22.5" "Go version for building the component" # depends on component's source code
89+
configvar CSI_PROW_GO_VERSION_BUILD "1.23.1" "Go version for building the component" # depends on component's source code
9090
configvar CSI_PROW_GO_VERSION_E2E "" "override Go version for building the Kubernetes E2E test suite" # normally doesn't need to be set, see install_e2e
9191
configvar CSI_PROW_GO_VERSION_SANITY "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building the csi-sanity test suite" # depends on CSI_PROW_SANITY settings below
9292
configvar CSI_PROW_GO_VERSION_KIND "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building 'kind'" # depends on CSI_PROW_KIND_VERSION below
@@ -425,23 +425,23 @@ die () {
425425
exit 1
426426
}
427427

428-
# Ensure that PATH has the desired version of the Go tools, then run command given as argument.
428+
# Ensure we use the desired version of the Go tools, then run command given as argument.
429429
# Empty parameter uses the already installed Go. In Prow, that version is kept up-to-date by
430430
# bumping the container image regularly.
431431
run_with_go () {
432432
local version
433433
version="$1"
434434
shift
435435

436-
if ! [ "$version" ] || go version 2>/dev/null | grep -q "go$version"; then
437-
run "$@"
438-
else
439-
if ! [ -d "${CSI_PROW_WORK}/go-$version" ]; then
440-
run curl --fail --location "https://dl.google.com/go/go$version.linux-amd64.tar.gz" | tar -C "${CSI_PROW_WORK}" -zxf - || die "installation of Go $version failed"
441-
mv "${CSI_PROW_WORK}/go" "${CSI_PROW_WORK}/go-$version"
436+
if [ "$version" ]; then
437+
version=go$version
438+
if [ "$(GOTOOLCHAIN=$version go version | cut -d' ' -f3)" != "$version" ]; then
439+
die "Please install Go 1.21+"
442440
fi
443-
PATH="${CSI_PROW_WORK}/go-$version/bin:$PATH" run "$@"
441+
else
442+
version=local
444443
fi
444+
GOTOOLCHAIN=$version run "$@"
445445
}
446446

447447
# Ensure that we have the desired version of kind.

release-tools/pull-test.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
set -ex
2222

23+
# Prow checks out repos with --filter=blob:none. This breaks
24+
# "git subtree pull" unless we enable fetching missing file content.
25+
GIT_NO_LAZY_FETCH=0
26+
export GIT_NO_LAZY_FETCH
27+
2328
# It must be called inside the updated csi-release-tools repo.
2429
CSI_RELEASE_TOOLS_DIR="$(pwd)"
2530

0 commit comments

Comments
 (0)