Bump up golang to 1.11.2

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
This commit is contained in:
Daniel Jiang 2018-11-26 13:27:57 +08:00
parent b5788f0695
commit 5d59d6fab8
24 changed files with 66 additions and 66 deletions

View File

@ -1,23 +1,23 @@
sudo: true sudo: true
language: go language: go
go: go:
- 1.9.2 - 1.11.2
go_import_path: github.com/goharbor/harbor go_import_path: github.com/goharbor/harbor
services: services:
- docker - docker
dist: trusty dist: trusty
matrix: matrix:
include: include:
- go: 1.9.2 - go: 1.11.2
env: env:
- UTTEST=true - UTTEST=true
- go: 1.9.2 - go: 1.11.2
env: env:
- APITEST_DB=true - APITEST_DB=true
- go: 1.9.2 - go: 1.11.2
env: env:
- APITEST_LDAP=true - APITEST_LDAP=true
- go: 1.9.2 - go: 1.11.2
env: env:
- OFFLINE=true - OFFLINE=true
env: env:

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.7.3 # golang:1.11.2
# compile_adminserver, compile_core, compile_jobservice: compile specific binary # compile_adminserver, compile_core, compile_jobservice: compile specific binary
# #
# build: build Harbor docker images from photon baseimage # build: build Harbor docker images from photon baseimage
@ -124,7 +124,7 @@ GOINSTALL=$(GOCMD) install
GOTEST=$(GOCMD) test GOTEST=$(GOCMD) test
GODEP=$(GOTEST) -i GODEP=$(GOTEST) -i
GOFMT=gofmt -w GOFMT=gofmt -w
GOBUILDIMAGE=golang:1.9.2 GOBUILDIMAGE=golang:1.11.2
GOBUILDPATH=$(GOBASEPATH)/harbor GOBUILDPATH=$(GOBASEPATH)/harbor
GOIMAGEBUILDCMD=/usr/local/go/bin/go GOIMAGEBUILDCMD=/usr/local/go/bin/go
GOIMAGEBUILD=$(GOIMAGEBUILDCMD) build GOIMAGEBUILD=$(GOIMAGEBUILDCMD) build

View File

@ -44,25 +44,25 @@ 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.9.2 $ docker pull golang:1.11.2
``` ```
* Build, install and bring up Harbor without Notary: * Build, install and bring up Harbor without Notary:
```sh ```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: * Build, install and bring up Harbor with Notary:
```sh ```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: * Build, install and bring up Harbor with Clair:
```sh ```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 #### II. Compile code with your own Golang environment, then build Harbor

View File

@ -37,10 +37,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.7.3 COMPILETAG=compile_golangimage NOTARYFLAG=true make install GOBUILDIMAGE=golang:1.11.2 COMPILETAG=compile_golangimage NOTARYFLAG=true
### Package offline installer ### 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 ### Start harbor with notary
make -e NOTARYFLAG=true start make -e NOTARYFLAG=true start

View File

@ -4,7 +4,7 @@ set +e
usage(){ usage(){
echo "Usage: builder <golang image:version> <code path> <code release tag> <main.go path> <binary name>" 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 exit 1
} }

View File

@ -1,4 +1,4 @@
FROM golang:1.9.2 FROM golang:1.11.2
ADD . /go/src/github.com/coreos/clair/ ADD . /go/src/github.com/coreos/clair/
WORKDIR /go/src/github.com/coreos/clair/ WORKDIR /go/src/github.com/coreos/clair/

View File

@ -23,7 +23,7 @@ TEMP=`mktemp -d /$TMPDIR/clair.XXXXXX`
git clone https://github.com/coreos/clair.git $TEMP git clone https://github.com/coreos/clair.git $TEMP
cd $TEMP; git checkout $VERSION; cd - 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 cp Dockerfile.binary $TEMP
docker build -f $TEMP/Dockerfile.binary -t clair-golang $TEMP docker build -f $TEMP/Dockerfile.binary -t clair-golang $TEMP

View File

@ -1,4 +1,4 @@
FROM golang:1.9.4 FROM golang:1.11.2
ENV NOTARYPKG github.com/theupdateframework/notary ENV NOTARYPKG github.com/theupdateframework/notary

View File

