bump go1.20.7 on release-1.10.0 base on ph4 (#19206)

Signed-off-by: yminer <yminer@vmware.com>

add GOFLAGS=-buildvcs=false

upadate GO111MODULE=auto

Signed-off-by: yminer <yminer@vmware.com>

update ut_install set +e

fix gofmt

Signed-off-by: yminer <yminer@vmware.com>

update ut_run.sh
This commit is contained in:
MinerYang 2023-08-17 17:17:07 +08:00 committed by GitHub
parent 31547ec593
commit 1788f8b75b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 149 additions and 122 deletions

View File

@ -29,10 +29,10 @@ jobs:
- ubuntu-latest - ubuntu-latest
timeout-minutes: 60 timeout-minutes: 60
steps: steps:
- name: Set up Go 1.17 - name: Set up Go 1.20
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.17.9 go-version: 1.20.7
id: go id: go
- name: setup Docker - name: setup Docker
uses: docker-practice/actions-setup-docker@master uses: docker-practice/actions-setup-docker@master
@ -95,10 +95,10 @@ jobs:
- ubuntu-latest - ubuntu-latest
timeout-minutes: 60 timeout-minutes: 60
steps: steps:
- name: Set up Go 1.17 - name: Set up Go 1.20
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.17.9 go-version: 1.20.7
id: go id: go
- name: setup Docker - name: setup Docker
uses: docker-practice/actions-setup-docker@master uses: docker-practice/actions-setup-docker@master
@ -155,10 +155,10 @@ jobs:
- ubuntu-latest - ubuntu-latest
timeout-minutes: 60 timeout-minutes: 60
steps: steps:
- name: Set up Go 1.17 - name: Set up Go 1.20
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.17.9 go-version: 1.20.7
id: go id: go
- name: setup Docker - name: setup Docker
uses: docker-practice/actions-setup-docker@master uses: docker-practice/actions-setup-docker@master
@ -213,10 +213,10 @@ jobs:
- ubuntu-latest - ubuntu-latest
timeout-minutes: 60 timeout-minutes: 60
steps: steps:
- name: Set up Go 1.17 - name: Set up Go 1.20
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.17.9 go-version: 1.20.7
id: go id: go
- name: setup Docker - name: setup Docker
uses: docker-practice/actions-setup-docker@master uses: docker-practice/actions-setup-docker@master

View File

@ -28,7 +28,7 @@ jobs:
- name: Set up Go 1.17 - name: Set up Go 1.17
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.17.9 go-version: 1.20.7
id: go id: go
- name: Setup Docker - name: Setup Docker
uses: docker-practice/actions-setup-docker@master uses: docker-practice/actions-setup-docker@master

View File

@ -128,7 +128,7 @@ Harbor backend is written in [Go](http://golang.org/). If you don't have a Harbo
| 1.7 | 1.9.2 | | 1.7 | 1.9.2 |
| 1.8 | 1.11.2 | | 1.8 | 1.11.2 |
| 1.9 | 1.12.12 | | 1.9 | 1.12.12 |
| 1.10 | 1.17.9 | | 1.10 | 1.20.7 |
Ensure your GOPATH and PATH have been configured in accordance with the Go environment instructions. Ensure your GOPATH and PATH have been configured in accordance with the Go environment instructions.

View File

@ -9,7 +9,7 @@
# compile_golangimage: # compile_golangimage:
# compile from golang image # compile from golang image
# for example: make compile_golangimage -e GOBUILDIMAGE= \ # for example: make compile_golangimage -e GOBUILDIMAGE= \
# golang:1.17.9 # golang:1.20.7
# compile_core, compile_jobservice: compile specific binary # compile_core, compile_jobservice: compile specific binary
# #
# build: build Harbor docker images from photon baseimage # build: build Harbor docker images from photon baseimage
@ -137,14 +137,16 @@ GOINSTALL=$(GOCMD) install
GOTEST=$(GOCMD) test GOTEST=$(GOCMD) test
GODEP=$(GOTEST) -i GODEP=$(GOTEST) -i
GOFMT=gofmt -w GOFMT=gofmt -w
GOBUILDIMAGE=golang:1.17.9 GOVERSION=1.20.7
GOBUILDIMAGE=goharbor/golang:$(GOVERSION)
PUSHGOIMAGE=false
GOBUILDPATH=/harbor GOBUILDPATH=/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)
@ -384,6 +386,15 @@ package_offline: update_prepare_version compile build
@rm -rf $(HARBORPKG) @rm -rf $(HARBORPKG)
@echo "Done." @echo "Done."
build_golang:
@echo "build goharbor/golang image"
$(DOCKERBUILD) --build-arg GOVERSION=$(GOVERSION) -f $(MAKEPATH)/photon/golang/Dockerfile -t $(GOBUILDIMAGE) .
@if [ "$(PUSHGOIMAGE)" = "true" ] ; then \
echo "push goharbor/golang image"; \
docker login -u $(REGISTRYUSER) -p $(REGISTRYPASSWORD) ; \
docker push $(GOBUILDIMAGE); \
fi; \
gosec: gosec:
#go get github.com/securego/gosec/cmd/gosec #go get github.com/securego/gosec/cmd/gosec
#go get github.com/dghubble/sling #go get github.com/dghubble/sling

View File

@ -43,13 +43,13 @@ You can compile the code by one of the three approaches:
- Get official Golang image from docker hub: - Get official Golang image from docker hub:
```sh ```sh
$ docker pull golang:1.17.9 $ docker pull goharbor/golang:1.20.7
``` ```
- Build, install and bring up Harbor without Notary: - Build, install and bring up Harbor without Notary:
```sh ```sh
$ make install GOBUILDIMAGE=golang:1.17.9 COMPILETAG=compile_golangimage $ make install GOBUILDIMAGE=goharbor/golang:1.20.7 COMPILETAG=compile_golangimage
``` ```
- Build, install and bring up Harbor with Notary: - Build, install and bring up Harbor with Notary:

View File

@ -36,10 +36,10 @@ version | set harbor version
#### EXAMPLE: #### EXAMPLE:
#### Build and run harbor from source code. #### Build and run harbor from source code.
make install GOBUILDIMAGE=golang:1.17.9 COMPILETAG=compile_golangimage NOTARYFLAG=true make install GOBUILDIMAGE=goharbor/golang:1.20.7 COMPILETAG=compile_golangimage NOTARYFLAG=true
### Package offline installer ### Package offline installer
make package_offline GOBUILDIMAGE=golang:1.17.9 COMPILETAG=compile_golangimage NOTARYFLAG=true make package_offline GOBUILDIMAGE=golang:1.20.7 COMPILETAG=compile_golangimage NOTARYFLAG=true
### Start harbor with notary ### Start harbor with notary
make -e NOTARYFLAG=true start make -e NOTARYFLAG=true start

View File

@ -1,4 +1,4 @@
FROM golang:1.17.9 FROM goharbor/golang:1.20.7
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

View File

@ -84,8 +84,9 @@ func NewChartCache(config *ChartCacheConfig) *ChartCache {
// IsEnabled to indicate if the chart cache is successfully enabled // IsEnabled to indicate if the chart cache is successfully enabled
// The cache may be disabled if // The cache may be disabled if
// user does not set //
// wrong configurations // user does not set
// wrong configurations
func (chc *ChartCache) IsEnabled() bool { func (chc *ChartCache) IsEnabled() bool {
return chc.isEnabled return chc.isEnabled
} }

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -539,24 +539,24 @@ func TestCountPull(t *testing.T) {
} }
/* /*
func TestProjectExists(t *testing.T) { func TestProjectExists(t *testing.T) {
var exists bool var exists bool
var err error var err error
exists, err = ProjectExists(currentProject.ProjectID) exists, err = ProjectExists(currentProject.ProjectID)
if err != nil { if err != nil {
t.Errorf("Error occurred in ProjectExists: %v", err) t.Errorf("Error occurred in ProjectExists: %v", err)
}
if !exists {
t.Errorf("The project with id: %d, does not exist", currentProject.ProjectID)
}
exists, err = ProjectExists(currentProject.Name)
if err != nil {
t.Errorf("Error occurred in ProjectExists: %v", err)
}
if !exists {
t.Errorf("The project with name: %s, does not exist", currentProject.Name)
}
} }
if !exists {
t.Errorf("The project with id: %d, does not exist", currentProject.ProjectID)
}
exists, err = ProjectExists(currentProject.Name)
if err != nil {
t.Errorf("Error occurred in ProjectExists: %v", err)
}
if !exists {
t.Errorf("The project with name: %s, does not exist", currentProject.Name)
}
}
*/ */
func TestGetProjectById(t *testing.T) { func TestGetProjectById(t *testing.T) {
id := currentProject.ProjectID id := currentProject.ProjectID

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -44,18 +44,21 @@ func (gc *GCAPI) Prepare() {
// Post according to the request, it creates a cron schedule or a manual trigger for GC. // Post according to the request, it creates a cron schedule or a manual trigger for GC.
// create a daily schedule for GC // create a daily schedule for GC
// { //
// "schedule": { // {
// "type": "Daily", // "schedule": {
// "cron": "0 0 0 * * *" // "type": "Daily",
// } // "cron": "0 0 0 * * *"
// } // }
// }
//
// create a manual trigger for GC // create a manual trigger for GC
// { //
// "schedule": { // {
// "type": "Manual" // "schedule": {
// } // "type": "Manual"
// } // }
// }
func (gc *GCAPI) Post() { func (gc *GCAPI) Post() {
ajr := models.AdminJobReq{} ajr := models.AdminJobReq{}
isValid, err := gc.DecodeJSONReqAndValidate(&ajr) isValid, err := gc.DecodeJSONReqAndValidate(&ajr)
@ -73,12 +76,13 @@ func (gc *GCAPI) Post() {
// Put handles GC cron schedule update/delete. // Put handles GC cron schedule update/delete.
// Request: delete the schedule of GC // Request: delete the schedule of GC
// { //
// "schedule": { // {
// "type": "None", // "schedule": {
// "cron": "" // "type": "None",
// } // "cron": ""
// } // }
// }
func (gc *GCAPI) Put() { func (gc *GCAPI) Put() {
ajr := models.AdminJobReq{} ajr := models.AdminJobReq{}
isValid, err := gc.DecodeJSONReqAndValidate(&ajr) isValid, err := gc.DecodeJSONReqAndValidate(&ajr)

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -49,18 +49,21 @@ func (sc *ScanAllAPI) Prepare() {
// Post according to the request, it creates a cron schedule or a manual trigger for scan all. // Post according to the request, it creates a cron schedule or a manual trigger for scan all.
// create a daily schedule for scan all // create a daily schedule for scan all
// { //
// "schedule": { // {
// "type": "Daily", // "schedule": {
// "cron": "0 0 0 * * *" // "type": "Daily",
// } // "cron": "0 0 0 * * *"
// } // }
// }
//
// create a manual trigger for scan all // create a manual trigger for scan all
// { //
// "schedule": { // {
// "type": "Manual" // "schedule": {
// } // "type": "Manual"
// } // }
// }
func (sc *ScanAllAPI) Post() { func (sc *ScanAllAPI) Post() {
ajr := models.AdminJobReq{} ajr := models.AdminJobReq{}
isValid, err := sc.DecodeJSONReqAndValidate(&ajr) isValid, err := sc.DecodeJSONReqAndValidate(&ajr)
@ -75,12 +78,13 @@ func (sc *ScanAllAPI) Post() {
// Put handles scan all cron schedule update/delete. // Put handles scan all cron schedule update/delete.
// Request: delete the schedule of scan all // Request: delete the schedule of scan all
// { //
// "schedule": { // {
// "type": "None", // "schedule": {
// "cron": "" // "type": "None",
// } // "cron": ""
// } // }
// }
func (sc *ScanAllAPI) Put() { func (sc *ScanAllAPI) Put() {
ajr := models.AdminJobReq{} ajr := models.AdminJobReq{}
isValid, err := sc.DecodeJSONReqAndValidate(&ajr) isValid, err := sc.DecodeJSONReqAndValidate(&ajr)

View File

@ -217,7 +217,6 @@ func (suite *ScannerAPITestSuite) TestScannerAPIUpdate() {
assert.Equal(suite.T(), updated.UUID, rr.UUID) assert.Equal(suite.T(), updated.UUID, rr.UUID)
} }
//
func (suite *ScannerAPITestSuite) TestScannerAPIDelete() { func (suite *ScannerAPITestSuite) TestScannerAPIDelete() {
r := &scanner.Registration{ r := &scanner.Registration{
ID: 1003, ID: 1003,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -333,7 +333,8 @@ func CopyResp(rec *httptest.ResponseRecorder, rw http.ResponseWriter) {
// PolicyChecker checks the policy of a project by project name, to determine if it's needed to check the image's status under this project. // PolicyChecker checks the policy of a project by project name, to determine if it's needed to check the image's status under this project.
// TODO: The policy check related things should be moved to pkg package later // TODO: The policy check related things should be moved to pkg package later
// and refactored to include the `check` capabilities, not just property getters. //
// and refactored to include the `check` capabilities, not just property getters.
type PolicyChecker interface { type PolicyChecker interface {
// contentTrustEnabled returns whether a project has enabled content trust. // contentTrustEnabled returns whether a project has enabled content trust.
ContentTrustEnabled(name string) bool ContentTrustEnabled(name string) bool

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -22,7 +22,7 @@ var singletons sync.Map
// GetLogger gets an unified logger entry for logging per the passed settings. // GetLogger gets an unified logger entry for logging per the passed settings.
// The logger may built based on the multiple registered logger backends. // The logger may built based on the multiple registered logger backends.
// //
// loggerOptions ...Option : logger options // loggerOptions ...Option : logger options
// //
// If failed, a nil logger and a non-nil error will be returned. // If failed, a nil logger and a non-nil error will be returned.
// Otherwise, a non nil logger is returned with nil error. // Otherwise, a non nil logger is returned with nil error.
@ -125,11 +125,13 @@ func GetSweeper(context context.Context, sweeperOptions ...Option) (sweeper.Inte
// GetLogDataGetter return the 1st matched log data getter interface // GetLogDataGetter return the 1st matched log data getter interface
// //
// loggerOptions ...Option : logger options // loggerOptions ...Option : logger options
// //
// If failed, // If failed,
// configured but initialize failed: a nil log data getter and a non-nil error will be returned. //
// no getter configured: a nil log data getter with a nil error are returned // configured but initialize failed: a nil log data getter and a non-nil error will be returned.
// no getter configured: a nil log data getter with a nil error are returned
//
// Otherwise, a non nil log data getter is returned with nil error. // Otherwise, a non nil log data getter is returned with nil error.
func GetLogDataGetter(loggerOptions ...Option) (getter.Interface, error) { func GetLogDataGetter(loggerOptions ...Option) (getter.Interface, error) {
if len(loggerOptions) == 0 { if len(loggerOptions) == 0 {

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -24,7 +24,8 @@ import (
// Controller provides the related operations for triggering scan. // Controller provides the related operations for triggering scan.
// TODO: Here the artifact object is reused the v1 one which is sent to the adapter, // TODO: Here the artifact object is reused the v1 one which is sent to the adapter,
// it should be pointed to the general artifact object in future once it's ready. //
// it should be pointed to the general artifact object in future once it's ready.
type Controller interface { type Controller interface {
// Scan the given artifact // Scan the given artifact
// //

View File

@ -37,12 +37,12 @@ type Scanner struct {
// report MIME types. For example, a scanner capable of analyzing Docker images and producing // report MIME types. For example, a scanner capable of analyzing Docker images and producing
// a vulnerabilities report recognizable by Harbor web console might be represented with the // a vulnerabilities report recognizable by Harbor web console might be represented with the
// following capability: // following capability:
// - consumes MIME types: // - consumes MIME types:
// -- application/vnd.oci.image.manifest.v1+json // -- application/vnd.oci.image.manifest.v1+json
// -- application/vnd.docker.distribution.manifest.v2+json // -- application/vnd.docker.distribution.manifest.v2+json
// - produces MIME types // - produces MIME types
// -- application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0 // -- application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0
// -- application/vnd.scanner.adapter.vuln.report.raw // -- application/vnd.scanner.adapter.vuln.report.raw
type ScannerCapability struct { type ScannerCapability struct {
// The set of MIME types of the artifacts supported by the scanner to produce the reports // The set of MIME types of the artifacts supported by the scanner to produce the reports
// specified in the "produces_mime_types". A given mime type should only be present in one // specified in the "produces_mime_types". A given mime type should only be present in one

View File

@ -319,9 +319,11 @@ func UpdateTask(task *models.Task, props ...string) (int64, error) {
// UpdateTaskStatus updates the status of task. // UpdateTaskStatus updates the status of task.
// The implementation uses raw sql rather than QuerySetter.Filter... as QuerySetter // The implementation uses raw sql rather than QuerySetter.Filter... as QuerySetter
// will generate sql like: // will generate sql like:
// `UPDATE "replication_task" SET "end_time" = $1, "status" = $2 //
// WHERE "id" IN ( SELECT T0."id" FROM "replication_task" T0 WHERE T0."id" = $3 // `UPDATE "replication_task" SET "end_time" = $1, "status" = $2
// AND T0."status" IN ($4, $5, $6))]` // WHERE "id" IN ( SELECT T0."id" FROM "replication_task" T0 WHERE T0."id" = $3
// AND T0."status" IN ($4, $5, $6))]`
//
// which is not a "single" sql statement, this will cause issues when running in concurrency // which is not a "single" sql statement, this will cause issues when running in concurrency
func UpdateTaskStatus(id int64, status string, statusRevision int64, statusCondition ...string) (int64, error) { func UpdateTaskStatus(id int64, status string, statusRevision int64, statusCondition ...string) (int64, error) {
params := []interface{}{} params := []interface{}{}

View File

@ -57,5 +57,5 @@ pip -V
#sudo apt-get update && sudo apt-get install -y --no-install-recommends libssl-dev && sudo apt-get autoremove -y && sudo rm -rf /var/lib/apt/lists/* #sudo apt-get update && sudo apt-get install -y --no-install-recommends libssl-dev && sudo apt-get autoremove -y && sudo rm -rf /var/lib/apt/lists/*
sudo wget https://bootstrap.pypa.io/get-pip.py && sudo python ./get-pip.py && sudo pip install --ignore-installed urllib3 chardet requests --upgrade sudo wget https://bootstrap.pypa.io/get-pip.py && sudo python ./get-pip.py && sudo pip install --ignore-installed urllib3 chardet requests --upgrade
sudo make build_base_images -e BASEIMAGETAG=dev sudo make build_base_images -e BASEIMAGETAG=dev
sudo make install GOBUILDIMAGE=golang:1.17.9 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 NOTARYFLAG=true CLAIRFLAG=true CHARTFLAG=true BUILDBIN=true PULL_BASE_FROM_DOCKERHUB=false sudo make install GOBUILDIMAGE=goharbor/golang:1.20.7 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 NOTARYFLAG=true CLAIRFLAG=true CHARTFLAG=true BUILDBIN=true PULL_BASE_FROM_DOCKERHUB=false
sleep 10 sleep 10

View File

@ -2,5 +2,5 @@
set -e set -e
sudo make package_online VERSIONTAG=dev-travis PKGVERSIONTAG=dev-travis UIVERSIONTAG=dev-travis GOBUILDIMAGE=golang:1.17.9 COMPILETAG=compile_golangimage NOTARYFLAG=true CLAIRFLAG=true MIGRATORFLAG=false CHARTFLAG=true BUILDBIN=true HTTPPROXY= sudo make package_online VERSIONTAG=dev-travis PKGVERSIONTAG=dev-travis UIVERSIONTAG=dev-travis GOBUILDIMAGE=goharbor/golang:1.20.7 COMPILETAG=compile_golangimage NOTARYFLAG=true CLAIRFLAG=true MIGRATORFLAG=false CHARTFLAG=true BUILDBIN=true HTTPPROXY=
sudo make package_offline VERSIONTAG=dev-travis PKGVERSIONTAG=dev-travis UIVERSIONTAG=dev-travis GOBUILDIMAGE=golang:1.17.9 COMPILETAG=compile_golangimage NOTARYFLAG=true CLAIRFLAG=true MIGRATORFLAG=false CHARTFLAG=true BUILDBIN=true HTTPPROXY= sudo make package_offline VERSIONTAG=dev-travis PKGVERSIONTAG=dev-travis UIVERSIONTAG=dev-travis GOBUILDIMAGE=goharbor/golang:1.20.7 COMPILETAG=compile_golangimage NOTARYFLAG=true CLAIRFLAG=true MIGRATORFLAG=false CHARTFLAG=true BUILDBIN=true HTTPPROXY=

View File

@ -3,15 +3,18 @@
set -ex set -ex
sudo apt-get update && sudo apt-get install -y libldap2-dev sudo apt-get update && sudo apt-get install -y libldap2-dev
sudo go env -w GO111MODULE=auto
go get -d github.com/docker/distribution go get -d github.com/docker/distribution
go get -d github.com/docker/libtrust go get -d github.com/docker/libtrust
go get -d github.com/lib/pq go get -d github.com/lib/pq
go get golang.org/x/lint/golint go get golang.org/x/lint/golint
go get github.com/GeertJohan/fgt go get github.com/GeertJohan/fgt
go get github.com/dghubble/sling go get github.com/dghubble/sling
set +e
go get golang.org/x/tools/cmd/cover go get golang.org/x/tools/cmd/cover
go get github.com/mattn/goveralls go get github.com/mattn/goveralls
go get -u github.com/client9/misspell/cmd/misspell go get -u github.com/client9/misspell/cmd/misspell
set -e
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

View File

@ -14,6 +14,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=travis-ci || true #goveralls -coverprofile=profile.cov -service=travis-ci || true