From 2103a15ca30f03ef8d68c64299cda964a1f9f134 Mon Sep 17 00:00:00 2001 From: MinerYang Date: Tue, 31 Oct 2023 00:36:15 +0800 Subject: [PATCH] bump golang to 1.21.3 on release-2.9.0 (#19503) bump golang to 1.21.3 update 1.21 CI update ut mock anything Signed-off-by: yminer --- .github/workflows/CI.yml | 20 ++++++++++---------- .github/workflows/build-package.yml | 4 ++-- .github/workflows/conformance_test.yml | 4 ++-- CONTRIBUTING.md | 2 +- Makefile | 2 +- make/photon/registry/Dockerfile.binary | 2 +- make/photon/trivy-adapter/Dockerfile.binary | 2 +- make/photon/trivy-adapter/builder.sh | 2 +- src/go.mod | 2 +- src/server/middleware/quota/util_test.go | 4 ++-- tests/ci/distro_installer.sh | 4 ++-- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e0de09613e4..529ea4fc753 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -41,10 +41,10 @@ jobs: - ubuntu-latest timeout-minutes: 100 steps: - - name: Set up Go 1.20 + - name: Set up Go 1.21 uses: actions/setup-go@v1 with: - go-version: 1.20.10 + go-version: 1.21.3 id: go - uses: actions/checkout@v3 with: @@ -102,10 +102,10 @@ jobs: - ubuntu-latest timeout-minutes: 100 steps: - - name: Set up Go 1.20 + - name: Set up Go 1.21 uses: actions/setup-go@v1 with: - go-version: 1.20.10 + go-version: 1.21.3 id: go - uses: actions/checkout@v3 with: @@ -157,10 +157,10 @@ jobs: - ubuntu-latest timeout-minutes: 100 steps: - - name: Set up Go 1.20 + - name: Set up Go 1.21 uses: actions/setup-go@v1 with: - go-version: 1.20.10 + go-version: 1.21.3 id: go - uses: actions/checkout@v3 with: @@ -212,10 +212,10 @@ jobs: - ubuntu-latest timeout-minutes: 100 steps: - - name: Set up Go 1.20 + - name: Set up Go 1.21 uses: actions/setup-go@v1 with: - go-version: 1.20.10 + go-version: 1.21.3 id: go - uses: actions/checkout@v3 with: @@ -265,10 +265,10 @@ jobs: - ubuntu-latest timeout-minutes: 100 steps: - - name: Set up Go 1.20 + - name: Set up Go 1.21 uses: actions/setup-go@v1 with: - go-version: 1.20.10 + go-version: 1.21.3 id: go - uses: actions/checkout@v3 with: diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml index 80681022449..25d6bc783fd 100644 --- a/.github/workflows/build-package.yml +++ b/.github/workflows/build-package.yml @@ -23,10 +23,10 @@ jobs: with: version: '430.0.0' - run: gcloud info - - name: Set up Go 1.20 + - name: Set up Go 1.21 uses: actions/setup-go@v1 with: - go-version: 1.20.10 + go-version: 1.21.3 id: go - name: Setup Docker uses: docker-practice/actions-setup-docker@master diff --git a/.github/workflows/conformance_test.yml b/.github/workflows/conformance_test.yml index cbed5765089..7570e2aa750 100644 --- a/.github/workflows/conformance_test.yml +++ b/.github/workflows/conformance_test.yml @@ -25,10 +25,10 @@ jobs: credentials_json: '${{ secrets.GCP_CREDENTIALS }}' - uses: google-github-actions/setup-gcloud@v1 - run: gcloud info - - name: Set up Go 1.20 + - name: Set up Go 1.21 uses: actions/setup-go@v1 with: - go-version: 1.20.10 + go-version: 1.21.3 id: go - uses: actions/checkout@v3 with: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 32eb86647af..13c4ef0a45c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -166,7 +166,7 @@ Harbor backend is written in [Go](http://golang.org/). If you don't have a Harbo | 2.6 | 1.18.6 | | 2.7 | 1.19.4 | | 2.8 | 1.20.6 | -| 2.9 | 1.20.10 | +| 2.9 | 1.21.3 | Ensure your GOPATH and PATH have been configured in accordance with the Go environment instructions. diff --git a/Makefile b/Makefile index 7e8046c4068..3ad1f765904 100644 --- a/Makefile +++ b/Makefile @@ -140,7 +140,7 @@ GOINSTALL=$(GOCMD) install GOTEST=$(GOCMD) test GODEP=$(GOTEST) -i GOFMT=gofmt -w -GOBUILDIMAGE=golang:1.20.10 +GOBUILDIMAGE=golang:1.21.3 GOBUILDPATHINCONTAINER=/harbor # go build diff --git a/make/photon/registry/Dockerfile.binary b/make/photon/registry/Dockerfile.binary index 00ce9eb49ee..58478e5049f 100644 --- a/make/photon/registry/Dockerfile.binary +++ b/make/photon/registry/Dockerfile.binary @@ -1,4 +1,4 @@ -FROM golang:1.20.10 +FROM golang:1.21.3 ENV DISTRIBUTION_DIR /go/src/github.com/docker/distribution ENV BUILDTAGS include_oss include_gcs diff --git a/make/photon/trivy-adapter/Dockerfile.binary b/make/photon/trivy-adapter/Dockerfile.binary index 506819ae82d..051a296e432 100644 --- a/make/photon/trivy-adapter/Dockerfile.binary +++ b/make/photon/trivy-adapter/Dockerfile.binary @@ -1,4 +1,4 @@ -FROM golang:1.20.10 +FROM golang:1.21.3 ADD . /go/src/github.com/aquasecurity/harbor-scanner-trivy/ WORKDIR /go/src/github.com/aquasecurity/harbor-scanner-trivy/ diff --git a/make/photon/trivy-adapter/builder.sh b/make/photon/trivy-adapter/builder.sh index f3c2f3104a2..7f98e75e10f 100755 --- a/make/photon/trivy-adapter/builder.sh +++ b/make/photon/trivy-adapter/builder.sh @@ -19,7 +19,7 @@ TEMP=$(mktemp -d ${TMPDIR-/tmp}/trivy-adapter.XXXXXX) git clone https://github.com/aquasecurity/harbor-scanner-trivy.git $TEMP cd $TEMP; git checkout $VERSION; cd - -echo "Building Trivy adapter binary based on golang:1.20.10..." +echo "Building Trivy adapter binary based on golang:1.21.3..." cp Dockerfile.binary $TEMP docker build -f $TEMP/Dockerfile.binary -t trivy-adapter-golang $TEMP diff --git a/src/go.mod b/src/go.mod index 1a7486237e3..158a0b7bf6c 100644 --- a/src/go.mod +++ b/src/go.mod @@ -1,6 +1,6 @@ module github.com/goharbor/harbor/src -go 1.20 +go 1.21 require ( github.com/FZambia/sentinel v1.1.0 diff --git a/src/server/middleware/quota/util_test.go b/src/server/middleware/quota/util_test.go index 870ab1388e5..98af2ad8826 100644 --- a/src/server/middleware/quota/util_test.go +++ b/src/server/middleware/quota/util_test.go @@ -29,8 +29,8 @@ import ( func Test_projectReferenceObject(t *testing.T) { ctl := &project.Controller{} - ctl.On("GetByName", mock.AnythingOfType(""), "library").Return(&proModels.Project{ProjectID: 1}, nil) - ctl.On("GetByName", mock.AnythingOfType(""), "demo").Return(nil, fmt.Errorf("not found")) + ctl.On("GetByName", mock.Anything, "library").Return(&proModels.Project{ProjectID: 1}, nil) + ctl.On("GetByName", mock.Anything, "demo").Return(nil, fmt.Errorf("not found")) originalProjectController := projectController defer func() { diff --git a/tests/ci/distro_installer.sh b/tests/ci/distro_installer.sh index 175927c800d..ae5ac7ab3fb 100755 --- a/tests/ci/distro_installer.sh +++ b/tests/ci/distro_installer.sh @@ -3,5 +3,5 @@ set -x set -e -sudo make package_online GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=dev-gitaction PKGVERSIONTAG=dev-gitaction UIVERSIONTAG=dev-gitaction GOBUILDIMAGE=golang:1.20.10 COMPILETAG=compile_golangimage TRIVYFLAG=true HTTPPROXY= PULL_BASE_FROM_DOCKERHUB=false -sudo make package_offline GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=dev-gitaction PKGVERSIONTAG=dev-gitaction UIVERSIONTAG=dev-gitaction GOBUILDIMAGE=golang:1.20.10 COMPILETAG=compile_golangimage TRIVYFLAG=true HTTPPROXY= PULL_BASE_FROM_DOCKERHUB=false +sudo make package_online GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=dev-gitaction PKGVERSIONTAG=dev-gitaction UIVERSIONTAG=dev-gitaction GOBUILDIMAGE=golang:1.21.3 COMPILETAG=compile_golangimage TRIVYFLAG=true HTTPPROXY= PULL_BASE_FROM_DOCKERHUB=false +sudo make package_offline GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=dev-gitaction PKGVERSIONTAG=dev-gitaction UIVERSIONTAG=dev-gitaction GOBUILDIMAGE=golang:1.21.3 COMPILETAG=compile_golangimage TRIVYFLAG=true HTTPPROXY= PULL_BASE_FROM_DOCKERHUB=false