mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-21 17:55:30 +01:00
feat: upgrade golang to 1.20.1 (#18370)
Signed-off-by: Shengwen Yu <yshengwen@vmware.com> Co-authored-by: Shengwen Yu <yshengwen@vmware.com> Co-authored-by: Wang Yan <wangyan@vmware.com>
This commit is contained in:
parent
6774717185
commit
bea8dece07
20
.github/workflows/CI.yml
vendored
20
.github/workflows/CI.yml
vendored
@ -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:
|
||||
|
4
.github/workflows/build-package.yml
vendored
4
.github/workflows/build-package.yml
vendored
@ -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
|
||||
|
4
.github/workflows/conformance_test.yml
vendored
4
.github/workflows/conformance_test.yml
vendored
@ -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:
|
||||
|
6
Makefile
6
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
|
||||
|
@ -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
|
||||
|
@ -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/
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
module github.com/goharbor/harbor/src
|
||||
|
||||
go 1.19
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/FZambia/sentinel v1.1.0
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
rand.NewSource(time.Now().UnixNano())
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
#goveralls -coverprofile=profile.cov -service=github || true
|
||||
|
Loading…
Reference in New Issue
Block a user