mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 02:05:41 +01:00
clair integration
This commit is contained in:
parent
83be92f1f0
commit
02df58b4b6
224
Makefile
224
Makefile
@ -1,8 +1,8 @@
|
|||||||
# Makefile for Harbor project
|
# Makefile for Harbor project
|
||||||
#
|
#
|
||||||
# Targets:
|
# Targets:
|
||||||
#
|
#
|
||||||
# all: prepare env, compile binarys, build images and install images
|
# all: prepare env, compile binarys, build images and install images
|
||||||
# prepare: prepare env
|
# prepare: prepare env
|
||||||
# compile: compile adminserver, ui and jobservice code
|
# compile: compile adminserver, ui and jobservice code
|
||||||
#
|
#
|
||||||
@ -15,11 +15,11 @@
|
|||||||
# build: build Harbor docker images (defuault: build_photon)
|
# build: build Harbor docker images (defuault: build_photon)
|
||||||
# for example: make build -e BASEIMAGE=photon
|
# for example: make build -e BASEIMAGE=photon
|
||||||
# build_photon: build Harbor docker images from photon baseimage
|
# build_photon: build Harbor docker images from photon baseimage
|
||||||
#
|
#
|
||||||
# install: include compile binarys, build images, prepare specific \
|
# install: include compile binarys, build images, prepare specific \
|
||||||
# version composefile and startup Harbor instance
|
# version composefile and startup Harbor instance
|
||||||
#
|
#
|
||||||
# start: startup Harbor instance
|
# start: startup Harbor instance
|
||||||
#
|
#
|
||||||
# down: shutdown Harbor instance
|
# down: shutdown Harbor instance
|
||||||
#
|
#
|
||||||
@ -28,10 +28,10 @@
|
|||||||
# for example: make package_online -e DEVFLAG=false\
|
# for example: make package_online -e DEVFLAG=false\
|
||||||
# REGISTRYSERVER=reg-bj.eng.vmware.com \
|
# REGISTRYSERVER=reg-bj.eng.vmware.com \
|
||||||
# REGISTRYPROJECTNAME=harborrelease
|
# REGISTRYPROJECTNAME=harborrelease
|
||||||
#
|
#
|
||||||
# package_offline:
|
# package_offline:
|
||||||
# prepare offline install package
|
# prepare offline install package
|
||||||
#
|
#
|
||||||
# pushimage: push Harbor images to specific registry server
|
# pushimage: push Harbor images to specific registry server
|
||||||
# for example: make pushimage -e DEVFLAG=false REGISTRYUSER=admin \
|
# for example: make pushimage -e DEVFLAG=false REGISTRYUSER=admin \
|
||||||
# REGISTRYPASSWORD=***** \
|
# REGISTRYPASSWORD=***** \
|
||||||
@ -46,19 +46,19 @@
|
|||||||
# clean: remove binary, Harbor images, specific version docker-compose \
|
# clean: remove binary, Harbor images, specific version docker-compose \
|
||||||
# file, specific version tag and online/offline install package
|
# file, specific version tag and online/offline install package
|
||||||
# cleanbinary: remove adminserver, ui and jobservice binary
|
# cleanbinary: remove adminserver, ui and jobservice binary
|
||||||
# cleanimage: remove Harbor images
|
# cleanimage: remove Harbor images
|
||||||
# cleandockercomposefile:
|
# cleandockercomposefile:
|
||||||
# remove specific version docker-compose
|
# remove specific version docker-compose
|
||||||
# cleanversiontag:
|
# cleanversiontag:
|
||||||
# cleanpackageremove specific version tag
|
# cleanpackageremove specific version tag
|
||||||
# cleanpackage: remove online/offline install package
|
# cleanpackage: remove online/offline install package
|
||||||
#
|
#
|
||||||
# other example:
|
# other example:
|
||||||
# clean specific version binarys and images:
|
# clean specific version binarys and images:
|
||||||
# make clean -e VERSIONTAG=[TAG]
|
# make clean -e VERSIONTAG=[TAG]
|
||||||
# note**: If commit new code to github, the git commit TAG will \
|
# note**: If commit new code to github, the git commit TAG will \
|
||||||
# change. Better use this commond clean previous images and \
|
# change. Better use this commond clean previous images and \
|
||||||
# files with specific TAG.
|
# files with specific TAG.
|
||||||
# By default DEVFLAG=true, if you want to release new version of Harbor, \
|
# By default DEVFLAG=true, if you want to release new version of Harbor, \
|
||||||
# should setting the flag to false.
|
# should setting the flag to false.
|
||||||
# make XXXX -e DEVFLAG=false
|
# make XXXX -e DEVFLAG=false
|
||||||
@ -89,6 +89,11 @@ HTTPPROXY=
|
|||||||
REBUILDCLARITYFLAG=false
|
REBUILDCLARITYFLAG=false
|
||||||
NEWCLARITYVERSION=
|
NEWCLARITYVERSION=
|
||||||
|
|
||||||
|
#clair parameters
|
||||||
|
CLAIRVERSION=v2.0.0
|
||||||
|
CLAIRFLAG=false
|
||||||
|
CLAIRDBVERSION=latest
|
||||||
|
|
||||||
#clarity parameters
|
#clarity parameters
|
||||||
CLARITYIMAGE=vmware/harbor-clarity-ui-builder[:tag]
|
CLARITYIMAGE=vmware/harbor-clarity-ui-builder[:tag]
|
||||||
CLARITYSEEDPATH=/harbor_ui
|
CLARITYSEEDPATH=/harbor_ui
|
||||||
@ -125,7 +130,7 @@ GOBUILDMAKEPATH_UI=$(GOBUILDMAKEPATH)/dev/ui
|
|||||||
GOBUILDMAKEPATH_JOBSERVICE=$(GOBUILDMAKEPATH)/dev/jobservice
|
GOBUILDMAKEPATH_JOBSERVICE=$(GOBUILDMAKEPATH)/dev/jobservice
|
||||||
GOLANGDOCKERFILENAME=Dockerfile.golang
|
GOLANGDOCKERFILENAME=Dockerfile.golang
|
||||||
|
|
||||||
# binary
|
# binary
|
||||||
ADMINSERVERSOURCECODE=$(SRCPATH)/adminserver
|
ADMINSERVERSOURCECODE=$(SRCPATH)/adminserver
|
||||||
ADMINSERVERBINARYPATH=$(MAKEDEVPATH)/adminserver
|
ADMINSERVERBINARYPATH=$(MAKEDEVPATH)/adminserver
|
||||||
ADMINSERVERBINARYNAME=harbor_adminserver
|
ADMINSERVERBINARYNAME=harbor_adminserver
|
||||||
@ -136,14 +141,21 @@ JOBSERVICESOURCECODE=$(SRCPATH)/jobservice
|
|||||||
JOBSERVICEBINARYPATH=$(MAKEDEVPATH)/jobservice
|
JOBSERVICEBINARYPATH=$(MAKEDEVPATH)/jobservice
|
||||||
JOBSERVICEBINARYNAME=harbor_jobservice
|
JOBSERVICEBINARYNAME=harbor_jobservice
|
||||||
|
|
||||||
# prepare parameters
|
|
||||||
PREPAREPATH=$(TOOLSPATH)
|
|
||||||
PREPARECMD=prepare
|
|
||||||
|
|
||||||
# configfile
|
# configfile
|
||||||
CONFIGPATH=$(MAKEPATH)
|
CONFIGPATH=$(MAKEPATH)
|
||||||
CONFIGFILE=harbor.cfg
|
CONFIGFILE=harbor.cfg
|
||||||
|
|
||||||
|
# prepare parameters
|
||||||
|
PREPAREPATH=$(TOOLSPATH)
|
||||||
|
PREPARECMD=prepare
|
||||||
|
PREPARECMD_PARA=--conf $(CONFIGPATH)/$(CONFIGFILE)
|
||||||
|
ifeq ($(NOTARYFLAG), true)
|
||||||
|
PREPARECMD_PARA+= --with-notary
|
||||||
|
endif
|
||||||
|
ifeq ($(CLAIRFLAG), true)
|
||||||
|
PREPARECMD_PARA+= --with-clair
|
||||||
|
endif
|
||||||
|
|
||||||
# makefile
|
# makefile
|
||||||
MAKEFILEPATH_PHOTON=$(MAKEPATH)/photon
|
MAKEFILEPATH_PHOTON=$(MAKEPATH)/photon
|
||||||
|
|
||||||
@ -166,6 +178,7 @@ DOCKERCOMPOSEFILEPATH=$(MAKEPATH)
|
|||||||
DOCKERCOMPOSETPLFILENAME=docker-compose.tpl
|
DOCKERCOMPOSETPLFILENAME=docker-compose.tpl
|
||||||
DOCKERCOMPOSEFILENAME=docker-compose.yml
|
DOCKERCOMPOSEFILENAME=docker-compose.yml
|
||||||
DOCKERCOMPOSENOTARYFILENAME=docker-compose.notary.yml
|
DOCKERCOMPOSENOTARYFILENAME=docker-compose.notary.yml
|
||||||
|
DOCKERCOMPOSECLAIRFILENAME=docker-compose.clair.yml
|
||||||
|
|
||||||
# version prepare
|
# version prepare
|
||||||
VERSIONFILEPATH=$(CURDIR)
|
VERSIONFILEPATH=$(CURDIR)
|
||||||
@ -173,15 +186,15 @@ VERSIONFILENAME=VERSION
|
|||||||
GITCMD=$(shell which git)
|
GITCMD=$(shell which git)
|
||||||
GITTAG=$(GITCMD) describe --tags
|
GITTAG=$(GITCMD) describe --tags
|
||||||
GITTAGVERSION=$(shell git describe --tags || echo UNKNOWN)
|
GITTAGVERSION=$(shell git describe --tags || echo UNKNOWN)
|
||||||
ifeq ($(DEVFLAG), true)
|
ifeq ($(DEVFLAG), true)
|
||||||
VERSIONTAG=dev
|
VERSIONTAG=dev
|
||||||
else
|
else
|
||||||
VERSIONTAG=$(GITTAGVERSION)
|
VERSIONTAG=$(GITTAGVERSION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SEDCMD=$(shell which sed)
|
SEDCMD=$(shell which sed)
|
||||||
|
|
||||||
# package
|
# package
|
||||||
TARCMD=$(shell which tar)
|
TARCMD=$(shell which tar)
|
||||||
ZIPCMD=$(shell which gzip)
|
ZIPCMD=$(shell which gzip)
|
||||||
DOCKERIMGFILE=harbor
|
DOCKERIMGFILE=harbor
|
||||||
@ -193,9 +206,45 @@ PUSHSCRIPTNAME=pushimage.sh
|
|||||||
REGISTRYUSER=user
|
REGISTRYUSER=user
|
||||||
REGISTRYPASSWORD=default
|
REGISTRYPASSWORD=default
|
||||||
|
|
||||||
|
# cmds
|
||||||
|
DOCKERSAVE_PARA=$(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) \
|
||||||
|
$(DOCKERIMAGENAME_UI):$(VERSIONTAG) \
|
||||||
|
$(DOCKERIMAGENAME_LOG):$(VERSIONTAG) \
|
||||||
|
$(DOCKERIMAGENAME_DB):$(VERSIONTAG) \
|
||||||
|
$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) \
|
||||||
|
vmware/nginx:$(NGINXVERSION) vmware/registry:$(REGISTRYVERSION) \
|
||||||
|
photon:$(PHOTONVERSION)
|
||||||
|
PACKAGE_OFFLINE_PARA=-zcvf harbor-offline-installer-$(GITTAGVERSION).tgz \
|
||||||
|
$(HARBORPKG)/common/templates $(HARBORPKG)/$(DOCKERIMGFILE).$(VERSIONTAG).tar.gz \
|
||||||
|
$(HARBORPKG)/prepare $(HARBORPKG)/NOTICE \
|
||||||
|
$(HARBORPKG)/upgrade $(HARBORPKG)/harbor_1_1_0_template \
|
||||||
|
$(HARBORPKG)/LICENSE $(HARBORPKG)/install.sh \
|
||||||
|
$(HARBORPKG)/harbor.cfg $(HARBORPKG)/$(DOCKERCOMPOSEFILENAME)
|
||||||
|
PACKAGE_ONLINE_PARA=-zcvf harbor-online-installer-$(GITTAGVERSION).tgz \
|
||||||
|
$(HARBORPKG)/common/templates $(HARBORPKG)/prepare \
|
||||||
|
$(HARBORPKG)/LICENSE $(HARBORPKG)/NOTICE \
|
||||||
|
$(HARBORPKG)/upgrade $(HARBORPKG)/harbor_1_1_0_template \
|
||||||
|
$(HARBORPKG)/install.sh $(HARBORPKG)/$(DOCKERCOMPOSEFILENAME) \
|
||||||
|
$(HARBORPKG)/harbor.cfg
|
||||||
|
DOCKERCOMPOSE_LIST=-f $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSEFILENAME)
|
||||||
|
|
||||||
|
ifeq ($(NOTARYFLAG), true)
|
||||||
|
DOCKERSAVE_PARA+= vmware/notary-photon:$(NOTARYVERSION) vmware/notary-photon:$(NOTARYSIGNERVERSION) \
|
||||||
|
vmware/harbor-notary-db:$(MARIADBVERSION)
|
||||||
|
PACKAGE_OFFLINE_PARA+= $(HARBORPKG)/$(DOCKERCOMPOSENOTARYFILENAME)
|
||||||
|
PACKAGE_ONLINE_PARA+= $(HARBORPKG)/$(DOCKERCOMPOSENOTARYFILENAME)
|
||||||
|
DOCKERCOMPOSE_LIST+= -f $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSENOTARYFILENAME)
|
||||||
|
endif
|
||||||
|
ifeq ($(CLAIRFLAG), true)
|
||||||
|
DOCKERSAVE_PARA+= quay.io/coreos/clair:$(CLAIRVERSION) postgres:$(CLAIRDBVERSION)
|
||||||
|
PACKAGE_OFFLINE_PARA+= $(HARBORPKG)/$(DOCKERCOMPOSECLAIRFILENAME)
|
||||||
|
PACKAGE_ONLINE_PARA+= $(HARBORPKG)/$(DOCKERCOMPOSECLAIRFILENAME)
|
||||||
|
DOCKERCOMPOSE_LIST+= -f $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSECLAIRFILENAME)
|
||||||
|
endif
|
||||||
|
|
||||||
version:
|
version:
|
||||||
@printf $(GITTAGVERSION) > $(VERSIONFILEPATH)/$(VERSIONFILENAME);
|
@printf $(GITTAGVERSION) > $(VERSIONFILEPATH)/$(VERSIONFILENAME);
|
||||||
|
|
||||||
check_environment:
|
check_environment:
|
||||||
@$(MAKEPATH)/$(CHECKENVCMD)
|
@$(MAKEPATH)/$(CHECKENVCMD)
|
||||||
|
|
||||||
@ -208,12 +257,12 @@ compile_ui:
|
|||||||
@echo "compiling binary for ui..."
|
@echo "compiling binary for ui..."
|
||||||
@$(GOBUILD) -o $(UIBINARYPATH)/$(UIBINARYNAME) $(UISOURCECODE)
|
@$(GOBUILD) -o $(UIBINARYPATH)/$(UIBINARYNAME) $(UISOURCECODE)
|
||||||
@echo "Done."
|
@echo "Done."
|
||||||
|
|
||||||
compile_jobservice:
|
compile_jobservice:
|
||||||
@echo "compiling binary for jobservice..."
|
@echo "compiling binary for jobservice..."
|
||||||
@$(GOBUILD) -o $(JOBSERVICEBINARYPATH)/$(JOBSERVICEBINARYNAME) $(JOBSERVICESOURCECODE)
|
@$(GOBUILD) -o $(JOBSERVICEBINARYPATH)/$(JOBSERVICEBINARYNAME) $(JOBSERVICESOURCECODE)
|
||||||
@echo "Done."
|
@echo "Done."
|
||||||
|
|
||||||
compile_clarity:
|
compile_clarity:
|
||||||
@echo "compiling binary for clarity ui..."
|
@echo "compiling binary for clarity ui..."
|
||||||
@if [ "$(HTTPPROXY)" != "" ] ; then \
|
@if [ "$(HTTPPROXY)" != "" ] ; then \
|
||||||
@ -222,7 +271,7 @@ compile_clarity:
|
|||||||
$(DOCKERCMD) run --rm -v $(UIPATH)/static:$(CLARITYSEEDPATH)/dist -v $(UINGPATH)/src:$(CLARITYSEEDPATH)/src $(CLARITYIMAGE) $(SHELL) $(CLARITYBUILDSCRIPT); \
|
$(DOCKERCMD) run --rm -v $(UIPATH)/static:$(CLARITYSEEDPATH)/dist -v $(UINGPATH)/src:$(CLARITYSEEDPATH)/src $(CLARITYIMAGE) $(SHELL) $(CLARITYBUILDSCRIPT); \
|
||||||
fi
|
fi
|
||||||
@echo "Done."
|
@echo "Done."
|
||||||
|
|
||||||
compile_normal: compile_clarity compile_adminserver compile_ui compile_jobservice
|
compile_normal: compile_clarity compile_adminserver compile_ui compile_jobservice
|
||||||
|
|
||||||
compile_golangimage: compile_clarity
|
compile_golangimage: compile_clarity
|
||||||
@ -237,21 +286,17 @@ compile_golangimage: compile_clarity
|
|||||||
@echo $(GOBUILDPATH)
|
@echo $(GOBUILDPATH)
|
||||||
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATH) -w $(GOBUILDPATH_UI) $(GOBUILDIMAGE) $(GOIMAGEBUILD) -v -o $(GOBUILDMAKEPATH_UI)/$(UIBINARYNAME)
|
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATH) -w $(GOBUILDPATH_UI) $(GOBUILDIMAGE) $(GOIMAGEBUILD) -v -o $(GOBUILDMAKEPATH_UI)/$(UIBINARYNAME)
|
||||||
@echo "Done."
|
@echo "Done."
|
||||||
|
|
||||||
@echo "compiling binary for jobservice (golang image)..."
|
@echo "compiling binary for jobservice (golang image)..."
|
||||||
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATH) -w $(GOBUILDPATH_JOBSERVICE) $(GOBUILDIMAGE) $(GOIMAGEBUILD) -v -o $(GOBUILDMAKEPATH_JOBSERVICE)/$(JOBSERVICEBINARYNAME)
|
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATH) -w $(GOBUILDPATH_JOBSERVICE) $(GOBUILDIMAGE) $(GOIMAGEBUILD) -v -o $(GOBUILDMAKEPATH_JOBSERVICE)/$(JOBSERVICEBINARYNAME)
|
||||||
@echo "Done."
|
@echo "Done."
|
||||||
|
|
||||||
compile:check_environment $(COMPILETAG)
|
|
||||||
|
|
||||||
prepare:
|
compile:check_environment $(COMPILETAG)
|
||||||
@echo "preparing..."
|
|
||||||
@if [ "$(NOTARYFLAG)" = "true" ] ; then \
|
|
||||||
$(MAKEPATH)/$(PREPARECMD) --conf $(CONFIGPATH)/$(CONFIGFILE) --with-notary; \
|
|
||||||
else \
|
|
||||||
$(MAKEPATH)/$(PREPARECMD) --conf $(CONFIGPATH)/$(CONFIGFILE) ; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
prepare:
|
||||||
|
@echo "preparing..."
|
||||||
|
@$(MAKEPATH)/$(PREPARECMD) $(PREPARECMD_PARA)
|
||||||
|
|
||||||
build_common: version
|
build_common: version
|
||||||
@echo "buildging db container for photon..."
|
@echo "buildging db container for photon..."
|
||||||
@cd $(DOCKERFILEPATH_DB) && $(DOCKERBUILD) -f $(DOCKERFILENAME_DB) -t $(DOCKERIMAGENAME_DB):$(VERSIONTAG) .
|
@cd $(DOCKERFILEPATH_DB) && $(DOCKERBUILD) -f $(DOCKERFILENAME_DB) -t $(DOCKERIMAGENAME_DB):$(VERSIONTAG) .
|
||||||
@ -259,10 +304,10 @@ build_common: version
|
|||||||
|
|
||||||
build_photon: build_common
|
build_photon: build_common
|
||||||
make -f $(MAKEFILEPATH_PHOTON)/Makefile build -e DEVFLAG=$(DEVFLAG)
|
make -f $(MAKEFILEPATH_PHOTON)/Makefile build -e DEVFLAG=$(DEVFLAG)
|
||||||
|
|
||||||
build: build_$(BASEIMAGE)
|
build: build_$(BASEIMAGE)
|
||||||
|
|
||||||
modify_composefile:
|
modify_composefile:
|
||||||
@echo "preparing docker-compose file..."
|
@echo "preparing docker-compose file..."
|
||||||
@cp $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSETPLFILENAME) $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSEFILENAME)
|
@cp $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSETPLFILENAME) $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSEFILENAME)
|
||||||
@$(SEDCMD) -i 's/__version__/$(VERSIONTAG)/g' $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSEFILENAME)
|
@$(SEDCMD) -i 's/__version__/$(VERSIONTAG)/g' $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSEFILENAME)
|
||||||
@ -274,9 +319,9 @@ modify_sourcefiles:
|
|||||||
@chmod 600 $(MAKEPATH)/common/templates/notary/notary-signer-ca.crt
|
@chmod 600 $(MAKEPATH)/common/templates/notary/notary-signer-ca.crt
|
||||||
@chmod 600 $(MAKEPATH)/common/templates/ui/private_key.pem
|
@chmod 600 $(MAKEPATH)/common/templates/ui/private_key.pem
|
||||||
@chmod 600 $(MAKEPATH)/common/templates/registry/root.crt
|
@chmod 600 $(MAKEPATH)/common/templates/registry/root.crt
|
||||||
|
|
||||||
install: compile build modify_sourcefiles prepare modify_composefile start
|
install: compile build modify_sourcefiles prepare modify_composefile start
|
||||||
|
|
||||||
package_online: modify_composefile
|
package_online: modify_composefile
|
||||||
@echo "packing online package ..."
|
@echo "packing online package ..."
|
||||||
@cp -r make $(HARBORPKG)
|
@cp -r make $(HARBORPKG)
|
||||||
@ -289,34 +334,19 @@ package_online: modify_composefile
|
|||||||
@cp tools/migration/migration_cfg/upgrade $(HARBORPKG)/upgrade
|
@cp tools/migration/migration_cfg/upgrade $(HARBORPKG)/upgrade
|
||||||
@cp tools/migration/migration_cfg/harbor_1_1_0_template $(HARBORPKG)/harbor_1_1_0_template
|
@cp tools/migration/migration_cfg/harbor_1_1_0_template $(HARBORPKG)/harbor_1_1_0_template
|
||||||
|
|
||||||
@if [ "$(NOTARYFLAG)" = "true" ] ; then \
|
@$(TARCMD) $(PACKAGE_ONLINE_PARA)
|
||||||
$(TARCMD) -zcvf harbor-online-installer-$(GITTAGVERSION).tgz \
|
|
||||||
$(HARBORPKG)/common/templates $(HARBORPKG)/prepare \
|
|
||||||
$(HARBORPKG)/LICENSE $(HARBORPKG)/NOTICE \
|
|
||||||
$(HARBORPKG)/upgrade $(HARBORPKG)/harbor_1_1_0_template \
|
|
||||||
$(HARBORPKG)/install.sh $(HARBORPKG)/$(DOCKERCOMPOSEFILENAME) \
|
|
||||||
$(HARBORPKG)/harbor.cfg $(HARBORPKG)/$(DOCKERCOMPOSENOTARYFILENAME); \
|
|
||||||
else \
|
|
||||||
$(TARCMD) -zcvf harbor-online-installer-$(GITTAGVERSION).tgz \
|
|
||||||
$(HARBORPKG)/common/templates $(HARBORPKG)/prepare \
|
|
||||||
$(HARBORPKG)/LICENSE $(HARBORPKG)/NOTICE \
|
|
||||||
$(HARBORPKG)/upgrade $(HARBORPKG)/harbor_1_1_0_template \
|
|
||||||
$(HARBORPKG)/install.sh $(HARBORPKG)/$(DOCKERCOMPOSEFILENAME) \
|
|
||||||
$(HARBORPKG)/harbor.cfg ; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
@rm -rf $(HARBORPKG)
|
@rm -rf $(HARBORPKG)
|
||||||
@echo "Done."
|
@echo "Done."
|
||||||
|
|
||||||
package_offline: compile build modify_sourcefiles modify_composefile
|
package_offline: compile build modify_sourcefiles modify_composefile
|
||||||
@echo "packing offline package ..."
|
@echo "packing offline package ..."
|
||||||
@cp -r make $(HARBORPKG)
|
@cp -r make $(HARBORPKG)
|
||||||
|
|
||||||
@cp LICENSE $(HARBORPKG)/LICENSE
|
@cp LICENSE $(HARBORPKG)/LICENSE
|
||||||
@cp NOTICE $(HARBORPKG)/NOTICE
|
@cp NOTICE $(HARBORPKG)/NOTICE
|
||||||
@cp tools/migration/migration_cfg/upgrade $(HARBORPKG)/upgrade
|
@cp tools/migration/migration_cfg/upgrade $(HARBORPKG)/upgrade
|
||||||
@cp tools/migration/migration_cfg/harbor_1_1_0_template $(HARBORPKG)/harbor_1_1_0_template
|
@cp tools/migration/migration_cfg/harbor_1_1_0_template $(HARBORPKG)/harbor_1_1_0_template
|
||||||
|
|
||||||
@echo "pulling nginx and registry..."
|
@echo "pulling nginx and registry..."
|
||||||
@$(DOCKERPULL) vmware/registry:$(REGISTRYVERSION)
|
@$(DOCKERPULL) vmware/registry:$(REGISTRYVERSION)
|
||||||
@$(DOCKERPULL) vmware/nginx:$(NGINXVERSION)
|
@$(DOCKERPULL) vmware/nginx:$(NGINXVERSION)
|
||||||
@ -325,48 +355,20 @@ package_offline: compile build modify_sourcefiles modify_composefile
|
|||||||
$(DOCKERPULL) vmware/notary-photon:$(NOTARYVERSION); \
|
$(DOCKERPULL) vmware/notary-photon:$(NOTARYVERSION); \
|
||||||
$(DOCKERPULL) vmware/notary-photon:$(NOTARYSIGNERVERSION); \
|
$(DOCKERPULL) vmware/notary-photon:$(NOTARYSIGNERVERSION); \
|
||||||
$(DOCKERPULL) vmware/harbor-notary-db:$(MARIADBVERSION); \
|
$(DOCKERPULL) vmware/harbor-notary-db:$(MARIADBVERSION); \
|
||||||
fi
|
|
||||||
|
|
||||||
@echo "saving harbor docker image"
|
|
||||||
@if [ "$(NOTARYFLAG)" = "true" ] ; then \
|
|
||||||
$(DOCKERSAVE) $(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) \
|
|
||||||
$(DOCKERIMAGENAME_UI):$(VERSIONTAG) \
|
|
||||||
$(DOCKERIMAGENAME_LOG):$(VERSIONTAG) \
|
|
||||||
$(DOCKERIMAGENAME_DB):$(VERSIONTAG) \
|
|
||||||
$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) \
|
|
||||||
vmware/nginx:$(NGINXVERSION) vmware/registry:$(REGISTRYVERSION) photon:$(PHOTONVERSION) \
|
|
||||||
vmware/notary-photon:$(NOTARYVERSION) vmware/notary-photon:$(NOTARYSIGNERVERSION) \
|
|
||||||
vmware/harbor-notary-db:$(MARIADBVERSION) | gzip > $(HARBORPKG)/$(DOCKERIMGFILE).$(VERSIONTAG).tar.gz; \
|
|
||||||
else \
|
|
||||||
$(DOCKERSAVE) $(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) \
|
|
||||||
$(DOCKERIMAGENAME_UI):$(VERSIONTAG) \
|
|
||||||
$(DOCKERIMAGENAME_LOG):$(VERSIONTAG) \
|
|
||||||
$(DOCKERIMAGENAME_DB):$(VERSIONTAG) \
|
|
||||||
$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) \
|
|
||||||
vmware/nginx:$(NGINXVERSION) vmware/registry:$(REGISTRYVERSION) \
|
|
||||||
photon:$(PHOTONVERSION) | gzip > $(HARBORPKG)/$(DOCKERIMGFILE).$(VERSIONTAG).tar.gz; \
|
|
||||||
fi
|
fi
|
||||||
|
@if [ "$(CLAIRFLAG)" = "true" ] ; then \
|
||||||
@if [ "$(NOTARYFLAG)" = "true" ] ; then \
|
echo "pulling claiy and postgres..."; \
|
||||||
$(TARCMD) -zcvf harbor-offline-installer-$(GITTAGVERSION).tgz \
|
$(DOCKERPULL) quay.io/coreos/clair:$(CLAIRVERSION); \
|
||||||
$(HARBORPKG)/common/templates $(HARBORPKG)/$(DOCKERIMGFILE).$(VERSIONTAG).tar.gz \
|
$(DOCKERPULL) postgres:$(CLAIRDBVERSION); \
|
||||||
$(HARBORPKG)/prepare $(HARBORPKG)/NOTICE \
|
|
||||||
$(HARBORPKG)/LICENSE $(HARBORPKG)/install.sh \
|
|
||||||
$(HARBORPKG)/upgrade $(HARBORPKG)/harbor_1_1_0_template \
|
|
||||||
$(HARBORPKG)/harbor.cfg $(HARBORPKG)/$(DOCKERCOMPOSEFILENAME) \
|
|
||||||
$(HARBORPKG)/$(DOCKERCOMPOSENOTARYFILENAME) ; \
|
|
||||||
else \
|
|
||||||
$(TARCMD) -zcvf harbor-offline-installer-$(GITTAGVERSION).tgz \
|
|
||||||
$(HARBORPKG)/common/templates $(HARBORPKG)/$(DOCKERIMGFILE).$(VERSIONTAG).tar.gz \
|
|
||||||
$(HARBORPKG)/prepare $(HARBORPKG)/NOTICE \
|
|
||||||
$(HARBORPKG)/upgrade $(HARBORPKG)/harbor_1_1_0_template \
|
|
||||||
$(HARBORPKG)/LICENSE $(HARBORPKG)/install.sh \
|
|
||||||
$(HARBORPKG)/harbor.cfg $(HARBORPKG)/$(DOCKERCOMPOSEFILENAME) ; \
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@echo "saving harbor docker image"
|
||||||
|
@$(DOCKERSAVE) $(DOCKERSAVE_PARA) | gzip > $(HARBORPKG)/$(DOCKERIMGFILE).$(VERSIONTAG).tar.gz
|
||||||
|
|
||||||
|
@$(TARCMD) $(PACKAGE_OFFLINE_PARA)
|
||||||
@rm -rf $(HARBORPKG)
|
@rm -rf $(HARBORPKG)
|
||||||
@echo "Done."
|
@echo "Done."
|
||||||
|
|
||||||
refresh_clarity_builder:
|
refresh_clarity_builder:
|
||||||
@if [ "$(REBUILDCLIATRYFLAG)" = "true" ] ; then \
|
@if [ "$(REBUILDCLIATRYFLAG)" = "true" ] ; then \
|
||||||
echo "set http proxy.."; \
|
echo "set http proxy.."; \
|
||||||
@ -400,43 +402,35 @@ pushimage:
|
|||||||
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_UI):$(VERSIONTAG) \
|
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_UI):$(VERSIONTAG) \
|
||||||
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
|
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
|
||||||
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_UI):$(VERSIONTAG)
|
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_UI):$(VERSIONTAG)
|
||||||
|
|
||||||
@$(DOCKERTAG) $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG)
|
@$(DOCKERTAG) $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG)
|
||||||
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) \
|
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) \
|
||||||
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
|
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
|
||||||
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG)
|
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG)
|
||||||
|
|
||||||
@$(DOCKERTAG) $(DOCKERIMAGENAME_LOG):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_LOG):$(VERSIONTAG)
|
@$(DOCKERTAG) $(DOCKERIMAGENAME_LOG):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_LOG):$(VERSIONTAG)
|
||||||
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_LOG):$(VERSIONTAG) \
|
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_LOG):$(VERSIONTAG) \
|
||||||
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
|
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
|
||||||
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_LOG):$(VERSIONTAG)
|
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_LOG):$(VERSIONTAG)
|
||||||
|
|
||||||
@$(DOCKERTAG) $(DOCKERIMAGENAME_DB):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_DB):$(VERSIONTAG)
|
@$(DOCKERTAG) $(DOCKERIMAGENAME_DB):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_DB):$(VERSIONTAG)
|
||||||
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_DB):$(VERSIONTAG) \
|
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_DB):$(VERSIONTAG) \
|
||||||
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
|
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
|
||||||
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_DB):$(VERSIONTAG)
|
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_DB):$(VERSIONTAG)
|
||||||
|
|
||||||
start:
|
start:
|
||||||
@echo "loading harbor images..."
|
@echo "loading harbor images..."
|
||||||
@if [ "$(NOTARYFLAG)" = "true" ] ; then \
|
@$(DOCKERCOMPOSECMD) $(DOCKERCOMPOSE_LIST) up -d
|
||||||
$(DOCKERCOMPOSECMD) -f $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSEFILENAME) -f $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSENOTARYFILENAME) up -d ; \
|
|
||||||
else \
|
|
||||||
$(DOCKERCOMPOSECMD) -f $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSEFILENAME) up -d ; \
|
|
||||||
fi
|
|
||||||
@echo "Start complete. You can visit harbor now."
|
@echo "Start complete. You can visit harbor now."
|
||||||
|
|
||||||
down:
|
down:
|
||||||
@echo "Please make sure to set -e NOTARYFLAG=true if you are using Notary in Harbor, otherwise the Notary containers cannot be stop automaticlly."
|
@echo "Please make sure to set -e NOTARYFLAG=true/CLAIRFLAG=true if you are using Notary/CLAIR in Harbor, otherwise the Notary/CLAIR containers cannot be stop automaticlly."
|
||||||
@while [ -z "$$CONTINUE" ]; do \
|
@while [ -z "$$CONTINUE" ]; do \
|
||||||
read -r -p "Type anything but Y or y to exit. [Y/N]: " CONTINUE; \
|
read -r -p "Type anything but Y or y to exit. [Y/N]: " CONTINUE; \
|
||||||
done ; \
|
done ; \
|
||||||
[ $$CONTINUE = "y" ] || [ $$CONTINUE = "Y" ] || (echo "Exiting."; exit 1;)
|
[ $$CONTINUE = "y" ] || [ $$CONTINUE = "Y" ] || (echo "Exiting."; exit 1;)
|
||||||
@echo "stoping harbor instance..."
|
@echo "stoping harbor instance..."
|
||||||
@if [ "$(NOTARYFLAG)" = "true" ] ; then \
|
@$(DOCKERCOMPOSECMD) $(DOCKERCOMPOSE_LIST) down -v
|
||||||
$(DOCKERCOMPOSECMD) -f $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSEFILENAME) -f $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSENOTARYFILENAME) down -v ; \
|
|
||||||
else \
|
|
||||||
$(DOCKERCOMPOSECMD) -f $(DOCKERCOMPOSEFILEPATH)/$(DOCKERCOMPOSEFILENAME) down -v ; \
|
|
||||||
fi
|
|
||||||
@echo "Done."
|
@echo "Done."
|
||||||
|
|
||||||
cleanbinary:
|
cleanbinary:
|
||||||
@ -461,20 +455,20 @@ cleandockercomposefile:
|
|||||||
|
|
||||||
cleanversiontag:
|
cleanversiontag:
|
||||||
@echo "cleaning version TAG"
|
@echo "cleaning version TAG"
|
||||||
@rm -rf $(VERSIONFILEPATH)/$(VERSIONFILENAME)
|
@rm -rf $(VERSIONFILEPATH)/$(VERSIONFILENAME)
|
||||||
|
|
||||||
cleanpackage:
|
cleanpackage:
|
||||||
@echo "cleaning harbor install package"
|
@echo "cleaning harbor install package"
|
||||||
@if [ -d $(BUILDPATH)/harbor ] ; then rm -rf $(BUILDPATH)/harbor ; fi
|
@if [ -d $(BUILDPATH)/harbor ] ; then rm -rf $(BUILDPATH)/harbor ; fi
|
||||||
@if [ -f $(BUILDPATH)/harbor-online-installer-$(GITTAGVERSION).tgz ] ; \
|
@if [ -f $(BUILDPATH)/harbor-online-installer-$(GITTAGVERSION).tgz ] ; \
|
||||||
then rm $(BUILDPATH)/harbor-online-installer-$(GITTAGVERSION).tgz ; fi
|
then rm $(BUILDPATH)/harbor-online-installer-$(GITTAGVERSION).tgz ; fi
|
||||||
@if [ -f $(BUILDPATH)/harbor-offline-installer-$(GITTAGVERSION).tgz ] ; \
|
@if [ -f $(BUILDPATH)/harbor-offline-installer-$(GITTAGVERSION).tgz ] ; \
|
||||||
then rm $(BUILDPATH)/harbor-offline-installer-$(GITTAGVERSION).tgz ; fi
|
then rm $(BUILDPATH)/harbor-offline-installer-$(GITTAGVERSION).tgz ; fi
|
||||||
|
|
||||||
.PHONY: cleanall
|
.PHONY: cleanall
|
||||||
cleanall: cleanbinary cleanimage cleandockercomposefile cleanversiontag cleanpackage
|
cleanall: cleanbinary cleanimage cleandockercomposefile cleanversiontag cleanpackage
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo " make cleanall: remove binary, Harbor images, specific version docker-compose"
|
@echo " make cleanall: remove binary, Harbor images, specific version docker-compose"
|
||||||
@echo " file, specific version tag, online and offline install package"
|
@echo " file, specific version tag, online and offline install package"
|
||||||
@echo " make cleanbinary: remove ui and jobservice binary"
|
@echo " make cleanbinary: remove ui and jobservice binary"
|
||||||
|
@ -31,7 +31,7 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- harbor-clair
|
- harbor-clair
|
||||||
container_name: clair
|
container_name: clair
|
||||||
image: quay.io/coreos/clair:v2.0.0-rc.0
|
image: quay.io/coreos/clair:v2.0.0
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
|
@ -50,11 +50,14 @@ set -e
|
|||||||
set +o noglob
|
set +o noglob
|
||||||
|
|
||||||
usage=$'Please set hostname and other necessary attributes in harbor.cfg first. DO NOT use localhost or 127.0.0.1 for hostname, because Harbor needs to be accessed by external clients.
|
usage=$'Please set hostname and other necessary attributes in harbor.cfg first. DO NOT use localhost or 127.0.0.1 for hostname, because Harbor needs to be accessed by external clients.
|
||||||
Please set --with-notary if needs enable Notary in Harbor, and set ui_url_protocol/ssl_cert/ssl_cert_key in harbor.cfg bacause notary must run under https.'
|
Please set --with-notary if needs enable Notary in Harbor, and set ui_url_protocol/ssl_cert/ssl_cert_key in harbor.cfg bacause notary must run under https.
|
||||||
|
Please set --with-clair if needs enable Clair in Harbor'
|
||||||
item=0
|
item=0
|
||||||
|
|
||||||
# notary is not enabled by default
|
# notary is not enabled by default
|
||||||
with_notary=$false
|
with_notary=$false
|
||||||
|
# clair is not enabled by default
|
||||||
|
with_clair=$false
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
@ -62,7 +65,9 @@ while [ $# -gt 0 ]; do
|
|||||||
note "$usage"
|
note "$usage"
|
||||||
exit 0;;
|
exit 0;;
|
||||||
--with-notary)
|
--with-notary)
|
||||||
with_notary=true;;
|
with_notary=true;;
|
||||||
|
--with-clair)
|
||||||
|
with_clair=true;;
|
||||||
*)
|
*)
|
||||||
note "$usage"
|
note "$usage"
|
||||||
exit 1;;
|
exit 1;;
|
||||||
@ -152,38 +157,38 @@ if [ -n "$host" ]
|
|||||||
then
|
then
|
||||||
sed "s/^hostname = .*/hostname = $host/g" -i ./harbor.cfg
|
sed "s/^hostname = .*/hostname = $host/g" -i ./harbor.cfg
|
||||||
fi
|
fi
|
||||||
|
prepare_para=
|
||||||
if [ $with_notary ]
|
if [ $with_notary ]
|
||||||
then
|
then
|
||||||
./prepare --with-notary
|
prepare_para="${prepare_para} --with-notary"
|
||||||
else
|
|
||||||
./prepare
|
|
||||||
fi
|
fi
|
||||||
|
if [ $with_clair ]
|
||||||
|
then
|
||||||
|
prepare_para="${prepare_para} --with-clair"
|
||||||
|
fi
|
||||||
|
./prepare $prepare_para
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
h2 "[Step $item]: checking existing instance of Harbor ..."; let item+=1
|
h2 "[Step $item]: checking existing instance of Harbor ..."; let item+=1
|
||||||
|
docker_compose_list='-f docker-compose.yml'
|
||||||
if [ $with_notary ]
|
if [ $with_notary ]
|
||||||
then
|
then
|
||||||
if [ -n "$(docker-compose -f docker-compose.yml -f docker-compose.notary.yml ps -q)" ]
|
docker_compose_list="${docker_compose_list} -f docker-compose.notary.yml"
|
||||||
then
|
fi
|
||||||
note "stopping existing Harbor instance ..."
|
if [ $with_clair ]
|
||||||
docker-compose -f docker-compose.yml -f docker-compose.notary.yml down -v
|
then
|
||||||
fi
|
docker_compose_list="${docker_compose_list} -f docker-compose.clair.yml"
|
||||||
else
|
fi
|
||||||
if [ -n "$(docker-compose -f docker-compose.yml ps -q)" ]
|
|
||||||
then
|
if [ -n "$(docker-compose $docker_compose_list ps -q)" ]
|
||||||
note "stopping existing Harbor instance ..."
|
then
|
||||||
docker-compose -f docker-compose.yml down -v
|
note "stopping existing Harbor instance ..."
|
||||||
fi
|
docker-compose $docker_compose_list down -v
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
h2 "[Step $item]: starting Harbor ..."
|
h2 "[Step $item]: starting Harbor ..."
|
||||||
if [ $with_notary ]
|
docker-compose $docker_compose_list up -d
|
||||||
then
|
|
||||||
docker-compose -f docker-compose.yml -f docker-compose.notary.yml up -d
|
|
||||||
else
|
|
||||||
docker-compose -f docker-compose.yml up -d
|
|
||||||
fi
|
|
||||||
|
|
||||||
protocol=http
|
protocol=http
|
||||||
hostname=reg.mydomain.com
|
hostname=reg.mydomain.com
|
||||||
|
Loading…
Reference in New Issue
Block a user