mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 12:15:20 +01:00
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:
parent
31547ec593
commit
1788f8b75b
16
.github/workflows/CI.yml
vendored
16
.github/workflows/CI.yml
vendored
@ -29,10 +29,10 @@ jobs:
|
||||
- ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- name: Set up Go 1.17
|
||||
- name: Set up Go 1.20
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.17.9
|
||||
go-version: 1.20.7
|
||||
id: go
|
||||
- name: setup Docker
|
||||
uses: docker-practice/actions-setup-docker@master
|
||||
@ -95,10 +95,10 @@ jobs:
|
||||
- ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- name: Set up Go 1.17
|
||||
- name: Set up Go 1.20
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.17.9
|
||||
go-version: 1.20.7
|
||||
id: go
|
||||
- name: setup Docker
|
||||
uses: docker-practice/actions-setup-docker@master
|
||||
@ -155,10 +155,10 @@ jobs:
|
||||
- ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- name: Set up Go 1.17
|
||||
- name: Set up Go 1.20
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.17.9
|
||||
go-version: 1.20.7
|
||||
id: go
|
||||
- name: setup Docker
|
||||
uses: docker-practice/actions-setup-docker@master
|
||||
@ -213,10 +213,10 @@ jobs:
|
||||
- ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- name: Set up Go 1.17
|
||||
- name: Set up Go 1.20
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.17.9
|
||||
go-version: 1.20.7
|
||||
id: go
|
||||
- name: setup Docker
|
||||
uses: docker-practice/actions-setup-docker@master
|
||||
|
2
.github/workflows/build-package.yml
vendored
2
.github/workflows/build-package.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
||||
- name: Set up Go 1.17
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.17.9
|
||||
go-version: 1.20.7
|
||||
id: go
|
||||
- name: Setup Docker
|
||||
uses: docker-practice/actions-setup-docker@master
|
||||
|
@ -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.8 | 1.11.2 |
|
||||
| 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.
|
||||
|
||||
|
17
Makefile
17
Makefile
@ -9,7 +9,7 @@
|
||||
# compile_golangimage:
|
||||
# compile from golang image
|
||||
# for example: make compile_golangimage -e GOBUILDIMAGE= \
|
||||
# golang:1.17.9
|
||||
# golang:1.20.7
|
||||
# compile_core, compile_jobservice: compile specific binary
|
||||
#
|
||||
# build: build Harbor docker images from photon baseimage
|
||||
@ -137,14 +137,16 @@ GOINSTALL=$(GOCMD) install
|
||||
GOTEST=$(GOCMD) test
|
||||
GODEP=$(GOTEST) -i
|
||||
GOFMT=gofmt -w
|
||||
GOBUILDIMAGE=golang:1.17.9
|
||||
GOVERSION=1.20.7
|
||||
GOBUILDIMAGE=goharbor/golang:$(GOVERSION)
|
||||
PUSHGOIMAGE=false
|
||||
GOBUILDPATH=/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)
|
||||
@ -384,6 +386,15 @@ package_offline: update_prepare_version compile build
|
||||
@rm -rf $(HARBORPKG)
|
||||
@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:
|
||||
#go get github.com/securego/gosec/cmd/gosec
|
||||
#go get github.com/dghubble/sling
|
||||
|
@ -43,13 +43,13 @@ You can compile the code by one of the three approaches:
|
||||
- Get official Golang image from docker hub:
|
||||
|
||||
```sh
|
||||
$ docker pull golang:1.17.9
|
||||
$ docker pull goharbor/golang:1.20.7
|
||||
```
|
||||
|
||||
- Build, install and bring up Harbor without Notary:
|
||||
|
||||
```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:
|
||||
|
@ -36,10 +36,10 @@ version | set harbor version
|
||||
#### EXAMPLE:
|
||||
|
||||
#### 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
|
||||
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
|
||||
make -e NOTARYFLAG=true start
|
||||
|
@ -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 BUILDTAGS include_oss include_gcs
|
||||
|
@ -84,8 +84,9 @@ func NewChartCache(config *ChartCacheConfig) *ChartCache {
|
||||
|
||||
// IsEnabled to indicate if the chart cache is successfully enabled
|
||||
// The cache may be disabled if
|
||||
// user does not set
|
||||
// wrong configurations
|
||||
//
|
||||
// user does not set
|
||||
// wrong configurations
|
||||
func (chc *ChartCache) IsEnabled() bool {
|
||||
return chc.isEnabled
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -539,24 +539,24 @@ func TestCountPull(t *testing.T) {
|
||||
}
|
||||
|
||||
/*
|
||||
func TestProjectExists(t *testing.T) {
|
||||
var exists bool
|
||||
var err error
|
||||
exists, err = ProjectExists(currentProject.ProjectID)
|
||||
if err != nil {
|
||||
t.Errorf("Error occurred in ProjectExists: %v", err)
|
||||
func TestProjectExists(t *testing.T) {
|
||||
var exists bool
|
||||
var err error
|
||||
exists, err = ProjectExists(currentProject.ProjectID)
|
||||
if err != nil {
|
||||
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) {
|
||||
id := currentProject.ProjectID
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -44,18 +44,21 @@ func (gc *GCAPI) Prepare() {
|
||||
|
||||
// Post according to the request, it creates a cron schedule or a manual trigger for GC.
|
||||
// create a daily schedule for GC
|
||||
// {
|
||||
// "schedule": {
|
||||
// "type": "Daily",
|
||||
// "cron": "0 0 0 * * *"
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// "schedule": {
|
||||
// "type": "Daily",
|
||||
// "cron": "0 0 0 * * *"
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// create a manual trigger for GC
|
||||
// {
|
||||
// "schedule": {
|
||||
// "type": "Manual"
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// "schedule": {
|
||||
// "type": "Manual"
|
||||
// }
|
||||
// }
|
||||
func (gc *GCAPI) Post() {
|
||||
ajr := models.AdminJobReq{}
|
||||
isValid, err := gc.DecodeJSONReqAndValidate(&ajr)
|
||||
@ -73,12 +76,13 @@ func (gc *GCAPI) Post() {
|
||||
|
||||
// Put handles GC cron schedule update/delete.
|
||||
// Request: delete the schedule of GC
|
||||
// {
|
||||
// "schedule": {
|
||||
// "type": "None",
|
||||
// "cron": ""
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// "schedule": {
|
||||
// "type": "None",
|
||||
// "cron": ""
|
||||
// }
|
||||
// }
|
||||
func (gc *GCAPI) Put() {
|
||||
ajr := models.AdminJobReq{}
|
||||
isValid, err := gc.DecodeJSONReqAndValidate(&ajr)
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -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.
|
||||
// create a daily schedule for scan all
|
||||
// {
|
||||
// "schedule": {
|
||||
// "type": "Daily",
|
||||
// "cron": "0 0 0 * * *"
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// "schedule": {
|
||||
// "type": "Daily",
|
||||
// "cron": "0 0 0 * * *"
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// create a manual trigger for scan all
|
||||
// {
|
||||
// "schedule": {
|
||||
// "type": "Manual"
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// "schedule": {
|
||||
// "type": "Manual"
|
||||
// }
|
||||
// }
|
||||
func (sc *ScanAllAPI) Post() {
|
||||
ajr := models.AdminJobReq{}
|
||||
isValid, err := sc.DecodeJSONReqAndValidate(&ajr)
|
||||
@ -75,12 +78,13 @@ func (sc *ScanAllAPI) Post() {
|
||||
|
||||
// Put handles scan all cron schedule update/delete.
|
||||
// Request: delete the schedule of scan all
|
||||
// {
|
||||
// "schedule": {
|
||||
// "type": "None",
|
||||
// "cron": ""
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// "schedule": {
|
||||
// "type": "None",
|
||||
// "cron": ""
|
||||
// }
|
||||
// }
|
||||
func (sc *ScanAllAPI) Put() {
|
||||
ajr := models.AdminJobReq{}
|
||||
isValid, err := sc.DecodeJSONReqAndValidate(&ajr)
|
||||
|
@ -217,7 +217,6 @@ func (suite *ScannerAPITestSuite) TestScannerAPIUpdate() {
|
||||
assert.Equal(suite.T(), updated.UUID, rr.UUID)
|
||||
}
|
||||
|
||||
//
|
||||
func (suite *ScannerAPITestSuite) TestScannerAPIDelete() {
|
||||
r := &scanner.Registration{
|
||||
ID: 1003,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -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.
|
||||
// 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 {
|
||||
// contentTrustEnabled returns whether a project has enabled content trust.
|
||||
ContentTrustEnabled(name string) bool
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -22,7 +22,7 @@ var singletons sync.Map
|
||||
// GetLogger gets an unified logger entry for logging per the passed settings.
|
||||
// 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.
|
||||
// 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
|
||||
//
|
||||
// loggerOptions ...Option : logger options
|
||||
// loggerOptions ...Option : logger options
|
||||
//
|
||||
// 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.
|
||||
func GetLogDataGetter(loggerOptions ...Option) (getter.Interface, error) {
|
||||
if len(loggerOptions) == 0 {
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -4,7 +4,7 @@
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -24,7 +24,8 @@ import (
|
||||
|
||||
// Controller provides the related operations for triggering scan.
|
||||
// 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 {
|
||||
// Scan the given artifact
|
||||
//
|
||||
|
@ -37,12 +37,12 @@ type Scanner struct {
|
||||
// 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
|
||||
// following capability:
|
||||
// - consumes MIME types:
|
||||
// -- application/vnd.oci.image.manifest.v1+json
|
||||
// -- application/vnd.docker.distribution.manifest.v2+json
|
||||
// - produces MIME types
|
||||
// -- application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0
|
||||
// -- application/vnd.scanner.adapter.vuln.report.raw
|
||||
// - consumes MIME types:
|
||||
// -- application/vnd.oci.image.manifest.v1+json
|
||||
// -- application/vnd.docker.distribution.manifest.v2+json
|
||||
// - produces MIME types
|
||||
// -- application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0
|
||||
// -- application/vnd.scanner.adapter.vuln.report.raw
|
||||
type ScannerCapability struct {
|
||||
// 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
|
||||
|
@ -319,9 +319,11 @@ func UpdateTask(task *models.Task, props ...string) (int64, error) {
|
||||
// UpdateTaskStatus updates the status of task.
|
||||
// The implementation uses raw sql rather than QuerySetter.Filter... as QuerySetter
|
||||
// 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
|
||||
// AND T0."status" IN ($4, $5, $6))]`
|
||||
//
|
||||
// `UPDATE "replication_task" SET "end_time" = $1, "status" = $2
|
||||
// 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
|
||||
func UpdateTaskStatus(id int64, status string, statusRevision int64, statusCondition ...string) (int64, error) {
|
||||
params := []interface{}{}
|
||||
|
@ -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 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 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
|
||||
|
@ -2,5 +2,5 @@
|
||||
|
||||
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_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_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=goharbor/golang:1.20.7 COMPILETAG=compile_golangimage NOTARYFLAG=true CLAIRFLAG=true MIGRATORFLAG=false CHARTFLAG=true BUILDBIN=true HTTPPROXY=
|
||||
|
@ -3,15 +3,18 @@
|
||||
set -ex
|
||||
|
||||
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/libtrust
|
||||
go get -d github.com/lib/pq
|
||||
go get golang.org/x/lint/golint
|
||||
go get github.com/GeertJohan/fgt
|
||||
go get github.com/dghubble/sling
|
||||
set +e
|
||||
go get golang.org/x/tools/cmd/cover
|
||||
go get github.com/mattn/goveralls
|
||||
go get -u github.com/client9/misspell/cmd/misspell
|
||||
set -e
|
||||
sudo service postgresql stop || echo no postgresql need to be stopped
|
||||
sleep 2
|
||||
|
||||
|
@ -14,6 +14,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=travis-ci || true
|
Loading…
Reference in New Issue
Block a user