@ -23,7 +23,7 @@ cur=$PWD
TEMP=`mktemp -d /$TMPDIR/notary.XXXXXX` TEMP=`mktemp -d /$TMPDIR/notary.XXXXXX`
git clone -b $VERSION https://github.com/theupdateframework/notary.git $TEMP 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 cp binary.Dockerfile $TEMP
cd $TEMP cd $TEMP
docker build -f binary.Dockerfile -t notary-golang $TEMP docker build -f binary.Dockerfile -t notary-golang $TEMP

View File

@ -7,4 +7,4 @@ WORKDIR $DISTRIBUTION_DIR
COPY . $DISTRIBUTION_DIR COPY . $DISTRIBUTION_DIR
COPY cmd/registry/config-dev.yml /etc/docker/registry/config.yml COPY cmd/registry/config-dev.yml /etc/docker/registry/config.yml
RUN make PREFIX=/go clean binaries RUN make PREFIX=/go clean binaries

View File

@ -22,7 +22,7 @@ cur=$PWD
TEMP=`mktemp -d /$TMPDIR/distribution.XXXXXX` TEMP=`mktemp -d /$TMPDIR/distribution.XXXXXX`
git clone -b $VERSION https://github.com/docker/distribution.git $TEMP 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 cp Dockerfile.binary $TEMP
docker build -f $TEMP/Dockerfile.binary -t registry-golang $TEMP docker build -f $TEMP/Dockerfile.binary -t registry-golang $TEMP

View File

