From dbe6ebceec15e9f481443feee3ddbc201fff4cc1 Mon Sep 17 00:00:00 2001 From: Daniel Jiang Date: Sun, 20 Oct 2019 21:10:55 +0800 Subject: [PATCH] Bump up golang to 1.12.12 Bump up the golang for compiling the binaries to 1.12.12 This commit also includes some minor changes to Makefile to fix issue in building the binary files. Signed-off-by: Daniel Jiang --- .travis.yml | 10 +++++----- CONTRIBUTING.md | 1 + Makefile | 7 +++++-- docs/compile_guide.md | 8 ++++---- docs/use_make.md | 4 ++-- make/photon/Makefile | 4 ++-- make/photon/chartserver/builder | 2 +- make/photon/clair-adapter/Dockerfile.binary | 2 +- make/photon/clair-adapter/builder | 2 +- make/photon/clair/Dockerfile.binary | 2 +- make/photon/clair/builder | 2 +- make/photon/notary/binary.Dockerfile | 2 +- make/photon/registry/Dockerfile.binary | 2 +- make/photon/registry/builder | 2 +- tests/travis/api_common_install.sh | 2 +- tests/travis/distro_installer.sh | 4 ++-- 16 files changed, 30 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7ba2076f8..3888aaf00 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,23 @@ sudo: true language: go go: -- 1.12.5 +- 1.12.12 go_import_path: github.com/goharbor/harbor services: - docker dist: trusty matrix: include: - - go: 1.12.5 + - go: 1.12.12 env: - UTTEST=true - - go: 1.12.5 + - go: 1.12.12 env: - APITEST_DB=true - - go: 1.12.5 + - go: 1.12.12 env: - APITEST_LDAP=true - - go: 1.12.5 + - go: 1.12.12 env: - OFFLINE=true - language: node_js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 32073195a..71b75b119 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -127,6 +127,7 @@ Harbor backend is written in [Go](http://golang.org/). If you don't have a Harbo | 1.6 | 1.9.2 | | 1.7 | 1.9.2 | | 1.8 | 1.11.2 | +| 1.9 | 1.12.12 | Ensure your GOPATH and PATH have been configured in accordance with the Go environment instructions. diff --git a/Makefile b/Makefile index 4e8b9bcac..2ee4469b2 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ # compile_golangimage: # compile from golang image # for example: make compile_golangimage -e GOBUILDIMAGE= \ -# golang:1.11.2 +# golang:1.12.12 # compile_core, compile_jobservice: compile specific binary # # build: build Harbor docker images from photon baseimage @@ -111,6 +111,9 @@ CLAIRADAPTERVERSION=c7db8b15 # version of chartmuseum CHARTMUSEUMVERSION=v0.9.0 +# version of registry for pulling the source code +REGISTRY_SRC_TAG=v2.7.1 + define VERSIONS_FOR_PREPARE VERSION_TAG: $(VERSIONTAG) REGISTRY_VERSION: $(REGISTRYVERSION) @@ -138,7 +141,7 @@ GOINSTALL=$(GOCMD) install GOTEST=$(GOCMD) test GODEP=$(GOTEST) -i GOFMT=gofmt -w -GOBUILDIMAGE=golang:1.12.5 +GOBUILDIMAGE=golang:1.12.12 GOBUILDPATH=/harbor GOIMAGEBUILDCMD=/usr/local/go/bin/go GOIMAGEBUILD=$(GOIMAGEBUILDCMD) build -mod vendor diff --git a/docs/compile_guide.md b/docs/compile_guide.md index 1d28daea5..ab3832fe3 100644 --- a/docs/compile_guide.md +++ b/docs/compile_guide.md @@ -43,25 +43,25 @@ You can compile the code by one of the three approaches: - Get official Golang image from docker hub: ```sh - $ docker pull golang:1.12.5 + $ docker pull golang:1.12.12 ``` - Build, install and bring up Harbor without Notary: ```sh - $ make install GOBUILDIMAGE=golang:1.12.5 COMPILETAG=compile_golangimage + $ make install GOBUILDIMAGE=golang:1.12.12 COMPILETAG=compile_golangimage ``` - Build, install and bring up Harbor with Notary: ```sh - $ make install GOBUILDIMAGE=golang:1.12.5 COMPILETAG=compile_golangimage NOTARYFLAG=true + $ make install GOBUILDIMAGE=golang:1.12.12 COMPILETAG=compile_golangimage NOTARYFLAG=true ``` - Build, install and bring up Harbor with Clair: ```sh - $ make install GOBUILDIMAGE=golang:1.12.5 COMPILETAG=compile_golangimage CLAIRFLAG=true + $ make install GOBUILDIMAGE=golang:1.12.12 COMPILETAG=compile_golangimage CLAIRFLAG=true ``` #### II. Compile code with your own Golang environment, then build Harbor diff --git a/docs/use_make.md b/docs/use_make.md index 2d56f6eaa..f6deb28e8 100644 --- a/docs/use_make.md +++ b/docs/use_make.md @@ -36,10 +36,10 @@ version | set harbor version #### EXAMPLE: #### Build and run harbor from source code. -make install GOBUILDIMAGE=golang:1.12.5 COMPILETAG=compile_golangimage NOTARYFLAG=true +make install GOBUILDIMAGE=golang:1.12.12 COMPILETAG=compile_golangimage NOTARYFLAG=true ### Package offline installer -make package_offline GOBUILDIMAGE=golang:1.12.5 COMPILETAG=compile_golangimage NOTARYFLAG=true +make package_offline GOBUILDIMAGE=golang:1.12.12 COMPILETAG=compile_golangimage NOTARYFLAG=true ### Start harbor with notary make -e NOTARYFLAG=true start diff --git a/make/photon/Makefile b/make/photon/Makefile index a1290cb1e..4deb9b647 100644 --- a/make/photon/Makefile +++ b/make/photon/Makefile @@ -97,7 +97,7 @@ DOCKERIMAGENAME_MIGRATOR=goharbor/harbor-migrator # for chart server (chartmuseum) DOCKERFILEPATH_CHART_SERVER=$(DOCKERFILEPATH)/chartserver DOCKERFILENAME_CHART_SERVER=Dockerfile -CHART_SERVER_CODE_BASE=github.com/helm/chartmuseum +CHART_SERVER_CODE_BASE=https://github.com/helm/chartmuseum.git CHART_SERVER_MAIN_PATH=cmd/chartmuseum CHART_SERVER_BIN_NAME=chartm @@ -195,7 +195,7 @@ _build_registry: rm -rf $(DOCKERFILEPATH_REG)/binary && mkdir -p $(DOCKERFILEPATH_REG)/binary && \ $(call _get_binary, https://storage.googleapis.com/harbor-builds/bin/registry/release-$(REGISTRYVERSION)/registry, $(DOCKERFILEPATH_REG)/binary/registry); \ else \ - cd $(DOCKERFILEPATH_REG) && $(DOCKERFILEPATH_REG)/builder $(REGISTRYVERSION) && cd - ; \ + cd $(DOCKERFILEPATH_REG) && $(DOCKERFILEPATH_REG)/builder $(REGISTRY_SRC_TAG) && cd - ; \ fi @echo "building registry container for photon..." @chmod 655 $(DOCKERFILEPATH_REG)/binary/registry && $(DOCKERBUILD) -f $(DOCKERFILEPATH_REG)/$(DOCKERFILENAME_REG) -t $(DOCKERIMAGENAME_REG):$(REGISTRYVERSION)-$(VERSIONTAG) . diff --git a/make/photon/chartserver/builder b/make/photon/chartserver/builder index a1d6c3c3f..9a5c0239a 100755 --- a/make/photon/chartserver/builder +++ b/make/photon/chartserver/builder @@ -30,4 +30,4 @@ cp compile.sh binary/ docker run -it --rm -v $cur/binary:/go/bin --name golang_code_builder $GOLANG_IMAGE /bin/bash /go/bin/compile.sh $GIT_PATH $CODE_VERSION $MAIN_GO_PATH $BIN_NAME #Clear -docker rm -f golang_code_builder +#docker rm -f golang_code_builder diff --git a/make/photon/clair-adapter/Dockerfile.binary b/make/photon/clair-adapter/Dockerfile.binary index 87707a3b5..a1a808711 100644 --- a/make/photon/clair-adapter/Dockerfile.binary +++ b/make/photon/clair-adapter/Dockerfile.binary @@ -1,4 +1,4 @@ -FROM golang:1.12.5 +FROM golang:1.12.12 ADD . /go/src/github.com/goharbor/harbor-scanner-clair/ WORKDIR /go/src/github.com/goharbor/harbor-scanner-clair/ diff --git a/make/photon/clair-adapter/builder b/make/photon/clair-adapter/builder index 857fef0e3..82473d855 100755 --- a/make/photon/clair-adapter/builder +++ b/make/photon/clair-adapter/builder @@ -23,7 +23,7 @@ TEMP=`mktemp -d ${TMPDIR-/tmp}/clair-adapter.XXXXXX` git clone https://github.com/danielpacak/harbor-scanner-clair.git $TEMP cd $TEMP; git checkout $VERSION; cd - -echo 'build the clair adapter binary bases on the golang:1.12.5...' +echo 'build the clair adapter binary bases on the golang:1.12.12' cp Dockerfile.binary $TEMP docker build -f $TEMP/Dockerfile.binary -t clair-adapter-golang $TEMP diff --git a/make/photon/clair/Dockerfile.binary b/make/photon/clair/Dockerfile.binary index d478e260f..640962f47 100644 --- a/make/photon/clair/Dockerfile.binary +++ b/make/photon/clair/Dockerfile.binary @@ -1,4 +1,4 @@ -FROM golang:1.11.2 +FROM golang:1.12.12 ADD . /go/src/github.com/coreos/clair/ WORKDIR /go/src/github.com/coreos/clair/ diff --git a/make/photon/clair/builder b/make/photon/clair/builder index 16ae1118c..818f3c0e6 100755 --- a/make/photon/clair/builder +++ b/make/photon/clair/builder @@ -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.11.2...' +echo 'build the clair binary bases on the golang:1.12.12' cp Dockerfile.binary $TEMP docker build -f $TEMP/Dockerfile.binary -t clair-golang $TEMP diff --git a/make/photon/notary/binary.Dockerfile b/make/photon/notary/binary.Dockerfile index 911562e53..7a4188fc1 100644 --- a/make/photon/notary/binary.Dockerfile +++ b/make/photon/notary/binary.Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.11.2 +FROM golang:1.12.12 ARG NOTARY_VERSION ARG MIGRATE_VERSION diff --git a/make/photon/registry/Dockerfile.binary b/make/photon/registry/Dockerfile.binary index de9aa4bdf..5f6311cd8 100644 --- a/make/photon/registry/Dockerfile.binary +++ b/make/photon/registry/Dockerfile.binary @@ -1,4 +1,4 @@ -FROM golang:1.11 +FROM golang:1.12.12 ENV DISTRIBUTION_DIR /go/src/github.com/docker/distribution ENV BUILDTAGS include_oss include_gcs diff --git a/make/photon/registry/builder b/make/photon/registry/builder index 48ec5b3dd..eaacc1ba2 100755 --- a/make/photon/registry/builder +++ b/make/photon/registry/builder @@ -29,7 +29,7 @@ wget https://github.com/docker/distribution/pull/2879.patch git apply 2879.patch cd $cur -echo 'build the registry binary bases on the golang:1.11...' +echo 'build the registry binary ...' cp Dockerfile.binary $TEMP docker build -f $TEMP/Dockerfile.binary -t registry-golang $TEMP diff --git a/tests/travis/api_common_install.sh b/tests/travis/api_common_install.sh index f698bd534..ada0a5540 100644 --- a/tests/travis/api_common_install.sh +++ b/tests/travis/api_common_install.sh @@ -24,5 +24,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.12.5 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 NOTARYFLAG=true CLAIRFLAG=true CHARTFLAG=true +sudo make install GOBUILDIMAGE=golang:1.12.12 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 NOTARYFLAG=true CLAIRFLAG=true CHARTFLAG=true sleep 10 diff --git a/tests/travis/distro_installer.sh b/tests/travis/distro_installer.sh index 772d76678..c6baaf778 100755 --- a/tests/travis/distro_installer.sh +++ b/tests/travis/distro_installer.sh @@ -2,5 +2,5 @@ set -e -sudo make package_online VERSIONTAG=dev-travis PKGVERSIONTAG=dev-travis UIVERSIONTAG=dev-travis GOBUILDIMAGE=golang:1.12.5 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.12.5 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.12.12 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.12.12 COMPILETAG=compile_golangimage NOTARYFLAG=true CLAIRFLAG=true MIGRATORFLAG=false CHARTFLAG=true HTTPPROXY=