From c9e26256fa8ee86d55a4970449fda0d0a6fbad41 Mon Sep 17 00:00:00 2001 From: Xun Jiang/Bruce Jiang <59276555+blackpiglet@users.noreply.github.com> Date: Wed, 11 Feb 2026 04:50:23 +0800 Subject: [PATCH] Bump Golang version to v1.25.7 (#9536) Fix test case issue and add UT. Signed-off-by: Xun Jiang --- Dockerfile | 4 +- Dockerfile-Windows | 2 +- Tiltfile | 2 +- go.mod | 2 +- hack/build-image/Dockerfile | 2 +- test/util/velero/install.go | 2 +- test/util/velero/install_test.go | 65 ++++++++++++++++++++++++++++++++ 7 files changed, 72 insertions(+), 7 deletions(-) create mode 100644 test/util/velero/install_test.go diff --git a/Dockerfile b/Dockerfile index 6ce46ca3b..499ebe374 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # Velero binary build section -FROM --platform=$BUILDPLATFORM golang:1.25-bookworm AS velero-builder +FROM --platform=$BUILDPLATFORM golang:1.25.7-bookworm AS velero-builder ARG GOPROXY ARG BIN @@ -49,7 +49,7 @@ RUN mkdir -p /output/usr/bin && \ go clean -modcache -cache # Restic binary build section -FROM --platform=$BUILDPLATFORM golang:1.25-bookworm AS restic-builder +FROM --platform=$BUILDPLATFORM golang:1.25.7-bookworm AS restic-builder ARG GOPROXY ARG BIN diff --git a/Dockerfile-Windows b/Dockerfile-Windows index ac22531dc..c34ead129 100644 --- a/Dockerfile-Windows +++ b/Dockerfile-Windows @@ -15,7 +15,7 @@ ARG OS_VERSION=1809 # Velero binary build section -FROM --platform=$BUILDPLATFORM golang:1.25-bookworm AS velero-builder +FROM --platform=$BUILDPLATFORM golang:1.25.7-bookworm AS velero-builder ARG GOPROXY ARG BIN diff --git a/Tiltfile b/Tiltfile index 7f2029f6d..13ec9993a 100644 --- a/Tiltfile +++ b/Tiltfile @@ -52,7 +52,7 @@ git_sha = str(local("git rev-parse HEAD", quiet = True, echo_off = True)).strip( tilt_helper_dockerfile_header = """ # Tilt image -FROM golang:1.25 as tilt-helper +FROM golang:1.25.7 as tilt-helper # Support live reloading with Tilt RUN wget --output-document /restart.sh --quiet https://raw.githubusercontent.com/windmilleng/rerun-process-wrapper/master/restart.sh && \ diff --git a/go.mod b/go.mod index 65177f63d..4744da7c4 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/vmware-tanzu/velero -go 1.25.0 +go 1.25.7 require ( cloud.google.com/go/storage v1.57.2 diff --git a/hack/build-image/Dockerfile b/hack/build-image/Dockerfile index 89477d2fb..42caf9558 100644 --- a/hack/build-image/Dockerfile +++ b/hack/build-image/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM --platform=$TARGETPLATFORM golang:1.25-bookworm +FROM --platform=$TARGETPLATFORM golang:1.25.7-bookworm ARG GOPROXY diff --git a/test/util/velero/install.go b/test/util/velero/install.go index da57ef19e..e2c57392e 100644 --- a/test/util/velero/install.go +++ b/test/util/velero/install.go @@ -365,7 +365,7 @@ func VersionNoOlderThan(version string, targetVersion string) (bool, error) { matches := tagRe.FindStringSubmatch(targetVersion) targetMajor := matches[1] targetMinor := matches[2] - if major > targetMajor && minor >= targetMinor { + if major >= targetMajor && minor >= targetMinor { return true, nil } else { return false, nil diff --git a/test/util/velero/install_test.go b/test/util/velero/install_test.go new file mode 100644 index 000000000..8ea51bd40 --- /dev/null +++ b/test/util/velero/install_test.go @@ -0,0 +1,65 @@ +/* +Copyright the Velero contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package velero + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_VersionNoOlderThan(t *testing.T) { + type versionTest struct { + caseName string + version string + targetVersion string + result bool + err error + } + tests := []versionTest{ + { + caseName: "branch version compare", + version: "release-1.18", + targetVersion: "v1.16", + result: true, + err: nil, + }, + { + caseName: "tag version compare", + version: "v1.18.0", + targetVersion: "v1.16", + result: true, + err: nil, + }, + { + caseName: "main version compare", + version: "main", + targetVersion: "v1.15", + result: true, + err: nil, + }, + } + + for _, test := range tests { + t.Run(test.caseName, func(t *testing.T) { + res, err := VersionNoOlderThan(test.version, test.targetVersion) + + require.Equal(t, test.err, err) + require.Equal(t, test.result, res) + }) + } +}