@ -115,7 +115,7 @@ type VulnerabilityItem struct {
// ScanAllPolicy is represent the json request and object for scan all policy, the parm is het // ScanAllPolicy is represent the json request and object for scan all policy, the parm is het
type ScanAllPolicy struct { type ScanAllPolicy struct {
Type string `json:"type"` Type string `json:"type"`
Parm map[string]interface{} `json:"parameter, omitempty"` Parm map[string]interface{} `json:"parameter,omitempty"`
} }
const ( const (

View File

@ -31,7 +31,7 @@ var addProject *apilib.ProjectReq
var addPID int var addPID int
func InitAddPro() { 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) { 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 // case 4: response code = 400 : Project name is illegal in length
fmt.Println("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 { if err != nil {
t.Error("Error while creat project", err.Error()) t.Error("Error while creat project", err.Error())
t.Log(err) t.Log(err)

View File

@ -39,7 +39,7 @@ func TestTargetsPost(t *testing.T) {
apiTest := newHarborAPI() apiTest := newHarborAPI()
endPoint := os.Getenv("REGISTRY_URL") 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") fmt.Println("Testing Targets Post API")
@ -195,7 +195,7 @@ func TestTargetsPut(t *testing.T) {
apiTest := newHarborAPI() apiTest := newHarborAPI()
endPoint := "1.1.1.1" 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) id := strconv.Itoa(addTargetID)
fmt.Println("Testing Target Put API") fmt.Println("Testing Target Put API")

View File

@ -528,47 +528,47 @@ func TestModifiable(t *testing.T) {
t.Log("Test modifiable.") t.Log("Test modifiable.")
assert := assert.New(t) assert := assert.New(t)
base := BaseController{ base := BaseController{
api.BaseAPI{ BaseAPI: api.BaseAPI{
beego.Controller{}, Controller: beego.Controller{},
}, },
nil, SecurityCtx: nil,
nil, ProjectMgr: nil,
} }
ua1 := &UserAPI{ ua1 := &UserAPI{
base, BaseController: base,
3, currentUserID: 3,
4, userID: 4,
false, SelfRegistration: false,
false, IsAdmin: false,
"db_auth", AuthMode: "db_auth",
} }
assert.False(ua1.modifiable()) assert.False(ua1.modifiable())
ua2 := &UserAPI{ ua2 := &UserAPI{
base, BaseController: base,
3, currentUserID: 3,
4, userID: 4,
false, SelfRegistration: false,
true, IsAdmin: true,
"db_auth", AuthMode: "db_auth",
} }
assert.True(ua2.modifiable()) assert.True(ua2.modifiable())
ua3 := &UserAPI{ ua3 := &UserAPI{
base, BaseController: base,
3, currentUserID: 3,
4, userID: 4,
false, SelfRegistration: false,
true, IsAdmin: true,
"ldap_auth", AuthMode: "ldap_auth",
} }
assert.False(ua3.modifiable()) assert.False(ua3.modifiable())
ua4 := &UserAPI{ ua4 := &UserAPI{
base, BaseController: base,
1, currentUserID: 1,
1, userID: 1,
false, SelfRegistration: false,
true, IsAdmin: true,
"ldap_auth", AuthMode: "ldap_auth",
} }
assert.True(ua4.modifiable()) assert.True(ua4.modifiable())
} }

View File

@ -317,7 +317,7 @@ func RegistryURL() (string, error) {
func InternalJobServiceURL() string { func InternalJobServiceURL() string {
cfg, err := mg.Get() cfg, err := mg.Get()
if err != nil { 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 return common.DefaultJobserviceEndpoint
} }
@ -331,7 +331,7 @@ func InternalJobServiceURL() string {
func InternalCoreURL() string { func InternalCoreURL() string {
cfg, err := mg.Get() cfg, err := mg.Get()
if err != nil { 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 common.DefaultCoreEndpoint
} }
return strings.TrimSuffix(utils.SafeCastString(cfg[common.CoreURL]), "/") return strings.TrimSuffix(utils.SafeCastString(cfg[common.CoreURL]), "/")
@ -348,7 +348,7 @@ func InternalTokenServiceEndpoint() string {
func InternalNotaryEndpoint() string { func InternalNotaryEndpoint() string {
cfg, err := mg.Get() cfg, err := mg.Get()
if err != nil { 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 return common.DefaultNotaryEndpoint
} }
if cfg[common.NotaryURL] == nil { if cfg[common.NotaryURL] == nil {

View File

@ -240,7 +240,7 @@ func (s *sessionReqCtxModifier) Modify(ctx *beegoctx.Context) bool {
log.Info("can not get user information from session") log.Info("can not get user information from session")
return false return false
} }
log.Debug("Getting user %+v", user) log.Debugf("Getting user %+v", user)
log.Debug("using local database project manager") log.Debug("using local database project manager")
pm := config.GlobalProjectMgr pm := config.GlobalProjectMgr
log.Debug("creating local database security context...") log.Debug("creating local database security context...")

View File

@ -128,7 +128,7 @@ func (n *NotificationHandler) Post() {
if err != nil { if err != nil {
log.Errorf("Failed to get last update from Clair DB, error: %v, the auto scan will be skipped.", err) log.Errorf("Failed to get last update from Clair DB, error: %v, the auto scan will be skipped.", err)
} else if last == 0 { } 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 { } else if err := coreutils.TriggerImageScan(repository, tag); err != nil {
log.Warningf("Failed to scan image, repository: %s, tag: %s, error: %v", repository, tag, err) log.Warningf("Failed to scan image, repository: %s, tag: %s, error: %v", repository, tag, err)
} }

View File

@ -39,5 +39,5 @@ func TestCapNonExistPath(t *testing.T) {
driver := NewDriver(path) driver := NewDriver(path)
c, err := driver.Cap() c, err := driver.Cap()
assert.Nil(t, err, "unexpected error") assert.Nil(t, err, "unexpected error")
assert.Equal(t, storage.Capacity{0, 0}, *c) assert.Equal(t, storage.Capacity{Total: 0, Free: 0}, *c)
} }

View File

@ -129,7 +129,7 @@ func triggerImageScan(repository, tag, digest string, client job.Client) error {
} }
err = dao.SetScanJobUUID(id, uuid) err = dao.SetScanJobUUID(id, uuid)
if err != nil { 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 return nil
} }

View File

@ -20,7 +20,7 @@ type Manager struct {
// capacity is the max number of trigger references manager can keep in memory // capacity is the max number of trigger references manager can keep in memory
func NewManager(capacity int) *Manager { func NewManager(capacity int) *Manager {
return &Manager{ return &Manager{
// cache: NewCache(capacity), // cache: NewCache(capacity),
} }
} }

View File

@ -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 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' RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'

View File

@ -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 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 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 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 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 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.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.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.11.2 COMPILETAG=compile_golangimage NOTARYFLAG=true CLAIRFLAG=true MIGRATORFLAG=false CHARTFLAG=true HTTPPROXY=