diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e4212fe2d16..f141aa86f0f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -33,10 +33,10 @@ jobs: - ubuntu-latest timeout-minutes: 100 steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v1 with: - go-version: 1.19.4 + go-version: 1.20.1 id: go - uses: actions/checkout@v3 with: @@ -94,10 +94,10 @@ jobs: - ubuntu-latest timeout-minutes: 100 steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v1 with: - go-version: 1.19.4 + go-version: 1.20.1 id: go - uses: actions/checkout@v3 with: @@ -149,10 +149,10 @@ jobs: - ubuntu-latest timeout-minutes: 100 steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v1 with: - go-version: 1.19.4 + go-version: 1.20.1 id: go - uses: actions/checkout@v3 with: @@ -204,10 +204,10 @@ jobs: - ubuntu-latest timeout-minutes: 100 steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v1 with: - go-version: 1.19.4 + go-version: 1.20.1 id: go - uses: actions/checkout@v3 with: @@ -257,10 +257,10 @@ jobs: - ubuntu-latest timeout-minutes: 100 steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v1 with: - go-version: 1.19.4 + go-version: 1.20.1 id: go - uses: actions/checkout@v3 with: diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml index d7c7891d1f9..558fe6c5638 100644 --- a/.github/workflows/build-package.yml +++ b/.github/workflows/build-package.yml @@ -23,10 +23,10 @@ jobs: with: version: '285.0.0' - run: gcloud info - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v1 with: - go-version: 1.19.4 + go-version: 1.20.1 id: go - name: Setup Docker uses: docker-practice/actions-setup-docker@1.0.11 diff --git a/.github/workflows/conformance_test.yml b/.github/workflows/conformance_test.yml index 27f87b42add..56ced76f31c 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@v0 - run: gcloud info - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v1 with: - go-version: 1.19.4 + go-version: 1.20.1 id: go - uses: actions/checkout@v3 with: diff --git a/Makefile b/Makefile index da855c56bce..4b749949786 100644 --- a/Makefile +++ b/Makefile @@ -145,14 +145,14 @@ GOINSTALL=$(GOCMD) install GOTEST=$(GOCMD) test GODEP=$(GOTEST) -i GOFMT=gofmt -w -GOBUILDIMAGE=golang:1.19.4 +GOBUILDIMAGE=golang:1.20.1 GOBUILDPATHINCONTAINER=/harbor # go build PKG_PATH=github.com/goharbor/harbor/src/pkg GITCOMMIT := $(shell git rev-parse --short=8 HEAD) RELEASEVERSION := $(shell cat VERSION) -GOFLAGS= +GOFLAGS="-buildvcs=false" GOTAGS=$(if $(GOBUILDTAGS),-tags "$(GOBUILDTAGS)",) GOLDFLAGS=$(if $(GOBUILDLDFLAGS),--ldflags "-w -s $(GOBUILDLDFLAGS)",) CORE_LDFLAGS=-X $(PKG_PATH)/version.GitCommit=$(GITCOMMIT) -X $(PKG_PATH)/version.ReleaseVersion=$(RELEASEVERSION) @@ -498,7 +498,7 @@ misspell: @find . -type d \( -path ./src/vendor -o -path ./tests \) -prune -o -name '*.go' -print | xargs misspell -error # golangci-lint binary installation or refer to https://golangci-lint.run/usage/install/#local-installation -# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2 +# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.51.2 GOLANGCI_LINT := $(shell go env GOPATH)/bin/golangci-lint lint: @echo checking lint diff --git a/make/photon/registry/Dockerfile.binary b/make/photon/registry/Dockerfile.binary index 66cbef59eb6..660748031bf 100644 --- a/make/photon/registry/Dockerfile.binary +++ b/make/photon/registry/Dockerfile.binary @@ -1,4 +1,4 @@ -FROM golang:1.19.4 +FROM golang:1.20.1 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 74da679e47e..0e0ea599220 100644 --- a/make/photon/trivy-adapter/Dockerfile.binary +++ b/make/photon/trivy-adapter/Dockerfile.binary @@ -1,4 +1,4 @@ -FROM golang:1.19.4 +FROM golang:1.20.1 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 d4ded148e15..fcb0807b4fa 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.19.4..." +echo "Building Trivy adapter binary based on golang:1.20.1..." 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 cdcf24e8071..ba96abb0c53 100644 --- a/src/go.mod +++ b/src/go.mod @@ -1,6 +1,6 @@ module github.com/goharbor/harbor/src -go 1.19 +go 1.20 require ( github.com/FZambia/sentinel v1.1.0 diff --git a/src/lib/retry/retry.go b/src/lib/retry/retry.go index c6fe233bc0b..e22a81599dd 100644 --- a/src/lib/retry/retry.go +++ b/src/lib/retry/retry.go @@ -25,7 +25,7 @@ import ( ) func init() { - rand.Seed(time.Now().UnixNano()) + rand.NewSource(time.Now().UnixNano()) } var ( diff --git a/src/pkg/permission/evaluator/rbac/casbin_match.go b/src/pkg/permission/evaluator/rbac/casbin_match.go index c2e20453b74..afd0ddf256e 100644 --- a/src/pkg/permission/evaluator/rbac/casbin_match.go +++ b/src/pkg/permission/evaluator/rbac/casbin_match.go @@ -60,7 +60,7 @@ func init() { func startRegexpStorePurging(s *regexpStore, intervalDuration time.Duration) { go func() { - rand.Seed(time.Now().Unix()) + rand.NewSource(time.Now().UnixNano()) jitter := time.Duration(rand.Int()%60) * time.Minute log.Debugf("Starting regexp store purge in %s", jitter) time.Sleep(jitter) diff --git a/tests/ci/distro_installer.sh b/tests/ci/distro_installer.sh index 57cf26fccf5..f31e7f81396 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.19.4 COMPILETAG=compile_golangimage NOTARYFLAG=true 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.19.4 COMPILETAG=compile_golangimage NOTARYFLAG=true 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.20.1 COMPILETAG=compile_golangimage NOTARYFLAG=true 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.1 COMPILETAG=compile_golangimage NOTARYFLAG=true TRIVYFLAG=true HTTPPROXY= PULL_BASE_FROM_DOCKERHUB=false diff --git a/tests/ci/ut_install.sh b/tests/ci/ut_install.sh index b1ae45dfc6c..b0954ecf53c 100755 --- a/tests/ci/ut_install.sh +++ b/tests/ci/ut_install.sh @@ -18,7 +18,7 @@ go get -u github.com/client9/misspell/cmd/misspell set -e # binary will be $(go env GOPATH)/bin/golangci-lint # go install/go get installation aren't guaranteed to work. We recommend using binary installation. -curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1 +curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.51.2 sudo service postgresql stop || echo no postgresql need to be stopped sleep 2 diff --git a/tests/ci/ut_run.sh b/tests/ci/ut_run.sh index 3c3ad337530..0b12a0a6de8 100755 --- a/tests/ci/ut_run.sh +++ b/tests/ci/ut_run.sh @@ -16,6 +16,5 @@ sleep 10 docker ps DIR="$(cd "$(dirname "$0")" && pwd)" -go test -race -i ./src/core ./src/jobservice sudo -E env "PATH=$PATH" "POSTGRES_MIGRATION_SCRIPTS_PATH=$DIR/../../make/migrations/postgresql/" ./tests/coverage4gotest.sh -#goveralls -coverprofile=profile.cov -service=github || true \ No newline at end of file +#goveralls -coverprofile=profile.cov -service=github || true