Skip to content

Commit 59af672

Browse files
authored
Merge pull request #1244 from AndrewSirenko/cve-cherrypicks
[release-8.1] Bump to go v1.23.1 to fix trivy
2 parents d5c03db + 9a97999 commit 59af672

File tree

8 files changed

+101
-52
lines changed

8 files changed

+101
-52
lines changed

.github/workflows/trivy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Install go
1717
uses: actions/setup-go@v5
1818
with:
19-
go-version: 1.22.5
19+
go-version: 1.23.1
2020

2121
- name: Build images from Dockerfile
2222
run: |

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/kubernetes-csi/external-snapshotter/v8
22

3-
go 1.22.5
3+
go 1.23.1
44

55
require (
66
github.com/container-storage-interface/spec v1.9.0
@@ -11,7 +11,7 @@ require (
1111
github.com/kubernetes-csi/csi-lib-utils v0.19.0
1212
github.com/kubernetes-csi/csi-test/v5 v5.2.0
1313
github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0
14-
github.com/prometheus/client_golang v1.20.2
14+
github.com/prometheus/client_golang v1.20.5
1515
github.com/prometheus/client_model v0.6.1
1616
github.com/prometheus/common v0.55.0
1717
github.com/spf13/cobra v1.8.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
9393
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
9494
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
9595
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
96-
github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg=
97-
github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
96+
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
97+
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
9898
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
9999
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
100100
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=

release-tools/build.make

Lines changed: 7 additions & 6 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.
@@ -62,9 +63,9 @@ IMAGE_NAME=$(REGISTRY_NAME)/$*
6263

6364
ifdef V
6465
# Adding "-alsologtostderr" assumes that all test binaries contain glog. This is not guaranteed.
65-
TESTARGS = -v -args -alsologtostderr -v 5
66+
TESTARGS = -race -v -args -alsologtostderr -v 5
6667
else
67-
TESTARGS =
68+
TESTARGS = -race
6869
endif
6970

7071
# Specific packages can be excluded from each of the tests below by setting the *_FILTER_CMD variables
@@ -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: 12 additions & 11 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
@@ -199,7 +199,7 @@ kindest/node:v1.18.20@sha256:738cdc23ed4be6cc0b7ea277a2ebcc454c8373d7d8fb991a7fc
199199
# If the deployment script is called with CSI_PROW_TEST_DRIVER=<file name> as
200200
# environment variable, then it must write a suitable test driver configuration
201201
# into that file in addition to installing the driver.
202-
configvar CSI_PROW_DRIVER_VERSION "v1.12.0" "CSI driver version"
202+
configvar CSI_PROW_DRIVER_VERSION "v1.15.0" "CSI driver version"
203203
configvar CSI_PROW_DRIVER_REPO https://github.com/kubernetes-csi/csi-driver-host-path "CSI driver repo"
204204
configvar CSI_PROW_DEPLOYMENT "" "deployment"
205205
configvar CSI_PROW_DEPLOYMENT_SUFFIX "" "additional suffix in kubernetes-x.yy[suffix].yaml files"
@@ -425,23 +425,24 @@ 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+
# Set GOMODCACHE to make sure Kubernetes does not need to download again.
445+
GOTOOLCHAIN=$version GOMODCACHE="$(go env GOMODCACHE)" run "$@"
445446
}
446447

447448
# Ensure that we have the desired version of kind.
@@ -624,7 +625,7 @@ start_cluster () {
624625
go_version="$(go_version_for_kubernetes "${CSI_PROW_WORK}/src/kubernetes" "$version")" || die "cannot proceed without knowing Go version for Kubernetes"
625626
# Changing into the Kubernetes source code directory is a workaround for https://github.com/kubernetes-sigs/kind/issues/1910
626627
# shellcheck disable=SC2046
627-
(cd "${CSI_PROW_WORK}/src/kubernetes" && run_with_go "$go_version" kind build node-image --image csiprow/node:latest --kube-root "${CSI_PROW_WORK}/src/kubernetes") || die "'kind build node-image' failed"
628+
(cd "${CSI_PROW_WORK}/src/kubernetes" && run_with_go "$go_version" kind build node-image "${CSI_PROW_WORK}/src/kubernetes" --image csiprow/node:latest) || die "'kind build node-image' failed"
628629
csi_prow_kind_have_kubernetes=true
629630
fi
630631
image="csiprow/node:latest"

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

vendor/github.com/prometheus/client_golang/prometheus/histogram.go

Lines changed: 71 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ github.com/munnerz/goautoneg
153153
# github.com/pkg/errors v0.9.1
154154
## explicit
155155
github.com/pkg/errors
156-
# github.com/prometheus/client_golang v1.20.2
156+
# github.com/prometheus/client_golang v1.20.5
157157
## explicit; go 1.20
158158
github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil
159159
github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/header

0 commit comments

Comments
 (0)