From 1ec5383484c9c01d82eca86a0d21a6bfc7134299 Mon Sep 17 00:00:00 2001 From: sbaeDev Date: Fri, 29 Mar 2024 16:31:50 +0900 Subject: [PATCH] test --- .../workflows/harbor-multi-arch-images.yaml | 2 +- template/harbor/v2.7.4/Makefile | 44 +++++++++++-------- 2 files changed, 27 insertions(+), 19 deletions(-) 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..e472dbf 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 @@ -109,8 +112,8 @@ PREPARE_VERSION_NAME=versions REGISTRYVERSION=v2.8.0-patch-redis NOTARYVERSION=v0.6.1 NOTARYMIGRATEVERSION=v4.11.0 -TRIVYVERSION=v0.35.0 -TRIVYADAPTERVERSION=v0.30.5 +TRIVYVERSION=v0.32.1 +TRIVYADAPTERVERSION=v0.30.2 # version of chartmuseum for pulling the source code CHARTMUSEUM_SRC_TAG=v0.14.0 @@ -155,7 +158,7 @@ GOINSTALL=$(GOCMD) install GOTEST=$(GOCMD) test GODEP=$(GOTEST) -i GOFMT=gofmt -w -GOBUILDIMAGE=golang:1.19.4 +GOBUILDIMAGE=golang:1.18.8 GOBUILDPATHINCONTAINER=/harbor TARGETARCHS=amd64 arm64 @@ -356,7 +359,7 @@ gen_apis: lint_apis MOCKERY_IMAGENAME=$(IMAGENAMESPACE)/mockery -MOCKERY_VERSION=v2.14.0 +MOCKERY_VERSION=v2.12.3 MOCKERY=$(RUNCONTAINER) ${MOCKERY_IMAGENAME}:${MOCKERY_VERSION} MOCKERY_IMAGE_BUILD_CMD=${DOCKERBUILD} -f ${TOOLSPATH}/mockery/Dockerfile --build-arg GOLANG=${GOBUILDIMAGE} --build-arg MOCKERY_VERSION=${MOCKERY_VERSION} -t ${MOCKERY_IMAGENAME}:$(MOCKERY_VERSION) . @@ -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,20 +546,12 @@ 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) ./...; - + @cd ./src/; $(GOLANGCI_LINT) -v run ./...; pushimage: @echo "pushing harbor images ..." @@ -665,4 +673,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