diff --git a/.github/workflows/harbor-multi-arch-images.yaml b/.github/workflows/harbor-multi-arch-images.yaml index 93f72a6..1c7eab2 100644 --- a/.github/workflows/harbor-multi-arch-images.yaml +++ b/.github/workflows/harbor-multi-arch-images.yaml @@ -197,7 +197,7 @@ jobs: core) make compile_core ${CTX} ;; jobservice) make compile_jobservice ${CTX};; registryctl) make compile_registryctl ${CTX};; - notary*) sudo make compile_notary_migrate_patch ${CTX} ;; + notary*) make compile_notary_migrate_patch ${CTX} ;; standalone_db_migrator) make compile_standalone_db_migrator ${CTX} ;; esac; diff --git a/template/harbor/v2.7.4/Makefile b/template/harbor/v2.7.4/Makefile index 3b77c75..dd937f4 100644 --- a/template/harbor/v2.7.4/Makefile +++ b/template/harbor/v2.7.4/Makefile @@ -1,3 +1,4 @@ + # Makefile for Harbor project # # Targets: @@ -9,7 +10,7 @@ # compile_golangimage: # compile from golang image # for example: make compile_golangimage -e GOBUILDIMAGE= \ -# golang:1.18.5 +# golang:1.18.8 # compile_core, compile_jobservice: compile specific binary # # build: build Harbor docker images from photon baseimage @@ -74,6 +75,8 @@ PORTAL_PATH=$(BUILDPATH)/src/portal CHECKENVCMD=checkenv.sh # parameters +# default is true +BUILD_PG96=true REGISTRYSERVER= REGISTRYPROJECTNAME=goharbor DEVFLAG=true @@ -449,7 +452,7 @@ build: -e TRIVY_DOWNLOAD_URL=$(TRIVY_DOWNLOAD_URL) -e TRIVY_ADAPTER_DOWNLOAD_URL=$(TRIVY_ADAPTER_DOWNLOAD_URL) \ -e PULL_BASE_FROM_DOCKERHUB=$(PULL_BASE_FROM_DOCKERHUB) -e BUILD_BASE=$(BUILD_BASE) \ -e REGISTRYUSER=$(REGISTRYUSER) -e REGISTRYPASSWORD=$(REGISTRYPASSWORD) \ - -e PUSHBASEIMAGE=$(PUSHBASEIMAGE) + -e PUSHBASEIMAGE=$(PUSHBASEIMAGE) -e BUILD_PG96=$(BUILD_PG96) build_standalone_db_migrator: compile_standalone_db_migrator make -f $(MAKEFILEPATH_PHOTON)/Makefile _build_standalone_db_migrator -e BASEIMAGETAG=$(BASEIMAGETAG) -e VERSIONTAG=$(VERSIONTAG) @@ -463,12 +466,25 @@ build_base_docker: @for name in $(BUILDBASETARGET); do \ echo $$name ; \ sleep 30 ; \ - $(DOCKERBUILD) --pull --no-cache -f $(MAKEFILEPATH_PHOTON)/$$name/Dockerfile.base -t $(BASEIMAGENAMESPACE)/harbor-$$name-base:$(BASEIMAGETAG) --label base-build-date=$(date +"%Y%m%d") . ; \ + if [ $$name == "db" ]; then \ + make _build_base_db ; \ + else \ + $(DOCKERBUILD) --build-arg BUILD_PG96=$(BUILD_PG96) --pull --no-cache -f $(MAKEFILEPATH_PHOTON)/$$name/Dockerfile.base -t $(BASEIMAGENAMESPACE)/harbor-$$name-base:$(BASEIMAGETAG) --label base-build-date=$(date +"%Y%m%d") . ; \ + fi ; \ if [ "$(PUSHBASEIMAGE)" != "false" ] ; then \ $(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(BASEIMAGENAMESPACE)/harbor-$$name-base:$(BASEIMAGETAG) $(REGISTRYUSER) $(REGISTRYPASSWORD) || exit 1; \ fi ; \ done +_build_base_db: + @if [ "$(BUILD_PG96)" = "true" ] ; then \ + echo "build pg96 rpm package." ; \ + cd $(MAKEFILEPATH_PHOTON)/db && $(MAKEFILEPATH_PHOTON)/db/rpm_builder.sh && cd - ; \ + $(DOCKERBUILD) --pull --no-cache -f $(MAKEFILEPATH_PHOTON)/db/Dockerfile.pg96 -t $(BASEIMAGENAMESPACE)/harbor-db-base:$(BASEIMAGETAG) --label base-build-date=$(date +"%Y%m%d") . ; \ + else \ + $(DOCKERBUILD) --pull --no-cache -f $(MAKEFILEPATH_PHOTON)/db/Dockerfile.base -t $(BASEIMAGENAMESPACE)/harbor-db-base:$(BASEIMAGETAG) --label base-build-date=$(date +"%Y%m%d") . ; \ + fi + pull_base_docker: @for name in $(BUILDBASETARGET); do \ echo $$name ; \ @@ -530,19 +546,18 @@ misspell: @echo checking misspell... @find . -type d \( -path ./src/vendor -o -path ./tests \) -prune -o -name '*.go' -print | xargs misspell -error -# golangci-lint binary installation or refer to https://golangci-lint.run/usage/install/#local-installation -# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2 +# go get -u github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.2 GOLANGCI_LINT := $(shell go env GOPATH)/bin/golangci-lint lint: @echo checking lint @echo $(GOLANGCI_LINT) @cd ./src/; $(GOLANGCI_LINT) -v run ./... --timeout=10m; -# go install golang.org/x/vuln/cmd/govulncheck@latest -GOVULNCHECK := $(shell go env GOPATH)/bin/govulncheck -govulncheck: - @echo golang vulnerability check - @cd ./src/; $(GOVULNCHECK) ./...; +# # go install golang.org/x/vuln/cmd/govulncheck@latest +# GOVULNCHECK := $(shell go env GOPATH)/bin/govulncheck +# govulncheck: +# @echo golang vulnerability check +# @cd ./src/; $(GOVULNCHECK) ./...; pushimage: @@ -665,4 +680,4 @@ clean: @echo " make cleandockercomposefile: remove specific version docker-compose" @echo " make cleanpackage: remove online and offline install package" -all: install \ No newline at end of file +all: install