mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-22 15:41:26 +01:00
Bump up golang to 1.11.2
Signed-off-by: Daniel Jiang <jiangd@vmware.com>
This commit is contained in:
parent
b5788f0695
commit
5d59d6fab8
10
.travis.yml
10
.travis.yml
@ -1,23 +1,23 @@
|
||||
sudo: true
|
||||
language: go
|
||||
go:
|
||||
- 1.9.2
|
||||
- 1.11.2
|
||||
go_import_path: github.com/goharbor/harbor
|
||||
services:
|
||||
- docker
|
||||
dist: trusty
|
||||
matrix:
|
||||
include:
|
||||
- go: 1.9.2
|
||||
- go: 1.11.2
|
||||
env:
|
||||
- UTTEST=true
|
||||
- go: 1.9.2
|
||||
- go: 1.11.2
|
||||
env:
|
||||
- APITEST_DB=true
|
||||
- go: 1.9.2
|
||||
- go: 1.11.2
|
||||
env:
|
||||
- APITEST_LDAP=true
|
||||
- go: 1.9.2
|
||||
- go: 1.11.2
|
||||
env:
|
||||
- OFFLINE=true
|
||||
env:
|
||||
|
4
Makefile
4
Makefile
@ -9,7 +9,7 @@
|
||||
# compile_golangimage:
|
||||
# compile from golang image
|
||||
# for example: make compile_golangimage -e GOBUILDIMAGE= \
|
||||
# golang:1.7.3
|
||||
# golang:1.11.2
|
||||
# compile_adminserver, compile_core, compile_jobservice: compile specific binary
|
||||
#
|
||||
# build: build Harbor docker images from photon baseimage
|
||||
@ -124,7 +124,7 @@ GOINSTALL=$(GOCMD) install
|
||||
GOTEST=$(GOCMD) test
|
||||
GODEP=$(GOTEST) -i
|
||||
GOFMT=gofmt -w
|
||||
GOBUILDIMAGE=golang:1.9.2
|
||||
GOBUILDIMAGE=golang:1.11.2
|
||||
GOBUILDPATH=$(GOBASEPATH)/harbor
|
||||
GOIMAGEBUILDCMD=/usr/local/go/bin/go
|
||||
GOIMAGEBUILD=$(GOIMAGEBUILDCMD) build
|
||||
|
@ -44,25 +44,25 @@ You can compile the code by one of the three approaches:
|
||||
* Get official Golang image from docker hub:
|
||||
|
||||
```sh
|
||||
$ docker pull golang:1.9.2
|
||||
$ docker pull golang:1.11.2
|
||||
```
|
||||
|
||||
* Build, install and bring up Harbor without Notary:
|
||||
|
||||
```sh
|
||||
$ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage
|
||||
$ make install GOBUILDIMAGE=golang:1.11.2 COMPILETAG=compile_golangimage
|
||||
```
|
||||
|
||||
* Build, install and bring up Harbor with Notary:
|
||||
|
||||
```sh
|
||||
$ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage NOTARYFLAG=true
|
||||
$ make install GOBUILDIMAGE=golang:1.11.2 COMPILETAG=compile_golangimage NOTARYFLAG=true
|
||||
```
|
||||
|
||||
* Build, install and bring up Harbor with Clair:
|
||||
|
||||
```sh
|
||||
$ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage CLAIRFLAG=true
|
||||
$ make install GOBUILDIMAGE=golang:1.11.2 COMPILETAG=compile_golangimage CLAIRFLAG=true
|
||||
```
|
||||
|
||||
#### II. Compile code with your own Golang environment, then build Harbor
|
||||
|
@ -37,10 +37,10 @@ version | set harbor version
|
||||
#### EXAMPLE:
|
||||
|
||||
#### Build and run harbor from source code.
|
||||
make install GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage NOTARYFLAG=true
|
||||
make install GOBUILDIMAGE=golang:1.11.2 COMPILETAG=compile_golangimage NOTARYFLAG=true
|
||||
|
||||
### Package offline installer
|
||||
make package_offline GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage NOTARYFLAG=true
|
||||
make package_offline GOBUILDIMAGE=golang:1.11.2 COMPILETAG=compile_golangimage NOTARYFLAG=true
|
||||
|
||||
### Start harbor with notary
|
||||
make -e NOTARYFLAG=true start
|
||||
|
@ -4,7 +4,7 @@ set +e
|
||||
|
||||
usage(){
|
||||
echo "Usage: builder <golang image:version> <code path> <code release tag> <main.go path> <binary name>"
|
||||
echo "e.g: builder golang:1.9.2 github.com/helm/chartmuseum v0.7.1 cmd/chartmuseum chartm"
|
||||
echo "e.g: builder golang:1.11.2 github.com/helm/chartmuseum v0.7.1 cmd/chartmuseum chartm"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM golang:1.9.2
|
||||
FROM golang:1.11.2
|
||||
|
||||
ADD . /go/src/github.com/coreos/clair/
|
||||
WORKDIR /go/src/github.com/coreos/clair/
|
||||
|
@ -23,7 +23,7 @@ TEMP=`mktemp -d /$TMPDIR/clair.XXXXXX`
|
||||
git clone https://github.com/coreos/clair.git $TEMP
|
||||
cd $TEMP; git checkout $VERSION; cd -
|
||||
|
||||
echo 'build the clair binary bases on the golang:1.7.3...'
|
||||
echo 'build the clair binary bases on the golang:1.11.2...'
|
||||
cp Dockerfile.binary $TEMP
|
||||
docker build -f $TEMP/Dockerfile.binary -t clair-golang $TEMP
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM golang:1.9.4
|
||||
FROM golang:1.11.2
|
||||
|
||||
ENV NOTARYPKG github.com/theupdateframework/notary
|
||||
|
||||
|
@ -23,7 +23,7 @@ cur=$PWD
|
||||
TEMP=`mktemp -d /$TMPDIR/notary.XXXXXX`
|
||||
git clone -b $VERSION https://github.com/theupdateframework/notary.git $TEMP
|
||||
|
||||
echo 'build the notary binary bases on the golang:1.9.4...'
|
||||
echo 'build the notary binary bases on the golang:1.11.2...'
|
||||
cp binary.Dockerfile $TEMP
|
||||
cd $TEMP
|
||||
docker build -f binary.Dockerfile -t notary-golang $TEMP
|
||||
|
@ -7,4 +7,4 @@ WORKDIR $DISTRIBUTION_DIR
|
||||
COPY . $DISTRIBUTION_DIR
|
||||
COPY cmd/registry/config-dev.yml /etc/docker/registry/config.yml
|
||||
|
||||
RUN make PREFIX=/go clean binaries
|
||||
RUN make PREFIX=/go clean binaries
|
||||
|
@ -22,7 +22,7 @@ cur=$PWD
|
||||
TEMP=`mktemp -d /$TMPDIR/distribution.XXXXXX`
|
||||
git clone -b $VERSION https://github.com/docker/distribution.git $TEMP
|
||||
|
||||
echo 'build the registry binary bases on the golang:1.7.3...'
|
||||
echo 'build the registry binary bases on the golang:1.11.2...'
|
||||
cp Dockerfile.binary $TEMP
|
||||
docker build -f $TEMP/Dockerfile.binary -t registry-golang $TEMP
|
||||
|
||||
|
@ -115,7 +115,7 @@ type VulnerabilityItem struct {
|
||||
// ScanAllPolicy is represent the json request and object for scan all policy, the parm is het
|
||||
type ScanAllPolicy struct {
|
||||
Type string `json:"type"`
|
||||
Parm map[string]interface{} `json:"parameter, omitempty"`
|
||||
Parm map[string]interface{} `json:"parameter,omitempty"`
|
||||
}
|
||||
|
||||
const (
|
||||
|
@ -31,7 +31,7 @@ var addProject *apilib.ProjectReq
|
||||
var addPID int
|
||||
|
||||
func InitAddPro() {
|
||||
addProject = &apilib.ProjectReq{"add_project", map[string]string{models.ProMetaPublic: "true"}}
|
||||
addProject = &apilib.ProjectReq{ProjectName: "add_project", Metadata: map[string]string{models.ProMetaPublic: "true"}}
|
||||
}
|
||||
|
||||
func TestAddProject(t *testing.T) {
|
||||
@ -82,7 +82,7 @@ func TestAddProject(t *testing.T) {
|
||||
// case 4: response code = 400 : Project name is illegal in length
|
||||
fmt.Println("case 4 : response code = 400 : Project name is illegal in length ")
|
||||
|
||||
result, err = apiTest.ProjectsPost(*admin, apilib.ProjectReq{"t", map[string]string{models.ProMetaPublic: "true"}})
|
||||
result, err = apiTest.ProjectsPost(*admin, apilib.ProjectReq{ProjectName: "t", Metadata: map[string]string{models.ProMetaPublic: "true"}})
|
||||
if err != nil {
|
||||
t.Error("Error while creat project", err.Error())
|
||||
t.Log(err)
|
||||
|
@ -39,7 +39,7 @@ func TestTargetsPost(t *testing.T) {
|
||||
apiTest := newHarborAPI()
|
||||
|
||||
endPoint := os.Getenv("REGISTRY_URL")
|
||||
repTargets := &apilib.RepTargetPost{endPoint, addTargetName, adminName, adminPwd}
|
||||
repTargets := &apilib.RepTargetPost{Endpoint: endPoint, Name: addTargetName, Username: adminName, Password: adminPwd}
|
||||
|
||||
fmt.Println("Testing Targets Post API")
|
||||
|
||||
@ -195,7 +195,7 @@ func TestTargetsPut(t *testing.T) {
|
||||
apiTest := newHarborAPI()
|
||||
|
||||
endPoint := "1.1.1.1"
|
||||
updateRepTargets := &apilib.RepTargetPost{endPoint, addTargetName, adminName, adminPwd}
|
||||
updateRepTargets := &apilib.RepTargetPost{Endpoint: endPoint, Name: addTargetName, Username: adminName, Password: adminPwd}
|
||||
id := strconv.Itoa(addTargetID)
|
||||
|
||||
fmt.Println("Testing Target Put API")
|
||||
|
@ -528,47 +528,47 @@ func TestModifiable(t *testing.T) {
|
||||
t.Log("Test modifiable.")
|
||||
assert := assert.New(t)
|
||||
base := BaseController{
|
||||
api.BaseAPI{
|
||||
beego.Controller{},
|
||||
BaseAPI: api.BaseAPI{
|
||||
Controller: beego.Controller{},
|
||||
},
|
||||
nil,
|
||||
nil,
|
||||
SecurityCtx: nil,
|
||||
ProjectMgr: nil,
|
||||
}
|
||||
|
||||
ua1 := &UserAPI{
|
||||
base,
|
||||
3,
|
||||
4,
|
||||
false,
|
||||
false,
|
||||
"db_auth",
|
||||
BaseController: base,
|
||||
currentUserID: 3,
|
||||
userID: 4,
|
||||
SelfRegistration: false,
|
||||
IsAdmin: false,
|
||||
AuthMode: "db_auth",
|
||||
}
|
||||
assert.False(ua1.modifiable())
|
||||
ua2 := &UserAPI{
|
||||
base,
|
||||
3,
|
||||
4,
|
||||
false,
|
||||
true,
|
||||
"db_auth",
|
||||
BaseController: base,
|
||||
currentUserID: 3,
|
||||
userID: 4,
|
||||
SelfRegistration: false,
|
||||
IsAdmin: true,
|
||||
AuthMode: "db_auth",
|
||||
}
|
||||
assert.True(ua2.modifiable())
|
||||
ua3 := &UserAPI{
|
||||
base,
|
||||
3,
|
||||
4,
|
||||
false,
|
||||
true,
|
||||
"ldap_auth",
|
||||
BaseController: base,
|
||||
currentUserID: 3,
|
||||
userID: 4,
|
||||
SelfRegistration: false,
|
||||
IsAdmin: true,
|
||||
AuthMode: "ldap_auth",
|
||||
}
|
||||
assert.False(ua3.modifiable())
|
||||
ua4 := &UserAPI{
|
||||
base,
|
||||
1,
|
||||
1,
|
||||
false,
|
||||
true,
|
||||
"ldap_auth",
|
||||
BaseController: base,
|
||||
currentUserID: 1,
|
||||
userID: 1,
|
||||
SelfRegistration: false,
|
||||
IsAdmin: true,
|
||||
AuthMode: "ldap_auth",
|
||||
}
|
||||
assert.True(ua4.modifiable())
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ func RegistryURL() (string, error) {
|
||||
func InternalJobServiceURL() string {
|
||||
cfg, err := mg.Get()
|
||||
if err != nil {
|
||||
log.Warningf("Failed to Get job service URL from backend, error: %v, will return default value.")
|
||||
log.Warningf("Failed to Get job service URL from backend, error: %v, will return default value.", err)
|
||||
return common.DefaultJobserviceEndpoint
|
||||
}
|
||||
|
||||
@ -331,7 +331,7 @@ func InternalJobServiceURL() string {
|
||||
func InternalCoreURL() string {
|
||||
cfg, err := mg.Get()
|
||||
if err != nil {
|
||||
log.Warningf("Failed to Get job service Core URL from backend, error: %v, will return default value.")
|
||||
log.Warningf("Failed to Get job service Core URL from backend, error: %v, will return default value.", err)
|
||||
return common.DefaultCoreEndpoint
|
||||
}
|
||||
return strings.TrimSuffix(utils.SafeCastString(cfg[common.CoreURL]), "/")
|
||||
@ -348,7 +348,7 @@ func InternalTokenServiceEndpoint() string {
|
||||
func InternalNotaryEndpoint() string {
|
||||
cfg, err := mg.Get()
|
||||
if err != nil {
|
||||
log.Warningf("Failed to get Notary endpoint from backend, error: %v, will use default value.")
|
||||
log.Warningf("Failed to get Notary endpoint from backend, error: %v, will use default value.", err)
|
||||
return common.DefaultNotaryEndpoint
|
||||
}
|
||||
if cfg[common.NotaryURL] == nil {
|
||||
|
@ -240,7 +240,7 @@ func (s *sessionReqCtxModifier) Modify(ctx *beegoctx.Context) bool {
|
||||
log.Info("can not get user information from session")
|
||||
return false
|
||||
}
|
||||
log.Debug("Getting user %+v", user)
|
||||
log.Debugf("Getting user %+v", user)
|
||||
log.Debug("using local database project manager")
|
||||
pm := config.GlobalProjectMgr
|
||||
log.Debug("creating local database security context...")
|
||||
|
@ -128,7 +128,7 @@ func (n *NotificationHandler) Post() {
|
||||
if err != nil {
|
||||
log.Errorf("Failed to get last update from Clair DB, error: %v, the auto scan will be skipped.", err)
|
||||
} else if last == 0 {
|
||||
log.Infof("The Vulnerability data is not ready in Clair DB, the auto scan will be skipped.", err)
|
||||
log.Infof("The Vulnerability data is not ready in Clair DB, the auto scan will be skipped.")
|
||||
} else if err := coreutils.TriggerImageScan(repository, tag); err != nil {
|
||||
log.Warningf("Failed to scan image, repository: %s, tag: %s, error: %v", repository, tag, err)
|
||||
}
|
||||
|
@ -39,5 +39,5 @@ func TestCapNonExistPath(t *testing.T) {
|
||||
driver := NewDriver(path)
|
||||
c, err := driver.Cap()
|
||||
assert.Nil(t, err, "unexpected error")
|
||||
assert.Equal(t, storage.Capacity{0, 0}, *c)
|
||||
assert.Equal(t, storage.Capacity{Total: 0, Free: 0}, *c)
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ func triggerImageScan(repository, tag, digest string, client job.Client) error {
|
||||
}
|
||||
err = dao.SetScanJobUUID(id, uuid)
|
||||
if err != nil {
|
||||
log.Warningf("Failed to set UUID for scan job, ID: %d, repository: %s, tag: %s", id, uuid, repository, tag)
|
||||
log.Warningf("Failed to set UUID for scan job, ID: %d, repository: %s, tag: %s", id, repository, tag)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ type Manager struct {
|
||||
// capacity is the max number of trigger references manager can keep in memory
|
||||
func NewManager(capacity int) *Manager {
|
||||
return &Manager{
|
||||
// cache: NewCache(capacity),
|
||||
// cache: NewCache(capacity),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM golang:1.8
|
||||
FROM golang:1.11.2
|
||||
|
||||
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
|
||||
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
|
||||
|
@ -25,5 +25,5 @@ sudo curl -o /home/travis/gopath/src/github.com/goharbor/harbor/tests/apitests/p
|
||||
sudo apt-get update && sudo apt-get install -y --no-install-recommends python-dev openjdk-7-jdk 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 && sudo pip install robotframework==3.0.4 robotframework-httplibrary requests dbbot robotframework-pabot --upgrade
|
||||
sudo make swagger_client
|
||||
sudo make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 NOTARYFLAG=true CLAIRFLAG=true CHARTFLAG=true
|
||||
sleep 10
|
||||
sudo make install GOBUILDIMAGE=golang:1.11.2 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 NOTARYFLAG=true CLAIRFLAG=true CHARTFLAG=true
|
||||
sleep 10
|
||||
|
@ -2,5 +2,5 @@
|
||||
|
||||
set -e
|
||||
|
||||
sudo make package_online VERSIONTAG=dev-travis PKGVERSIONTAG=dev-travis UIVERSIONTAG=dev-travis GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage NOTARYFLAG=true CLAIRFLAG=true MIGRATORFLAG=false CHARTFLAG=true HTTPPROXY=
|
||||
sudo make package_offline VERSIONTAG=dev-travis PKGVERSIONTAG=dev-travis UIVERSIONTAG=dev-travis GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage NOTARYFLAG=true CLAIRFLAG=true MIGRATORFLAG=false CHARTFLAG=true HTTPPROXY=
|
||||
sudo make package_online VERSIONTAG=dev-travis PKGVERSIONTAG=dev-travis UIVERSIONTAG=dev-travis GOBUILDIMAGE=golang:1.11.2 COMPILETAG=compile_golangimage NOTARYFLAG=true CLAIRFLAG=true MIGRATORFLAG=false CHARTFLAG=true HTTPPROXY=
|
||||
sudo make package_offline VERSIONTAG=dev-travis PKGVERSIONTAG=dev-travis UIVERSIONTAG=dev-travis GOBUILDIMAGE=golang:1.11.2 COMPILETAG=compile_golangimage NOTARYFLAG=true CLAIRFLAG=true MIGRATORFLAG=false CHARTFLAG=true HTTPPROXY=
|
||||
|
Loading…
Reference in New Issue
Block a user