mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-16 20:01:35 +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
|
- ubuntu-latest
|
||||||
timeout-minutes: 100
|
timeout-minutes: 100
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go 1.19
|
- name: Set up Go 1.20
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
go-version: 1.19.4
|
go-version: 1.20.1
|
||||||
id: go
|
id: go
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
@ -94,10 +94,10 @@ jobs:
|
|||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
timeout-minutes: 100
|
timeout-minutes: 100
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go 1.19
|
- name: Set up Go 1.20
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
go-version: 1.19.4
|
go-version: 1.20.1
|
||||||
id: go
|
id: go
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
@ -149,10 +149,10 @@ jobs:
|
|||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
timeout-minutes: 100
|
timeout-minutes: 100
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go 1.19
|
- name: Set up Go 1.20
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
go-version: 1.19.4
|
go-version: 1.20.1
|
||||||
id: go
|
id: go
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
@ -204,10 +204,10 @@ jobs:
|
|||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
timeout-minutes: 100
|
timeout-minutes: 100
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go 1.19
|
- name: Set up Go 1.20
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
go-version: 1.19.4
|
go-version: 1.20.1
|
||||||
id: go
|
id: go
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
@ -257,10 +257,10 @@ jobs:
|
|||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
timeout-minutes: 100
|
timeout-minutes: 100
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go 1.19
|
- name: Set up Go 1.20
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
go-version: 1.19.4
|
go-version: 1.20.1
|
||||||
id: go
|
id: go
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
4
.github/workflows/build-package.yml
vendored
4
.github/workflows/build-package.yml
vendored
@ -23,10 +23,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: '285.0.0'
|
version: '285.0.0'
|
||||||
- run: gcloud info
|
- run: gcloud info
|
||||||
- name: Set up Go 1.19
|
- name: Set up Go 1.20
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
go-version: 1.19.4
|
go-version: 1.20.1
|
||||||
id: go
|
id: go
|
||||||
- name: Setup Docker
|
- name: Setup Docker
|
||||||
uses: docker-practice/actions-setup-docker@1.0.11
|
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 }}'
|
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
|
||||||
- uses: google-github-actions/setup-gcloud@v0
|
- uses: google-github-actions/setup-gcloud@v0
|
||||||
- run: gcloud info
|
- run: gcloud info
|
||||||
- name: Set up Go 1.19
|
- name: Set up Go 1.20
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
go-version: 1.19.4
|
go-version: 1.20.1
|
||||||
id: go
|
id: go
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
6
Makefile
6
Makefile
@ -145,14 +145,14 @@ GOINSTALL=$(GOCMD) install
|
|||||||
GOTEST=$(GOCMD) test
|
GOTEST=$(GOCMD) test
|
||||||
GODEP=$(GOTEST) -i
|
GODEP=$(GOTEST) -i
|
||||||
GOFMT=gofmt -w
|
GOFMT=gofmt -w
|
||||||
GOBUILDIMAGE=golang:1.19.4
|
GOBUILDIMAGE=golang:1.20.1
|
||||||
GOBUILDPATHINCONTAINER=/harbor
|
GOBUILDPATHINCONTAINER=/harbor
|
||||||
|
|
||||||
# go build
|
# go build
|
||||||
PKG_PATH=github.com/goharbor/harbor/src/pkg
|
PKG_PATH=github.com/goharbor/harbor/src/pkg
|
||||||
GITCOMMIT := $(shell git rev-parse --short=8 HEAD)
|
GITCOMMIT := $(shell git rev-parse --short=8 HEAD)
|
||||||
RELEASEVERSION := $(shell cat VERSION)
|
RELEASEVERSION := $(shell cat VERSION)
|
||||||
GOFLAGS=
|
GOFLAGS="-buildvcs=false"
|
||||||
GOTAGS=$(if $(GOBUILDTAGS),-tags "$(GOBUILDTAGS)",)
|
GOTAGS=$(if $(GOBUILDTAGS),-tags "$(GOBUILDTAGS)",)
|
||||||
GOLDFLAGS=$(if $(GOBUILDLDFLAGS),--ldflags "-w -s $(GOBUILDLDFLAGS)",)
|
GOLDFLAGS=$(if $(GOBUILDLDFLAGS),--ldflags "-w -s $(GOBUILDLDFLAGS)",)
|
||||||
CORE_LDFLAGS=-X $(PKG_PATH)/version.GitCommit=$(GITCOMMIT) -X $(PKG_PATH)/version.ReleaseVersion=$(RELEASEVERSION)
|
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
|
@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
|
# 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
|
GOLANGCI_LINT := $(shell go env GOPATH)/bin/golangci-lint
|
||||||
lint:
|
lint:
|
||||||
@echo checking 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 DISTRIBUTION_DIR /go/src/github.com/docker/distribution
|
||||||
ENV BUILDTAGS include_oss include_gcs
|
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/
|
ADD . /go/src/github.com/aquasecurity/harbor-scanner-trivy/
|
||||||
WORKDIR /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
|
git clone https://github.com/aquasecurity/harbor-scanner-trivy.git $TEMP
|
||||||
cd $TEMP; git checkout $VERSION; cd -
|
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
|
cp Dockerfile.binary $TEMP
|
||||||
docker build -f $TEMP/Dockerfile.binary -t trivy-adapter-golang $TEMP
|
docker build -f $TEMP/Dockerfile.binary -t trivy-adapter-golang $TEMP
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module github.com/goharbor/harbor/src
|
module github.com/goharbor/harbor/src
|
||||||
|
|
||||||
go 1.19
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/FZambia/sentinel v1.1.0
|
github.com/FZambia/sentinel v1.1.0
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.NewSource(time.Now().UnixNano())
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -60,7 +60,7 @@ func init() {
|
|||||||
|
|
||||||
func startRegexpStorePurging(s *regexpStore, intervalDuration time.Duration) {
|
func startRegexpStorePurging(s *regexpStore, intervalDuration time.Duration) {
|
||||||
go func() {
|
go func() {
|
||||||
rand.Seed(time.Now().Unix())
|
rand.NewSource(time.Now().UnixNano())
|
||||||
jitter := time.Duration(rand.Int()%60) * time.Minute
|
jitter := time.Duration(rand.Int()%60) * time.Minute
|
||||||
log.Debugf("Starting regexp store purge in %s", jitter)
|
log.Debugf("Starting regexp store purge in %s", jitter)
|
||||||
time.Sleep(jitter)
|
time.Sleep(jitter)
|
||||||
|
@ -3,5 +3,5 @@ set -x
|
|||||||
|
|
||||||
set -e
|
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_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.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.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
|
set -e
|
||||||
# binary will be $(go env GOPATH)/bin/golangci-lint
|
# binary will be $(go env GOPATH)/bin/golangci-lint
|
||||||
# go install/go get installation aren't guaranteed to work. We recommend using binary installation.
|
# 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
|
sudo service postgresql stop || echo no postgresql need to be stopped
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
|
@ -16,6 +16,5 @@ sleep 10
|
|||||||
docker ps
|
docker ps
|
||||||
|
|
||||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
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
|
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