2017-03-23 05:36:36 +01:00
|
|
|
# Makefile for Harbor project
|
2017-06-13 11:13:24 +02:00
|
|
|
#
|
2017-03-23 05:36:36 +01:00
|
|
|
# Targets:
|
|
|
|
#
|
2018-09-25 09:12:43 +02:00
|
|
|
# all: prepare env, compile binaries, build images and install images
|
2017-03-23 05:36:36 +01:00
|
|
|
# prepare: prepare env
|
2019-02-22 09:34:26 +01:00
|
|
|
# compile: compile core and jobservice code
|
2017-03-23 05:36:36 +01:00
|
|
|
#
|
|
|
|
# compile_golangimage:
|
|
|
|
# compile from golang image
|
|
|
|
# for example: make compile_golangimage -e GOBUILDIMAGE= \
|
2020-08-20 09:38:35 +02:00
|
|
|
# golang:1.14.7
|
2019-02-22 09:34:26 +01:00
|
|
|
# compile_core, compile_jobservice: compile specific binary
|
2017-03-23 05:36:36 +01:00
|
|
|
#
|
2017-12-09 19:53:12 +01:00
|
|
|
# build: build Harbor docker images from photon baseimage
|
2017-06-13 11:13:24 +02:00
|
|
|
#
|
|
|
|
# install: include compile binarys, build images, prepare specific \
|
2017-03-23 05:36:36 +01:00
|
|
|
# version composefile and startup Harbor instance
|
|
|
|
#
|
2017-06-13 11:13:24 +02:00
|
|
|
# start: startup Harbor instance
|
2017-03-23 05:36:36 +01:00
|
|
|
#
|
|
|
|
# down: shutdown Harbor instance
|
|
|
|
#
|
|
|
|
# package_online:
|
|
|
|
# prepare online install package
|
|
|
|
# for example: make package_online -e DEVFLAG=false\
|
2018-09-03 11:40:26 +02:00
|
|
|
# REGISTRYSERVER=reg-bj.goharbor.io \
|
2017-03-23 05:36:36 +01:00
|
|
|
# REGISTRYPROJECTNAME=harborrelease
|
2017-06-13 11:13:24 +02:00
|
|
|
#
|
2017-03-23 05:36:36 +01:00
|
|
|
# package_offline:
|
|
|
|
# prepare offline install package
|
2017-06-13 11:13:24 +02:00
|
|
|
#
|
2017-03-23 05:36:36 +01:00
|
|
|
# pushimage: push Harbor images to specific registry server
|
|
|
|
# for example: make pushimage -e DEVFLAG=false REGISTRYUSER=admin \
|
|
|
|
# REGISTRYPASSWORD=***** \
|
2018-09-03 11:40:26 +02:00
|
|
|
# REGISTRYSERVER=reg-bj.goharbor.io/ \
|
2017-03-23 05:36:36 +01:00
|
|
|
# REGISTRYPROJECTNAME=harborrelease
|
|
|
|
# note**: need add "/" on end of REGISTRYSERVER. If not setting \
|
|
|
|
# this value will push images directly to dockerhub.
|
2018-09-03 11:40:26 +02:00
|
|
|
# make pushimage -e DEVFLAG=false REGISTRYUSER=goharbor \
|
2017-03-23 05:36:36 +01:00
|
|
|
# REGISTRYPASSWORD=***** \
|
2018-09-03 11:40:26 +02:00
|
|
|
# REGISTRYPROJECTNAME=goharbor
|
2017-03-23 05:36:36 +01:00
|
|
|
#
|
|
|
|
# clean: remove binary, Harbor images, specific version docker-compose \
|
|
|
|
# file, specific version tag and online/offline install package
|
2019-02-22 09:34:26 +01:00
|
|
|
# cleanbinary: remove core and jobservice binary
|
2017-06-13 11:13:24 +02:00
|
|
|
# cleanimage: remove Harbor images
|
|
|
|
# cleandockercomposefile:
|
|
|
|
# remove specific version docker-compose
|
2017-03-23 05:36:36 +01:00
|
|
|
# cleanversiontag:
|
|
|
|
# cleanpackageremove specific version tag
|
|
|
|
# cleanpackage: remove online/offline install package
|
2017-06-13 11:13:24 +02:00
|
|
|
#
|
2017-03-23 05:36:36 +01:00
|
|
|
# other example:
|
|
|
|
# clean specific version binarys and images:
|
|
|
|
# make clean -e VERSIONTAG=[TAG]
|
|
|
|
# note**: If commit new code to github, the git commit TAG will \
|
|
|
|
# change. Better use this commond clean previous images and \
|
2017-06-13 11:13:24 +02:00
|
|
|
# files with specific TAG.
|
2017-03-23 05:36:36 +01:00
|
|
|
# By default DEVFLAG=true, if you want to release new version of Harbor, \
|
|
|
|
# should setting the flag to false.
|
|
|
|
# make XXXX -e DEVFLAG=false
|
|
|
|
|
|
|
|
SHELL := /bin/bash
|
|
|
|
BUILDPATH=$(CURDIR)
|
|
|
|
MAKEPATH=$(BUILDPATH)/make
|
2019-03-18 08:07:19 +01:00
|
|
|
MAKE_PREPARE_PATH=$(MAKEPATH)/photon/prepare
|
2017-03-23 05:36:36 +01:00
|
|
|
SRCPATH=./src
|
|
|
|
TOOLSPATH=$(BUILDPATH)/tools
|
2018-09-12 08:38:29 +02:00
|
|
|
CORE_PATH=$(BUILDPATH)/src/core
|
|
|
|
PORTAL_PATH=$(BUILDPATH)/src/portal
|
2017-03-23 05:36:36 +01:00
|
|
|
CHECKENVCMD=checkenv.sh
|
2017-12-09 19:53:12 +01:00
|
|
|
|
|
|
|
# parameters
|
2017-03-23 05:36:36 +01:00
|
|
|
REGISTRYSERVER=
|
2018-08-23 09:02:20 +02:00
|
|
|
REGISTRYPROJECTNAME=goharbor
|
2017-03-23 05:36:36 +01:00
|
|
|
DEVFLAG=true
|
|
|
|
NOTARYFLAG=false
|
2017-12-09 19:53:12 +01:00
|
|
|
CLAIRFLAG=false
|
2020-02-10 16:46:26 +01:00
|
|
|
TRIVYFLAG=false
|
2017-03-23 05:36:36 +01:00
|
|
|
HTTPPROXY=
|
2017-12-09 19:53:12 +01:00
|
|
|
BUILDBIN=false
|
2019-10-10 09:29:50 +02:00
|
|
|
NPM_REGISTRY=https://registry.npmjs.org
|
2018-07-19 10:47:05 +02:00
|
|
|
# enable/disable chart repo supporting
|
|
|
|
CHARTFLAG=false
|
2019-11-28 12:57:49 +01:00
|
|
|
BUILDTARGET=build
|
2020-02-14 14:11:52 +01:00
|
|
|
GEN_TLS=
|
2017-03-23 05:36:36 +01:00
|
|
|
|
2017-12-09 19:53:12 +01:00
|
|
|
# version prepare
|
2018-03-21 06:03:49 +01:00
|
|
|
# for docker image tag
|
2018-01-22 09:43:00 +01:00
|
|
|
VERSIONTAG=dev
|
2019-11-11 11:56:36 +01:00
|
|
|
# for base docker image tag
|
2020-08-18 08:11:52 +02:00
|
|
|
PUSHBASEIMAGE=
|
2019-11-11 11:56:36 +01:00
|
|
|
BASEIMAGETAG=dev
|
2020-04-01 13:46:45 +02:00
|
|
|
BASEIMAGENAMESPACE=goharbor
|
2018-03-21 06:03:49 +01:00
|
|
|
# for harbor package name
|
|
|
|
PKGVERSIONTAG=dev
|
2017-12-09 19:53:12 +01:00
|
|
|
|
2019-03-18 08:07:19 +01:00
|
|
|
PREPARE_VERSION_NAME=versions
|
|
|
|
|
2017-12-09 19:53:12 +01:00
|
|
|
#versions
|
2020-06-15 18:20:18 +02:00
|
|
|
REGISTRYVERSION=v2.7.1-patch-2819-2553-redis
|
2018-08-27 09:52:09 +02:00
|
|
|
NOTARYVERSION=v0.6.1
|
2020-06-16 06:51:44 +02:00
|
|
|
CLAIRVERSION=v2.1.4
|
2019-02-19 05:51:37 +01:00
|
|
|
NOTARYMIGRATEVERSION=v3.5.4
|
2020-08-20 11:19:46 +02:00
|
|
|
CLAIRADAPTERVERSION=v1.1.1
|
2020-06-29 10:14:22 +02:00
|
|
|
TRIVYVERSION=v0.9.1
|
2020-06-15 18:20:18 +02:00
|
|
|
TRIVYADAPTERVERSION=v0.13.0
|
2018-09-08 13:11:44 +02:00
|
|
|
|
2018-07-19 10:47:05 +02:00
|
|
|
# version of chartmuseum
|
2020-06-15 18:20:18 +02:00
|
|
|
CHARTMUSEUMVERSION=v0.12.0-redis
|
|
|
|
|
|
|
|
# version of chartmuseum for pulling the source code
|
|
|
|
CHARTMUSEUM_SRC_TAG=v0.12.0
|
2017-06-13 11:13:24 +02:00
|
|
|
|
2019-10-20 15:10:55 +02:00
|
|
|
# version of registry for pulling the source code
|
|
|
|
REGISTRY_SRC_TAG=v2.7.1
|
|
|
|
|
2020-04-01 13:46:45 +02:00
|
|
|
# dependency binaries
|
|
|
|
CLAIRURL=https://storage.googleapis.com/harbor-builds/bin/clair/release2.0-${CLAIRVERSION}/clair
|
|
|
|
CHARTURL=https://storage.googleapis.com/harbor-builds/bin/chartmuseum/release-${CHARTMUSEUMVERSION}/chartm
|
|
|
|
NORARYURL=https://storage.googleapis.com/harbor-builds/bin/notary/release-${NOTARYVERSION}/binary-bundle.tgz
|
|
|
|
REGISTRYURL=https://storage.googleapis.com/harbor-builds/bin/registry/release-${REGISTRYVERSION}/registry
|
|
|
|
CLAIR_ADAPTER_DOWNLOAD_URL=https://github.com/goharbor/harbor-scanner-clair/releases/download/$(CLAIRADAPTERVERSION)/harbor-scanner-clair_$(CLAIRADAPTERVERSION:v%=%)_Linux_x86_64.tar.gz
|
|
|
|
TRIVY_DOWNLOAD_URL=https://github.com/aquasecurity/trivy/releases/download/$(TRIVYVERSION)/trivy_$(TRIVYVERSION:v%=%)_Linux-64bit.tar.gz
|
|
|
|
TRIVY_ADAPTER_DOWNLOAD_URL=https://github.com/aquasecurity/harbor-scanner-trivy/releases/download/$(TRIVYADAPTERVERSION)/harbor-scanner-trivy_$(TRIVYADAPTERVERSION:v%=%)_Linux_x86_64.tar.gz
|
|
|
|
|
2019-03-18 08:07:19 +01:00
|
|
|
define VERSIONS_FOR_PREPARE
|
|
|
|
VERSION_TAG: $(VERSIONTAG)
|
|
|
|
REGISTRY_VERSION: $(REGISTRYVERSION)
|
|
|
|
NOTARY_VERSION: $(NOTARYVERSION)
|
|
|
|
CLAIR_VERSION: $(CLAIRVERSION)
|
2019-10-17 06:00:51 +02:00
|
|
|
CLAIR_ADAPTER_VERSION: $(CLAIRADAPTERVERSION)
|
2020-02-10 16:46:26 +01:00
|
|
|
TRIVY_VERSION: $(TRIVYVERSION)
|
|
|
|
TRIVY_ADAPTER_VERSION: $(TRIVYADAPTERVERSION)
|
2019-03-18 08:07:19 +01:00
|
|
|
CHARTMUSEUM_VERSION: $(CHARTMUSEUMVERSION)
|
|
|
|
endef
|
|
|
|
|
2017-03-23 05:36:36 +01:00
|
|
|
# docker parameters
|
|
|
|
DOCKERCMD=$(shell which docker)
|
|
|
|
DOCKERBUILD=$(DOCKERCMD) build
|
|
|
|
DOCKERRMIMAGE=$(DOCKERCMD) rmi
|
|
|
|
DOCKERPULL=$(DOCKERCMD) pull
|
2020-06-16 12:18:55 +02:00
|
|
|
DOCKERIMAGES=$(DOCKERCMD) images
|
2017-03-23 05:36:36 +01:00
|
|
|
DOCKERSAVE=$(DOCKERCMD) save
|
|
|
|
DOCKERCOMPOSECMD=$(shell which docker-compose)
|
|
|
|
DOCKERTAG=$(DOCKERCMD) tag
|
|
|
|
|
|
|
|
# go parameters
|
|
|
|
GOCMD=$(shell which go)
|
|
|
|
GOBUILD=$(GOCMD) build
|
|
|
|
GOCLEAN=$(GOCMD) clean
|
|
|
|
GOINSTALL=$(GOCMD) install
|
|
|
|
GOTEST=$(GOCMD) test
|
|
|
|
GODEP=$(GOTEST) -i
|
|
|
|
GOFMT=gofmt -w
|
2020-08-20 09:38:35 +02:00
|
|
|
GOBUILDIMAGE=golang:1.14.7
|
2019-11-28 12:57:49 +01:00
|
|
|
GOBUILDPATHINCONTAINER=/harbor
|
2019-10-31 07:23:16 +01:00
|
|
|
|
|
|
|
# go build
|
|
|
|
PKG_PATH=github.com/goharbor/harbor/src/pkg
|
|
|
|
GITCOMMIT := $(shell git rev-parse --short=8 HEAD)
|
|
|
|
RELEASEVERSION := $(shell cat VERSION)
|
|
|
|
GOFLAGS=
|
|
|
|
GOTAGS=$(if $(GOBUILDTAGS),-tags "$(GOBUILDTAGS)",)
|
|
|
|
GOLDFLAGS=$(if $(GOBUILDLDFLAGS),--ldflags "-w -s $(GOBUILDLDFLAGS)",)
|
|
|
|
CORE_LDFLAGS=-X $(PKG_PATH)/version.GitCommit=$(GITCOMMIT) -X $(PKG_PATH)/version.ReleaseVersion=$(RELEASEVERSION)
|
|
|
|
ifneq ($(GOBUILDLDFLAGS),)
|
|
|
|
CORE_LDFLAGS += $(GOBUILDLDFLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# go build command
|
2019-10-29 09:09:54 +01:00
|
|
|
GOIMAGEBUILDCMD=/usr/local/go/bin/go build -mod vendor
|
2019-10-31 07:23:16 +01:00
|
|
|
GOIMAGEBUILD_COMMON=$(GOIMAGEBUILDCMD) $(GOFLAGS) ${GOTAGS} ${GOLDFLAGS}
|
|
|
|
GOIMAGEBUILD_CORE=$(GOIMAGEBUILDCMD) $(GOFLAGS) ${GOTAGS} --ldflags "-w -s $(CORE_LDFLAGS)"
|
|
|
|
|
2019-11-28 12:57:49 +01:00
|
|
|
GOBUILDPATH_CORE=$(GOBUILDPATHINCONTAINER)/src/core
|
|
|
|
GOBUILDPATH_JOBSERVICE=$(GOBUILDPATHINCONTAINER)/src/jobservice
|
|
|
|
GOBUILDPATH_REGISTRYCTL=$(GOBUILDPATHINCONTAINER)/src/registryctl
|
|
|
|
GOBUILDPATH_MIGRATEPATCH=$(GOBUILDPATHINCONTAINER)/src/cmd/migrate-patch
|
2020-07-13 10:57:09 +02:00
|
|
|
GOBUILDPATH_STANDALONE_DB_MIGRATOR=$(GOBUILDPATHINCONTAINER)/src/cmd/standalone-db-migrator
|
2019-11-28 12:57:49 +01:00
|
|
|
GOBUILDMAKEPATH=make
|
2018-09-12 08:38:29 +02:00
|
|
|
GOBUILDMAKEPATH_CORE=$(GOBUILDMAKEPATH)/photon/core
|
2018-09-03 11:40:26 +02:00
|
|
|
GOBUILDMAKEPATH_JOBSERVICE=$(GOBUILDMAKEPATH)/photon/jobservice
|
|
|
|
GOBUILDMAKEPATH_REGISTRYCTL=$(GOBUILDMAKEPATH)/photon/registryctl
|
2019-02-19 05:51:37 +01:00
|
|
|
GOBUILDMAKEPATH_NOTARY=$(GOBUILDMAKEPATH)/photon/notary
|
2020-07-13 10:57:09 +02:00
|
|
|
GOBUILDMAKEPATH_STANDALONE_DB_MIGRATOR=$(GOBUILDMAKEPATH)/photon/standalone-db-migrator
|
2017-03-23 05:36:36 +01:00
|
|
|
|
2017-06-13 11:13:24 +02:00
|
|
|
# binary
|
2019-11-28 12:57:49 +01:00
|
|
|
CORE_BINARYPATH=$(BUILDPATH)/$(GOBUILDMAKEPATH_CORE)
|
2018-09-12 08:38:29 +02:00
|
|
|
CORE_BINARYNAME=harbor_core
|
2019-11-28 12:57:49 +01:00
|
|
|
JOBSERVICEBINARYPATH=$(BUILDPATH)/$(GOBUILDMAKEPATH_JOBSERVICE)
|
2017-03-23 05:36:36 +01:00
|
|
|
JOBSERVICEBINARYNAME=harbor_jobservice
|
2019-11-28 12:57:49 +01:00
|
|
|
REGISTRYCTLBINARYPATH=$(BUILDPATH)/$(GOBUILDMAKEPATH_REGISTRYCTL)
|
2018-07-16 10:50:28 +02:00
|
|
|
REGISTRYCTLBINARYNAME=harbor_registryctl
|
2019-11-28 12:57:49 +01:00
|
|
|
MIGRATEPATCHBINARYPATH=$(BUILDPATH)/$(GOBUILDMAKEPATH_NOTARY)
|
2019-02-19 05:51:37 +01:00
|
|
|
MIGRATEPATCHBINARYNAME=migrate-patch
|
2020-07-13 10:57:09 +02:00
|
|
|
STANDALONE_DB_MIGRATOR_BINARYPATH=$(BUILDPATH)/$(GOBUILDMAKEPATH_STANDALONE_DB_MIGRATOR)
|
|
|
|
STANDALONE_DB_MIGRATOR_BINARYNAME=migrate
|
2017-03-23 05:36:36 +01:00
|
|
|
|
|
|
|
# configfile
|
|
|
|
CONFIGPATH=$(MAKEPATH)
|
2019-03-12 12:09:01 +01:00
|
|
|
INSIDE_CONFIGPATH=/compose_location
|
2018-11-15 04:09:57 +01:00
|
|
|
CONFIGFILE=harbor.yml
|
2017-03-23 05:36:36 +01:00
|
|
|
|
2017-06-13 11:13:24 +02:00
|
|
|
# prepare parameters
|
|
|
|
PREPAREPATH=$(TOOLSPATH)
|
|
|
|
PREPARECMD=prepare
|
2018-11-15 04:09:57 +01:00
|
|
|
PREPARECMD_PARA=--conf $(INSIDE_CONFIGPATH)/$(CONFIGFILE)
|
2017-06-13 11:13:24 +02:00
|
|
|
ifeq ($(NOTARYFLAG), true)
|
|
|
|
PREPARECMD_PARA+= --with-notary
|
|
|
|
endif
|
|
|
|
ifeq ($(CLAIRFLAG), true)
|
|
|
|
PREPARECMD_PARA+= --with-clair
|
|
|
|
endif
|
2020-02-10 16:46:26 +01:00
|
|
|
ifeq ($(TRIVYFLAG), true)
|
|
|
|
PREPARECMD_PARA+= --with-trivy
|
|
|
|
endif
|
2018-07-19 10:47:05 +02:00
|
|
|
# append chartmuseum parameters if set
|
|
|
|
ifeq ($(CHARTFLAG), true)
|
|
|
|
PREPARECMD_PARA+= --with-chartmuseum
|
|
|
|
endif
|
2017-06-13 11:13:24 +02:00
|
|
|
|
2017-03-23 05:36:36 +01:00
|
|
|
# makefile
|
|
|
|
MAKEFILEPATH_PHOTON=$(MAKEPATH)/photon
|
|
|
|
|
|
|
|
# common dockerfile
|
|
|
|
DOCKERFILEPATH_COMMON=$(MAKEPATH)/common
|
|
|
|
|
|
|
|
# docker image name
|
2019-03-18 08:07:19 +01:00
|
|
|
DOCKER_IMAGE_NAME_PREPARE=goharbor/prepare
|
2018-09-05 09:48:16 +02:00
|
|
|
DOCKERIMAGENAME_PORTAL=goharbor/harbor-portal
|
2018-09-12 08:38:29 +02:00
|
|
|
DOCKERIMAGENAME_CORE=goharbor/harbor-core
|
2018-08-10 08:16:59 +02:00
|
|
|
DOCKERIMAGENAME_JOBSERVICE=goharbor/harbor-jobservice
|
|
|
|
DOCKERIMAGENAME_LOG=goharbor/harbor-log
|
|
|
|
DOCKERIMAGENAME_DB=goharbor/harbor-db
|
|
|
|
DOCKERIMAGENAME_CHART_SERVER=goharbor/chartmuseum-photon
|
|
|
|
DOCKERIMAGENAME_REGCTL=goharbor/harbor-registryctl
|
2017-12-09 19:53:12 +01:00
|
|
|
|
2017-03-23 05:36:36 +01:00
|
|
|
# docker-compose files
|
|
|
|
DOCKERCOMPOSEFILEPATH=$(MAKEPATH)
|
|
|
|
DOCKERCOMPOSETPLFILENAME=docker-compose.tpl
|
|
|
|
DOCKERCOMPOSEFILENAME=docker-compose.yml
|
2017-12-09 19:53:12 +01:00
|
|
|
DOCKERCOMPOSENOTARYTPLFILENAME=docker-compose.notary.tpl
|
2017-03-23 05:36:36 +01:00
|
|
|
DOCKERCOMPOSENOTARYFILENAME=docker-compose.notary.yml
|
2017-12-09 19:53:12 +01:00
|
|
|
DOCKERCOMPOSECLAIRTPLFILENAME=docker-compose.clair.tpl
|
2017-06-13 11:13:24 +02:00
|
|
|
DOCKERCOMPOSECLAIRFILENAME=docker-compose.clair.yml
|
2018-07-19 10:47:05 +02:00
|
|
|
DOCKERCOMPOSECHARTMUSEUMTPLFILENAME=docker-compose.chartmuseum.tpl
|
|
|
|
DOCKERCOMPOSECHARTMUSEUMFILENAME=docker-compose.chartmuseum.yml
|
2017-03-23 05:36:36 +01:00
|
|
|
|
|
|
|
SEDCMD=$(shell which sed)
|
2020-02-06 03:58:29 +01:00
|
|
|
SEDCMDI=$(SEDCMD) -i
|
|
|
|
ifeq ($(shell uname),Darwin)
|
|
|
|
SEDCMDI=$(SEDCMD) -i ''
|
|
|
|
endif
|
2017-03-23 05:36:36 +01:00
|
|
|
|
2017-06-13 11:13:24 +02:00
|
|
|
# package
|
2017-03-23 05:36:36 +01:00
|
|
|
TARCMD=$(shell which tar)
|
|
|
|
ZIPCMD=$(shell which gzip)
|
|
|
|
DOCKERIMGFILE=harbor
|
|
|
|
HARBORPKG=harbor
|
|
|
|
|
|
|
|
# pushimage
|
|
|
|
PUSHSCRIPTPATH=$(MAKEPATH)
|
|
|
|
PUSHSCRIPTNAME=pushimage.sh
|
|
|
|
REGISTRYUSER=user
|
|
|
|
REGISTRYPASSWORD=default
|
|
|
|
|
2017-06-13 11:13:24 +02:00
|
|
|
# cmds
|
2019-03-18 08:07:19 +01:00
|
|
|
DOCKERSAVE_PARA=$(DOCKER_IMAGE_NAME_PREPARE):$(VERSIONTAG) \
|
|
|
|
$(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) \
|
2018-09-12 08:38:29 +02:00
|
|
|
$(DOCKERIMAGENAME_CORE):$(VERSIONTAG) \
|
2017-06-13 11:13:24 +02:00
|
|
|
$(DOCKERIMAGENAME_LOG):$(VERSIONTAG) \
|
|
|
|
$(DOCKERIMAGENAME_DB):$(VERSIONTAG) \
|
|
|
|
$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) \
|
2018-07-16 10:50:28 +02:00
|
|
|
$(DOCKERIMAGENAME_REGCTL):$(VERSIONTAG) \
|
2020-03-09 09:51:45 +01:00
|
|
|
goharbor/redis-photon:$(VERSIONTAG) \
|
|
|
|
goharbor/nginx-photon:$(VERSIONTAG) \
|
2020-03-03 08:22:21 +01:00
|
|
|
goharbor/registry-photon:$(VERSIONTAG)
|
2018-07-26 04:09:22 +02:00
|
|
|
|
2018-03-21 06:03:49 +01:00
|
|
|
PACKAGE_OFFLINE_PARA=-zcvf harbor-offline-installer-$(PKGVERSIONTAG).tgz \
|
2019-02-20 11:01:48 +01:00
|
|
|
$(HARBORPKG)/$(DOCKERIMGFILE).$(VERSIONTAG).tar.gz \
|
|
|
|
$(HARBORPKG)/prepare \
|
|
|
|
$(HARBORPKG)/LICENSE $(HARBORPKG)/install.sh \
|
2019-08-21 18:50:54 +02:00
|
|
|
$(HARBORPKG)/common.sh \
|
2019-11-28 12:57:49 +01:00
|
|
|
$(HARBORPKG)/harbor.yml.tmpl
|
2018-11-15 04:09:57 +01:00
|
|
|
|
2018-03-21 06:03:49 +01:00
|
|
|
PACKAGE_ONLINE_PARA=-zcvf harbor-online-installer-$(PKGVERSIONTAG).tgz \
|
2019-02-20 11:01:48 +01:00
|
|
|
$(HARBORPKG)/prepare \
|
|
|
|
$(HARBORPKG)/LICENSE \
|
|
|
|
$(HARBORPKG)/install.sh \
|
2019-08-21 18:50:54 +02:00
|
|
|
$(HARBORPKG)/common.sh \
|
2019-11-28 12:57:49 +01:00
|
|
|
$(HARBORPKG)/harbor.yml.tmpl
|
2018-11-15 04:09:57 +01:00
|
|
|
|
2019-08-01 10:02:08 +02:00
|
|
|
DOCKERCOMPOSE_FILE_OPT=-f $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSEFILENAME)
|
2017-06-13 11:13:24 +02:00
|
|
|
|
|
|
|
ifeq ($(NOTARYFLAG), true)
|
2020-03-03 08:22:21 +01:00
|
|
|
DOCKERSAVE_PARA+= goharbor/notary-server-photon:$(VERSIONTAG) goharbor/notary-signer-photon:$(VERSIONTAG)
|
2017-06-13 11:13:24 +02:00
|
|
|
endif
|
|
|
|
ifeq ($(CLAIRFLAG), true)
|
2020-03-03 08:22:21 +01:00
|
|
|
DOCKERSAVE_PARA+= goharbor/clair-photon:$(VERSIONTAG) goharbor/clair-adapter-photon:$(VERSIONTAG)
|
2017-06-13 11:13:24 +02:00
|
|
|
endif
|
2020-02-10 16:46:26 +01:00
|
|
|
ifeq ($(TRIVYFLAG), true)
|
2020-03-03 08:22:21 +01:00
|
|
|
DOCKERSAVE_PARA+= goharbor/trivy-adapter-photon:$(VERSIONTAG)
|
2020-02-10 16:46:26 +01:00
|
|
|
endif
|
2018-07-19 10:47:05 +02:00
|
|
|
# append chartmuseum parameters if set
|
|
|
|
ifeq ($(CHARTFLAG), true)
|
2020-03-03 08:22:21 +01:00
|
|
|
DOCKERSAVE_PARA+= $(DOCKERIMAGENAME_CHART_SERVER):$(VERSIONTAG)
|
2018-07-19 10:47:05 +02:00
|
|
|
endif
|
2017-06-13 11:13:24 +02:00
|
|
|
|
2020-01-14 03:20:18 +01:00
|
|
|
SWAGGER_IMAGENAME=goharbor/swagger
|
|
|
|
SWAGGER_VERSION=v0.21.0
|
|
|
|
SWAGGER=$(DOCKERCMD) run --rm -u $(shell id -u):$(shell id -g) -v $(BUILDPATH):$(BUILDPATH) -w $(BUILDPATH) ${SWAGGER_IMAGENAME}:${SWAGGER_VERSION}
|
2020-08-15 18:09:06 +02:00
|
|
|
SWAGGER_GENERATE_SERVER=${SWAGGER} generate server --template-dir=$(TOOLSPATH)/swagger/templates --exclude-main --additional-initialism=CVE
|
2020-06-16 12:18:55 +02:00
|
|
|
SWAGGER_IMAGE_BUILD_CMD=${DOCKERBUILD} -f ${TOOLSPATH}/swagger/Dockerfile --build-arg SWAGGER_VERSION=${SWAGGER_VERSION} -t ${SWAGGER_IMAGENAME}:$(SWAGGER_VERSION) .
|
2020-01-14 03:20:18 +01:00
|
|
|
|
|
|
|
SWAGGER_IMAGENAME:
|
2020-06-16 12:18:55 +02:00
|
|
|
@if [ "$(shell ${DOCKERIMAGES} -q ${SWAGGER_IMAGENAME}:$(SWAGGER_VERSION) 2> /dev/null)" == "" ]; then \
|
|
|
|
${SWAGGER_IMAGE_BUILD_CMD} && echo "build swagger image successfully" || (echo "build swagger image failed" && exit 1) ; \
|
2020-01-14 03:20:18 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# $1 the path of swagger spec
|
|
|
|
# $2 the path of base directory for generating the files
|
|
|
|
# $3 the name of the application
|
|
|
|
define swagger_generate_server
|
|
|
|
@echo "generate all the files for API from $(1)"
|
|
|
|
@rm -rf $(2)/{models,restapi}
|
|
|
|
@mkdir -p $(2)
|
|
|
|
@$(SWAGGER_GENERATE_SERVER) -f $(1) -A $(3) --target $(2)
|
|
|
|
endef
|
|
|
|
|
|
|
|
gen_apis: SWAGGER_IMAGENAME
|
|
|
|
$(call swagger_generate_server,api/v2.0/swagger.yaml,src/server/v2.0,harbor)
|
|
|
|
|
2020-07-22 03:59:32 +02:00
|
|
|
|
|
|
|
MOCKERY_IMAGENAME=goharbor/mockery
|
|
|
|
MOCKERY_VERSION=v2.1.0
|
|
|
|
MOCKERY=$(DOCKERCMD) run --rm -u $(shell id -u):$(shell id -g) -v $(BUILDPATH):$(BUILDPATH) -w $(BUILDPATH) ${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) .
|
|
|
|
|
|
|
|
MOCKERY_IMAGE:
|
|
|
|
@if [ "$(shell ${DOCKERIMAGES} -q ${MOCKERY_IMAGENAME}:$(MOCKERY_VERSION) 2> /dev/null)" == "" ]; then \
|
|
|
|
${MOCKERY_IMAGE_BUILD_CMD} && echo "build mockery image successfully" || (echo "build mockery image failed" && exit 1) ; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
gen_mocks: MOCKERY_IMAGE
|
|
|
|
${MOCKERY} go generate ./...
|
|
|
|
|
|
|
|
mocks_check: gen_mocks
|
|
|
|
@echo checking mocks...
|
|
|
|
@res=$$(git status -s src/ | awk '{ printf("%s\n", $$2) }' | egrep .*.go); \
|
|
|
|
if [ -n "$${res}" ]; then \
|
|
|
|
echo mocks of the interface are out of date... ; \
|
|
|
|
echo "$${res}"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
|
2019-03-18 08:07:19 +01:00
|
|
|
export VERSIONS_FOR_PREPARE
|
|
|
|
versions_prepare:
|
|
|
|
@echo "$$VERSIONS_FOR_PREPARE" > $(MAKE_PREPARE_PATH)/$(PREPARE_VERSION_NAME)
|
|
|
|
|
2017-03-23 05:36:36 +01:00
|
|
|
check_environment:
|
|
|
|
@$(MAKEPATH)/$(CHECKENVCMD)
|
|
|
|
|
2020-01-14 03:20:18 +01:00
|
|
|
compile_core: gen_apis
|
2018-09-12 08:38:29 +02:00
|
|
|
@echo "compiling binary for core (golang image)..."
|
2019-11-28 12:57:49 +01:00
|
|
|
@echo $(GOBUILDPATHINCONTAINER)
|
|
|
|
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATHINCONTAINER) -w $(GOBUILDPATH_CORE) $(GOBUILDIMAGE) $(GOIMAGEBUILD_CORE) -o $(GOBUILDPATHINCONTAINER)/$(GOBUILDMAKEPATH_CORE)/$(CORE_BINARYNAME)
|
2017-03-23 05:36:36 +01:00
|
|
|
@echo "Done."
|
2017-06-13 11:13:24 +02:00
|
|
|
|
2018-08-29 12:54:00 +02:00
|
|
|
compile_jobservice:
|
2017-03-23 05:36:36 +01:00
|
|
|
@echo "compiling binary for jobservice (golang image)..."
|
2019-11-28 12:57:49 +01:00
|
|
|
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATHINCONTAINER) -w $(GOBUILDPATH_JOBSERVICE) $(GOBUILDIMAGE) $(GOIMAGEBUILD_COMMON) -o $(GOBUILDPATHINCONTAINER)/$(GOBUILDMAKEPATH_JOBSERVICE)/$(JOBSERVICEBINARYNAME)
|
2017-03-23 05:36:36 +01:00
|
|
|
@echo "Done."
|
|
|
|
|
2018-08-29 12:54:00 +02:00
|
|
|
compile_registryctl:
|
2018-08-09 13:04:35 +02:00
|
|
|
@echo "compiling binary for harbor registry controller (golang image)..."
|
2019-11-28 12:57:49 +01:00
|
|
|
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATHINCONTAINER) -w $(GOBUILDPATH_REGISTRYCTL) $(GOBUILDIMAGE) $(GOIMAGEBUILD_COMMON) -o $(GOBUILDPATHINCONTAINER)/$(GOBUILDMAKEPATH_REGISTRYCTL)/$(REGISTRYCTLBINARYNAME)
|
2018-07-16 10:50:28 +02:00
|
|
|
@echo "Done."
|
|
|
|
|
2019-02-19 05:51:37 +01:00
|
|
|
compile_notary_migrate_patch:
|
|
|
|
@echo "compiling binary for migrate patch (golang image)..."
|
2019-11-28 12:57:49 +01:00
|
|
|
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATHINCONTAINER) -w $(GOBUILDPATH_MIGRATEPATCH) $(GOBUILDIMAGE) $(GOIMAGEBUILD_COMMON) -o $(GOBUILDPATHINCONTAINER)/$(GOBUILDMAKEPATH_NOTARY)/$(MIGRATEPATCHBINARYNAME)
|
2019-02-19 05:51:37 +01:00
|
|
|
@echo "Done."
|
|
|
|
|
2020-07-13 10:57:09 +02:00
|
|
|
compile_standalone_db_migrator:
|
|
|
|
@echo "compiling binary for standalone db migrator (golang image)..."
|
|
|
|
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATHINCONTAINER) -w $(GOBUILDPATH_STANDALONE_DB_MIGRATOR) $(GOBUILDIMAGE) $(GOIMAGEBUILD_COMMON) -o $(GOBUILDPATHINCONTAINER)/$(GOBUILDMAKEPATH_STANDALONE_DB_MIGRATOR)/$(STANDALONE_DB_MIGRATOR_BINARYNAME)
|
|
|
|
@echo "Done."
|
|
|
|
|
2019-03-18 08:07:19 +01:00
|
|
|
compile: check_environment versions_prepare compile_core compile_jobservice compile_registryctl compile_notary_migrate_patch
|
|
|
|
|
2020-02-06 03:58:29 +01:00
|
|
|
update_prepare_version:
|
|
|
|
@echo "substitute the prepare version tag in prepare file..."
|
2020-02-14 14:11:52 +01:00
|
|
|
@$(SEDCMDI) -e 's/goharbor\/prepare:.*[[:space:]]\+/goharbor\/prepare:$(VERSIONTAG) prepare /' $(MAKEPATH)/prepare ;
|
|
|
|
|
|
|
|
gen_tls:
|
2020-03-17 10:30:25 +01:00
|
|
|
@$(DOCKERCMD) run --rm -v /:/hostfs:z goharbor/prepare:$(VERSIONTAG) gencert -p /etc/harbor/tls/internal
|
2020-02-06 03:58:29 +01:00
|
|
|
|
|
|
|
prepare: update_prepare_version
|
2017-06-13 11:13:24 +02:00
|
|
|
@echo "preparing..."
|
2020-02-14 14:11:52 +01:00
|
|
|
@if [ -n "$(GEN_TLS)" ] ; then \
|
2020-03-17 10:30:25 +01:00
|
|
|
$(DOCKERCMD) run --rm -v /:/hostfs:z goharbor/prepare:$(VERSIONTAG) gencert -p /etc/harbor/tls/internal; \
|
2020-02-14 14:11:52 +01:00
|
|
|
fi
|
2019-02-20 11:01:48 +01:00
|
|
|
@$(MAKEPATH)/$(PREPARECMD) $(PREPARECMD_PARA)
|
2017-06-13 11:13:24 +02:00
|
|
|
|
2017-12-09 19:53:12 +01:00
|
|
|
build:
|
2019-11-28 12:57:49 +01:00
|
|
|
make -f $(MAKEFILEPATH_PHOTON)/Makefile $(BUILDTARGET) -e DEVFLAG=$(DEVFLAG) -e GOBUILDIMAGE=$(GOBUILDIMAGE) \
|
2020-03-09 09:51:45 +01:00
|
|
|
-e REGISTRYVERSION=$(REGISTRYVERSION) -e REGISTRY_SRC_TAG=$(REGISTRY_SRC_TAG) \
|
2020-02-10 16:46:26 +01:00
|
|
|
-e NOTARYVERSION=$(NOTARYVERSION) -e NOTARYMIGRATEVERSION=$(NOTARYMIGRATEVERSION) \
|
|
|
|
-e TRIVYVERSION=$(TRIVYVERSION) -e TRIVYADAPTERVERSION=$(TRIVYADAPTERVERSION) \
|
2019-11-06 07:16:02 +01:00
|
|
|
-e CLAIRVERSION=$(CLAIRVERSION) -e CLAIRADAPTERVERSION=$(CLAIRADAPTERVERSION) -e VERSIONTAG=$(VERSIONTAG) \
|
2020-03-09 09:51:45 +01:00
|
|
|
-e BUILDBIN=$(BUILDBIN) \
|
2020-06-15 18:20:18 +02:00
|
|
|
-e CHARTMUSEUMVERSION=$(CHARTMUSEUMVERSION) -e CHARTMUSEUM_SRC_TAG=$(CHARTMUSEUM_SRC_TAG) -e DOCKERIMAGENAME_CHART_SERVER=$(DOCKERIMAGENAME_CHART_SERVER) \
|
2020-04-01 13:46:45 +02:00
|
|
|
-e NPM_REGISTRY=$(NPM_REGISTRY) -e BASEIMAGETAG=$(BASEIMAGETAG) -e BASEIMAGENAMESPACE=$(BASEIMAGENAMESPACE) \
|
|
|
|
-e CLAIRURL=$(CLAIRURL) -e CHARTURL=$(CHARTURL) -e NORARYURL=$(NORARYURL) -e REGISTRYURL=$(REGISTRYURL) -e CLAIR_ADAPTER_DOWNLOAD_URL=$(CLAIR_ADAPTER_DOWNLOAD_URL) \
|
|
|
|
-e TRIVY_DOWNLOAD_URL=$(TRIVY_DOWNLOAD_URL) -e TRIVY_ADAPTER_DOWNLOAD_URL=$(TRIVY_ADAPTER_DOWNLOAD_URL)
|
2019-11-11 11:56:36 +01:00
|
|
|
|
2020-07-13 10:57:09 +02:00
|
|
|
build_standalone_db_migrator: compile_standalone_db_migrator
|
|
|
|
make -f $(MAKEFILEPATH_PHOTON)/Makefile _build_standalone_db_migrator -e BASEIMAGETAG=$(BASEIMAGETAG) -e VERSIONTAG=$(VERSIONTAG)
|
|
|
|
|
2019-11-11 11:56:36 +01:00
|
|
|
build_base_docker:
|
2020-02-10 16:46:26 +01:00
|
|
|
@for name in chartserver clair clair-adapter trivy-adapter core db jobservice log nginx notary-server notary-signer portal prepare redis registry registryctl; do \
|
2019-11-11 11:56:36 +01:00
|
|
|
echo $$name ; \
|
2020-06-15 18:20:18 +02:00
|
|
|
$(DOCKERBUILD) --pull --no-cache -f $(MAKEFILEPATH_PHOTON)/$$name/Dockerfile.base -t $(BASEIMAGENAMESPACE)/harbor-$$name-base:$(BASEIMAGETAG) --label base-build-date=$(date +"%Y%m%d") . && \
|
2020-08-18 08:11:52 +02:00
|
|
|
if [ -n "$(PUSHBASEIMAGE)" ] ; then \
|
|
|
|
$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(BASEIMAGENAMESPACE)/harbor-$$name-base:$(BASEIMAGETAG) $(REGISTRYUSER) $(REGISTRYPASSWORD) || exit 1; \
|
|
|
|
fi ; \
|
2019-11-11 11:56:36 +01:00
|
|
|
done
|
2017-06-13 11:13:24 +02:00
|
|
|
|
2020-02-20 13:25:58 +01:00
|
|
|
pull_base_docker:
|
2020-03-09 06:56:39 +01:00
|
|
|
@for name in chartserver clair clair-adapter trivy-adapter core db jobservice log nginx notary-server notary-signer portal prepare redis registry registryctl; do \
|
2020-02-20 13:25:58 +01:00
|
|
|
echo $$name ; \
|
2020-04-01 13:46:45 +02:00
|
|
|
$(DOCKERPULL) $(BASEIMAGENAMESPACE)/harbor-$$name-base:$(BASEIMAGETAG) ; \
|
2020-02-20 13:25:58 +01:00
|
|
|
done
|
|
|
|
|
2019-10-29 09:09:54 +01:00
|
|
|
install: compile build prepare start
|
2017-06-13 11:13:24 +02:00
|
|
|
|
2020-02-06 03:58:29 +01:00
|
|
|
package_online: update_prepare_version
|
2017-03-23 05:36:36 +01:00
|
|
|
@echo "packing online package ..."
|
|
|
|
@cp -r make $(HARBORPKG)
|
|
|
|
@if [ -n "$(REGISTRYSERVER)" ] ; then \
|
2020-02-06 03:58:29 +01:00
|
|
|
$(SEDCMDI) -e 's/image\: goharbor/image\: $(REGISTRYSERVER)\/$(REGISTRYPROJECTNAME)/' \
|
2017-03-23 05:36:36 +01:00
|
|
|
$(HARBORPKG)/docker-compose.yml ; \
|
|
|
|
fi
|
|
|
|
@cp LICENSE $(HARBORPKG)/LICENSE
|
2019-03-18 08:07:19 +01:00
|
|
|
|
2017-06-13 11:13:24 +02:00
|
|
|
@$(TARCMD) $(PACKAGE_ONLINE_PARA)
|
2017-03-23 05:36:36 +01:00
|
|
|
@rm -rf $(HARBORPKG)
|
|
|
|
@echo "Done."
|
2019-03-18 08:07:19 +01:00
|
|
|
|
2020-02-06 03:58:29 +01:00
|
|
|
package_offline: update_prepare_version compile build
|
2019-03-18 08:07:19 +01:00
|
|
|
|
2017-03-23 05:36:36 +01:00
|
|
|
@echo "packing offline package ..."
|
|
|
|
@cp -r make $(HARBORPKG)
|
|
|
|
@cp LICENSE $(HARBORPKG)/LICENSE
|
|
|
|
|
2017-06-13 11:13:24 +02:00
|
|
|
@echo "saving harbor docker image"
|
2017-11-01 11:09:45 +01:00
|
|
|
@$(DOCKERSAVE) $(DOCKERSAVE_PARA) > $(HARBORPKG)/$(DOCKERIMGFILE).$(VERSIONTAG).tar
|
|
|
|
@gzip $(HARBORPKG)/$(DOCKERIMGFILE).$(VERSIONTAG).tar
|
2017-06-13 11:13:24 +02:00
|
|
|
|
|
|
|
@$(TARCMD) $(PACKAGE_OFFLINE_PARA)
|
2017-03-23 05:36:36 +01:00
|
|
|
@rm -rf $(HARBORPKG)
|
|
|
|
@echo "Done."
|
2017-06-13 11:13:24 +02:00
|
|
|
|
2018-08-06 07:56:22 +02:00
|
|
|
gosec:
|
|
|
|
#go get github.com/securego/gosec/cmd/gosec
|
|
|
|
#go get github.com/dghubble/sling
|
|
|
|
@echo "run secure go scan ..."
|
|
|
|
@if [ "$(GOSECRESULTS)" != "" ] ; then \
|
|
|
|
$(GOPATH)/bin/gosec -fmt=json -out=$(GOSECRESULTS) -quiet ./... | true ; \
|
|
|
|
else \
|
|
|
|
$(GOPATH)/bin/gosec -fmt=json -out=harbor_gas_output.json -quiet ./... | true ; \
|
|
|
|
fi
|
|
|
|
|
2020-07-22 03:59:32 +02:00
|
|
|
go_check: gen_apis mocks_check misspell gofmt commentfmt golint govet
|
2018-08-24 07:30:07 +02:00
|
|
|
|
|
|
|
gofmt:
|
|
|
|
@echo checking gofmt...
|
|
|
|
@res=$$(gofmt -d -e -s $$(find . -type d \( -path ./src/vendor -o -path ./tests \) -prune -o -name '*.go' -print)); \
|
|
|
|
if [ -n "$${res}" ]; then \
|
|
|
|
echo checking gofmt fail... ; \
|
|
|
|
echo "$${res}"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
|
2018-09-20 05:48:38 +02:00
|
|
|
commentfmt:
|
|
|
|
@echo checking comment format...
|
2020-02-28 18:15:27 +01:00
|
|
|
@res=$$(find . -type d \( -path ./src/vendor -o -path ./tests \) -prune -o -name '*.go' -print | xargs egrep '(^|\s)\/\/(\S)'|grep -v '//go:generate'); \
|
2018-09-20 05:48:38 +02:00
|
|
|
if [ -n "$${res}" ]; then \
|
|
|
|
echo checking comment format fail.. ; \
|
|
|
|
echo missing whitespace between // and comment body;\
|
|
|
|
echo "$${res}"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
|
2018-08-24 07:30:07 +02:00
|
|
|
misspell:
|
|
|
|
@echo checking misspell...
|
|
|
|
@find . -type d \( -path ./src/vendor -o -path ./tests \) -prune -o -name '*.go' -print | xargs misspell -error
|
|
|
|
|
|
|
|
golint:
|
|
|
|
@echo checking golint...
|
2020-03-12 04:03:24 +01:00
|
|
|
@go list ./... | grep -v -E 'vendor|test' | xargs fgt golint
|
2018-08-24 07:30:07 +02:00
|
|
|
|
|
|
|
govet:
|
|
|
|
@echo checking govet...
|
2020-03-12 04:03:24 +01:00
|
|
|
@cd src;go list ./... | grep -v -E 'vendor|test' | xargs go vet
|
2018-08-24 07:30:07 +02:00
|
|
|
|
2017-03-23 05:36:36 +01:00
|
|
|
pushimage:
|
|
|
|
@echo "pushing harbor images ..."
|
2019-03-18 08:07:19 +01:00
|
|
|
@$(DOCKERTAG) $(DOCKER_IMAGE_NAME_PREPARE):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKER_IMAGE_NAME_PREPARE):$(VERSIONTAG)
|
|
|
|
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKER_IMAGE_NAME_PREPARE):$(VERSIONTAG) \
|
|
|
|
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
|
|
|
|
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKER_IMAGE_NAME_PREPARE):$(VERSIONTAG)
|
|
|
|
|
2018-09-05 09:48:16 +02:00
|
|
|
@$(DOCKERTAG) $(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG)
|
|
|
|
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) \
|
|
|
|
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
|
|
|
|
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG)
|
|
|
|
|
2018-09-12 08:38:29 +02:00
|
|
|
@$(DOCKERTAG) $(DOCKERIMAGENAME_CORE):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_CORE):$(VERSIONTAG)
|
|
|
|
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_CORE):$(VERSIONTAG) \
|
2017-03-23 05:36:36 +01:00
|
|
|
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
|
2018-09-12 08:38:29 +02:00
|
|
|
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_CORE):$(VERSIONTAG)
|
2017-06-13 11:13:24 +02:00
|
|
|
|
2017-03-23 05:36:36 +01:00
|
|
|
@$(DOCKERTAG) $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG)
|
|
|
|
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) \
|
|
|
|
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
|
|
|
|
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG)
|
2017-06-13 11:13:24 +02:00
|
|
|
|
2017-03-23 05:36:36 +01:00
|
|
|
@$(DOCKERTAG) $(DOCKERIMAGENAME_LOG):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_LOG):$(VERSIONTAG)
|
|
|
|
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_LOG):$(VERSIONTAG) \
|
|
|
|
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
|
|
|
|
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_LOG):$(VERSIONTAG)
|
2017-06-13 11:13:24 +02:00
|
|
|
|
2017-03-23 05:36:36 +01:00
|
|
|
@$(DOCKERTAG) $(DOCKERIMAGENAME_DB):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_DB):$(VERSIONTAG)
|
|
|
|
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_DB):$(VERSIONTAG) \
|
|
|
|
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
|
|
|
|
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_DB):$(VERSIONTAG)
|
2017-06-13 11:13:24 +02:00
|
|
|
|
2017-03-23 05:36:36 +01:00
|
|
|
start:
|
|
|
|
@echo "loading harbor images..."
|
2019-08-01 10:02:08 +02:00
|
|
|
@$(DOCKERCOMPOSECMD) $(DOCKERCOMPOSE_FILE_OPT) up -d
|
2017-03-23 05:36:36 +01:00
|
|
|
@echo "Start complete. You can visit harbor now."
|
2017-06-13 11:13:24 +02:00
|
|
|
|
2017-03-23 05:36:36 +01:00
|
|
|
down:
|
|
|
|
@while [ -z "$$CONTINUE" ]; do \
|
|
|
|
read -r -p "Type anything but Y or y to exit. [Y/N]: " CONTINUE; \
|
|
|
|
done ; \
|
|
|
|
[ $$CONTINUE = "y" ] || [ $$CONTINUE = "Y" ] || (echo "Exiting."; exit 1;)
|
|
|
|
@echo "stoping harbor instance..."
|
2019-08-01 10:02:08 +02:00
|
|
|
@$(DOCKERCOMPOSECMD) $(DOCKERCOMPOSE_FILE_OPT) down -v
|
2017-03-23 05:36:36 +01:00
|
|
|
@echo "Done."
|
|
|
|
|
2018-08-01 00:38:23 +02:00
|
|
|
swagger_client:
|
|
|
|
@echo "Generate swagger client"
|
2020-08-17 08:51:18 +02:00
|
|
|
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.1/openapi-generator-cli-4.3.1.jar -O openapi-generator-cli.jar
|
2018-08-01 00:38:23 +02:00
|
|
|
rm -rf harborclient
|
2020-04-02 09:30:09 +02:00
|
|
|
mkdir -p harborclient/harbor_client
|
2020-02-14 09:11:38 +01:00
|
|
|
mkdir -p harborclient/harbor_swagger_client
|
|
|
|
mkdir -p harborclient/harbor_v2_swagger_client
|
2020-08-17 08:51:18 +02:00
|
|
|
java -jar openapi-generator-cli.jar generate -i api/swagger.yaml -g python -o harborclient/harbor_client --package-name client
|
|
|
|
java -jar openapi-generator-cli.jar generate -i api/v2.0/legacy_swagger.yaml -g python -o harborclient/harbor_swagger_client --package-name swagger_client
|
|
|
|
java -jar openapi-generator-cli.jar generate -i api/v2.0/swagger.yaml -g python -o harborclient/harbor_v2_swagger_client --package-name v2_swagger_client
|
2020-04-02 09:30:09 +02:00
|
|
|
cd harborclient/harbor_client; python ./setup.py install
|
2020-02-14 09:11:38 +01:00
|
|
|
cd harborclient/harbor_swagger_client; python ./setup.py install
|
|
|
|
cd harborclient/harbor_v2_swagger_client; python ./setup.py install
|
2019-10-10 09:29:50 +02:00
|
|
|
pip install docker -q
|
2018-08-01 00:38:23 +02:00
|
|
|
pip freeze
|
|
|
|
|
2017-03-23 05:36:36 +01:00
|
|
|
cleanbinary:
|
|
|
|
@echo "cleaning binary..."
|
2019-11-28 12:57:49 +01:00
|
|
|
if [ -f $(CORE_BINARYPATH)/$(CORE_BINARYNAME) ] ; then rm $(CORE_BINARYPATH)/$(CORE_BINARYNAME) ; fi
|
|
|
|
if [ -f $(JOBSERVICEBINARYPATH)/$(JOBSERVICEBINARYNAME) ] ; then rm $(JOBSERVICEBINARYPATH)/$(JOBSERVICEBINARYNAME) ; fi
|
|
|
|
if [ -f $(REGISTRYCTLBINARYPATH)/$(REGISTRYCTLBINARYNAME) ] ; then rm $(REGISTRYCTLBINARYPATH)/$(REGISTRYCTLBINARYNAME) ; fi
|
|
|
|
if [ -f $(MIGRATEPATCHBINARYPATH)/$(MIGRATEPATCHBINARYNAME) ] ; then rm $(MIGRATEPATCHBINARYPATH)/$(MIGRATEPATCHBINARYNAME) ; fi
|
|
|
|
rm -rf make/photon/*/binary/
|
|
|
|
|
2017-03-23 05:36:36 +01:00
|
|
|
|
|
|
|
cleanimage:
|
|
|
|
@echo "cleaning image for photon..."
|
2018-09-12 08:38:29 +02:00
|
|
|
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_CORE):$(VERSIONTAG)
|
2017-03-23 05:36:36 +01:00
|
|
|
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_DB):$(VERSIONTAG)
|
|
|
|
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG)
|
|
|
|
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_LOG):$(VERSIONTAG)
|
|
|
|
|
|
|
|
cleandockercomposefile:
|
2018-09-25 09:12:43 +02:00
|
|
|
@echo "cleaning docker-compose files in $(DOCKERCOMPOSEFILEPATH)"
|
|
|
|
@find $(DOCKERCOMPOSEFILEPATH) -maxdepth 1 -name "docker-compose*.yml" -exec rm -f {} \;
|
|
|
|
@find $(DOCKERCOMPOSEFILEPATH) -maxdepth 1 -name "docker-compose*.yml-e" -exec rm -f {} \;
|
2017-03-23 05:36:36 +01:00
|
|
|
|
|
|
|
cleanpackage:
|
|
|
|
@echo "cleaning harbor install package"
|
|
|
|
@if [ -d $(BUILDPATH)/harbor ] ; then rm -rf $(BUILDPATH)/harbor ; fi
|
2018-01-22 09:43:00 +01:00
|
|
|
@if [ -f $(BUILDPATH)/harbor-online-installer-$(VERSIONTAG).tgz ] ; \
|
|
|
|
then rm $(BUILDPATH)/harbor-online-installer-$(VERSIONTAG).tgz ; fi
|
|
|
|
@if [ -f $(BUILDPATH)/harbor-offline-installer-$(VERSIONTAG).tgz ] ; \
|
|
|
|
then rm $(BUILDPATH)/harbor-offline-installer-$(VERSIONTAG).tgz ; fi
|
2017-03-23 05:36:36 +01:00
|
|
|
|
2019-11-28 12:57:49 +01:00
|
|
|
cleanconfig:
|
|
|
|
@echo "clean generated config files"
|
|
|
|
rm -f $(BUILDPATH)/make/photon/prepare/versions
|
|
|
|
rm -f $(BUILDPATH)/UIVERSION
|
|
|
|
rm -rf $(BUILDPATH)/make/common
|
|
|
|
rm -rf $(BUILDPATH)/harborclient
|
|
|
|
rm -rf $(BUILDPATH)/src/portal/dist
|
|
|
|
rm -rf $(BUILDPATH)/src/portal/lib/dist
|
|
|
|
rm -f $(BUILDPATH)/src/portal/proxy.config.json
|
|
|
|
|
2017-03-23 05:36:36 +01:00
|
|
|
.PHONY: cleanall
|
2019-11-28 12:57:49 +01:00
|
|
|
cleanall: cleanbinary cleanimage cleandockercomposefile cleanconfig cleanpackage
|
2017-03-23 05:36:36 +01:00
|
|
|
|
2017-06-13 11:13:24 +02:00
|
|
|
clean:
|
2017-03-23 05:36:36 +01:00
|
|
|
@echo " make cleanall: remove binary, Harbor images, specific version docker-compose"
|
|
|
|
@echo " file, specific version tag, online and offline install package"
|
2018-09-12 08:38:29 +02:00
|
|
|
@echo " make cleanbinary: remove core and jobservice binary"
|
2017-03-23 05:36:36 +01:00
|
|
|
@echo " make cleanimage: remove Harbor images"
|
|
|
|
@echo " make cleandockercomposefile: remove specific version docker-compose"
|
|
|
|
@echo " make cleanpackage: remove online and offline install package"
|
|
|
|
|
|
|
|
all: install
|