diff --git a/Makefile b/Makefile index 3bfa7d72c..6d7a7af82 100644 --- a/Makefile +++ b/Makefile @@ -79,8 +79,6 @@ DEVFLAG=true NOTARYFLAG=false CLAIRFLAG=false HTTPPROXY= -REBUILDCLARITYFLAG=false -NEWCLARITYVERSION= BUILDBIN=false MIGRATORFLAG=false # enable/disable chart repo supporting @@ -104,15 +102,10 @@ CLAIRVERSION=v2.0.5 CLAIRDBVERSION=$(VERSIONTAG) MIGRATORVERSION=$(VERSIONTAG) REDISVERSION=$(VERSIONTAG) + # version of chartmuseum CHARTMUSEUMVERSION=v0.7.1 -#clarity parameters -CLARITYIMAGE=goharbor/harbor-clarity-ui-builder[:tag] -CLARITYSEEDPATH=/harbor_src -CLARITYUTPATH=${CLARITYSEEDPATH}/portal/lib -CLARITYBUILDSCRIPT=/entrypoint.sh - # docker parameters DOCKERCMD=$(shell which docker) DOCKERBUILD=$(DOCKERCMD) build @@ -179,7 +172,6 @@ MAKEFILEPATH_PHOTON=$(MAKEPATH)/photon # common dockerfile DOCKERFILEPATH_COMMON=$(MAKEPATH)/common -DOCKERFILE_CLARITY=$(MAKEPATH)/dev/nodeclarity/Dockerfile # docker image name DOCKERIMAGENAME_ADMINSERVER=goharbor/harbor-adminserver @@ -188,7 +180,6 @@ DOCKERIMAGENAME_UI=goharbor/harbor-ui DOCKERIMAGENAME_JOBSERVICE=goharbor/harbor-jobservice DOCKERIMAGENAME_LOG=goharbor/harbor-log DOCKERIMAGENAME_DB=goharbor/harbor-db -DOCKERIMAGENAME_CLARITY=goharbor/harbor-clarity-ui-builder DOCKERIMAGENAME_CHART_SERVER=goharbor/chartmuseum-photon DOCKERIMAGENAME_REGCTL=goharbor/harbor-registryctl @@ -273,15 +264,6 @@ version: check_environment: @$(MAKEPATH)/$(CHECKENVCMD) -compile_clarity: - @echo "compiling binary for clarity ui..." - @if [ "$(HTTPPROXY)" != "" ] ; then \ - $(DOCKERCMD) run --rm -v $(BUILDPATH)/src:$(CLARITYSEEDPATH) $(CLARITYIMAGE) $(SHELL) $(CLARITYBUILDSCRIPT) -p $(HTTPPROXY); \ - else \ - $(DOCKERCMD) run --rm -v $(BUILDPATH)/src:$(CLARITYSEEDPATH) $(CLARITYIMAGE) $(SHELL) $(CLARITYBUILDSCRIPT); \ - fi - @echo "Done." - compile_adminserver: @echo "compiling binary for adminserver (golang image)..." @echo $(GOBASEPATH) @@ -384,28 +366,6 @@ package_offline: compile version build modify_sourcefiles modify_composefile @rm -rf $(HARBORPKG) @echo "Done." -refresh_clarity_builder: - @if [ "$(REBUILDCLIATRYFLAG)" = "true" ] ; then \ - echo "set http proxy.."; \ - if [ "$(HTTPPROXY)" != "" ] ; then \ - $(SEDCMD) -i 's/__proxy__/--proxy $(HTTPPROXY)/g' $(DOCKERFILE_CLARITY) ; \ - else \ - $(SEDCMD) -i 's/__proxy__/ /g' $(DOCKERFILE_CLARITY) ; \ - fi ; \ - echo "build new clarity image.."; \ - $(DOCKERBUILD) -f $(DOCKERFILE_CLARITY) -t $(DOCKERIMAGENAME_CLARITY):$(NEWCLARITYVERSION) . ; \ - echo "push clarity image.."; \ - $(DOCKERTAG) $(DOCKERIMAGENAME_CLARITY):$(NEWCLARITYVERSION) $(DOCKERIMAGENAME_CLARITY):$(NEWCLARITYVERSION); \ - $(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_CLARITY):$(NEWCLARITYVERSION) \ - $(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER); \ - echo "remove local clarity image.."; \ - $(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_ADMINSERVER):$(NEWCLARITYVERSION); \ - fi - -run_clarity_ut: - @echo "run clarity ut ..." - @$(DOCKERCMD) run --rm -v $(UINGPATH):$(CLARITYSEEDPATH) -v $(BUILDPATH)/tests:$(CLARITYSEEDPATH)/tests $(CLARITYIMAGE) $(SHELL) $(CLARITYSEEDPATH)/tests/run-clarity-ut.sh - gosec: #go get github.com/securego/gosec/cmd/gosec #go get github.com/dghubble/sling diff --git a/docs/compile_guide.md b/docs/compile_guide.md index 1453e0b7b..51d84dedc 100644 --- a/docs/compile_guide.md +++ b/docs/compile_guide.md @@ -50,19 +50,19 @@ You can compile the code by one of the three approaches: * Build, install and bring up Harbor without Notary: ```sh - $ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 + $ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage ``` * Build, install and bring up Harbor with Notary: ```sh - $ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 NOTARYFLAG=true + $ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage NOTARYFLAG=true ``` * Build, install and bring up Harbor with Clair: ```sh - $ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 CLAIRFLAG=true + $ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage CLAIRFLAG=true ``` #### II. Compile code with your own Golang environment, then build Harbor @@ -108,7 +108,6 @@ The `Makefile` contains these configurable parameters: Variable | Description -------------------|------------- BASEIMAGE | Container base image, default: photon -CLARITYIMAGE | Clarity UI builder image, default: harbor-clarity-ui-builder DEVFLAG | Build model flag, default: dev COMPILETAG | Compile model flag, default: compile_normal (local golang build) NOTARYFLAG | Notary mode flag, default: false @@ -128,9 +127,9 @@ Target | Description all | prepare env, compile binaries, build images and install images prepare | prepare env compile | compile ui and jobservice code +compile_portal | compile portal code compile_ui | compile ui binary compile_jobservice | compile jobservice binary -compile_clarity | compile Clarity binary build | build Harbor docker images (default: using build_photon) build_photon | build Harbor docker images from Photon OS base image install | compile binaries, build images, prepare specific version of compose file and startup Harbor instance diff --git a/docs/use_make.md b/docs/use_make.md index 5b576b1a0..887598181 100644 --- a/docs/use_make.md +++ b/docs/use_make.md @@ -5,20 +5,18 @@ BASEIMAGE | Container base image, default: photon DEVFLAG | Build model flag, default: dev COMPILETAG | Compile model flag, default: compile_normal (local golang build) GOBUILDIMAGE | Golang image to compile harbor go source code. -CLARITYIMAGE | Clarity image that based on Node to compile UI. NOTARYFLAG | Whether to enable notary in harbor, default:false HTTPPROXY | Clarity proxy to build UI. - ### Targets Target | Description --------------------|------------- all | prepare env, compile binaries, build images and install images prepare | prepare env compile | compile ui and jobservice code +compile_portal | compile portal code compile_ui | compile ui binary compile_jobservice | compile jobservice binary -compile_clarity | compile clarity ui binary compile_adminserver | compile admin server binary build | build Harbor docker images (default: using build_photon) build_photon | build Harbor docker images from Photon OS base image @@ -39,10 +37,10 @@ version | set harbor version #### EXAMPLE: #### Build and run harbor from source code. -make install GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 NOTARYFLAG=true HTTPPROXY= +make install GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage NOTARYFLAG=true ### Package offline installer -make package_offline GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 NOTARYFLAG=true HTTPPROXY= +make package_offline GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage NOTARYFLAG=true ### Start harbor with notary make -e NOTARYFLAG=true start diff --git a/make/dev/nodeclarity/Dockerfile b/make/dev/nodeclarity/Dockerfile deleted file mode 100644 index c2f395b9d..000000000 --- a/make/dev/nodeclarity/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -FROM node:10.7.0 - -RUN mkdir -p /harbor_resources -RUN mkdir -p /harbor_src - -COPY src/portal/package.json /harbor_resources -COPY make/dev/nodeclarity/entrypoint.sh / - -# Install Chrome -RUN apt-get update && apt-get install -y \ - apt-transport-https \ - ca-certificates \ - curl \ - gnupg \ - hicolor-icon-theme \ - libcanberra-gtk* \ - libgl1-mesa-dri \ - libgl1-mesa-glx \ - libpango1.0-0 \ - libpulse0 \ - libv4l-0 \ - --no-install-recommends -RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install -RUN rm google-chrome-stable_current_amd64.deb - -# Install npm package -WORKDIR /harbor_resources - -RUN npm __proxy__ install && \ - chmod u+x /entrypoint.sh -VOLUME ["/harbor_src"] diff --git a/make/dev/nodeclarity/angular-cli.json b/make/dev/nodeclarity/angular-cli.json deleted file mode 100644 index 96a2529e9..000000000 --- a/make/dev/nodeclarity/angular-cli.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "project": { - "version": "1.6.0", - "name": "Harbor" - }, - "apps": [{ - "root": "src", - "outDir": "dist", - "assets": [ - "images", - "favicon.ico" - ], - "index": "index.html", - "main": "main.ts", - "test": "test.ts", - "tsconfig": "tsconfig.json", - "prefix": "app", - "mobile": false, - "styles": [ - "../node_modules/prismjs/themes/prism-solarizedlight.css", - "../node_modules/@clr/icons/clr-icons.min.css", - "../node_modules/@clr/ui/clr-ui.min.css", - "styles.css" - ], - "scripts": [ - "../node_modules/core-js/client/shim.min.js", - "../node_modules/mutationobserver-shim/dist/mutationobserver.min.js", - "../node_modules/@webcomponents/custom-elements/custom-elements.min.js", - "../node_modules/web-animations-js/web-animations.min.js", - "../node_modules/marked/lib/marked.js", - "../node_modules/prismjs/prism.js", - "../node_modules/prismjs/components/prism-yaml.min.js", - "../node_modules/@clr/icons/clr-icons.min.js", - "../node_modules/web-animations-js/web-animations.min.js" - ], - "environmentSource": "environments/environment.ts", - "environments": { - "dev": "environments/environment.ts", - "prod": "environments/environment.prod.ts" - } - }], - "addons": [], - "packages": [], - "e2e": { - "protractor": { - "config": "./protractor.config.js" - } - }, - "test": { - "karma": { - "config": "./karma.conf.js" - } - }, - "defaults": { - "styleExt": "scss", - "prefixInterfaces": false, - "inline": { - "style": false, - "template": false - }, - "spec": { - "class": false, - "component": true, - "directive": true, - "module": false, - "pipe": true, - "service": true - } - } -} \ No newline at end of file diff --git a/make/dev/nodeclarity/entrypoint.sh b/make/dev/nodeclarity/entrypoint.sh deleted file mode 100644 index 981d590cb..000000000 --- a/make/dev/nodeclarity/entrypoint.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -set -e - -cd /harbor_src/portal -rm -rf dist/* - -npm_proxy= - -while getopts p: option -do - case "${option}" - in - p) npm_proxy=${OPTARG};; - esac -done - -if [ ! -z "$npm_proxy" -a "$npm_proxy" != " " ]; then - npm config set proxy $npm_proxy -fi - -#Check if node_modules directory existing -if [ ! -d "./node_modules" ]; then - mv /harbor_resources/node_modules ./ -fi - -cat ./package.json -npm install - -## Build harbor-ui and link it -rm -rf /harbor_src/portal/lib/dist -npm run build:lib -chmod -R +xr /harbor_src/portal/lib/dist -cd /harbor_src/portal/lib/dist -npm link -cd /harbor_src/portal -npm link harbor-ui - -## Rollup -./node_modules/.bin/ngc -p tsconfig-aot.json -sed -i 's/* as//g' src/app/shared/gauge/gauge.component.js -./node_modules/.bin/rollup -c rollup-config.js - -## Unlink -npm unlink harbor-ui - -#Copy built js to the static folder -cp ./dist/build.min.js ../ui/static/ - -cp -r ./src/i18n/ ../ui/static/ -cp ./src/styles.css ../ui/static/ -cp -r ./src/images/ ../ui/static/ -cp ./src/setting.json ../ui/static/ - -cp ./node_modules/clarity-icons/clarity-icons.min.css ../ui/static/ -cp ./node_modules/mutationobserver-shim/dist/mutationobserver.min.js ../ui/static/ -cp ./node_modules/@webcomponents/custom-elements/custom-elements.min.js ../ui/static/ -cp ./node_modules/clarity-icons/clarity-icons.min.js ../ui/static/ -cp ./node_modules/clarity-ui/clarity-ui.min.css ../ui/static/ -cp -r ./node_modules/clarity-icons/shapes/ ../ui/static/ - -cp ./node_modules/prismjs/themes/prism-solarizedlight.css ../ui/static/ -cp ./node_modules/marked/lib/marked.js ../ui/static/ -cp ./node_modules/prismjs/prism.js ../ui/static/ -cp ./node_modules/prismjs/components/prism-yaml.min.js ../ui/static/ \ No newline at end of file diff --git a/make/dev/nodeclarity/index.html b/make/dev/nodeclarity/index.html deleted file mode 100644 index 37df927a2..000000000 --- a/make/dev/nodeclarity/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - Clarity Seed App - - - - - -Loading... - - diff --git a/src/portal/src/main-aot.ts b/src/portal/src/main-aot.ts deleted file mode 100644 index c0167cb2d..000000000 --- a/src/portal/src/main-aot.ts +++ /dev/null @@ -1,14 +0,0 @@ -import './polyfills.ts'; - -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { enableProdMode } from '@angular/core'; -import { AppModule } from './app/app.module'; -import { environment } from './environments/environment'; - -if (environment.production) { - enableProdMode(); -} - -platformBrowserDynamic().bootstrapModule(AppModule) - .catch(err => console.log(err)); - diff --git a/src/portal/tsconfig.json b/src/portal/tsconfig.json index 5962122b4..fe7ff4d82 100644 --- a/src/portal/tsconfig.json +++ b/src/portal/tsconfig.json @@ -28,7 +28,6 @@ }, "files": [ "src/app/app.module.ts", - "src/main-aot.ts" ], "angularCompilerOptions": { "skipTemplateCodegen": true, diff --git a/tests/resources/Harbor-Util.robot b/tests/resources/Harbor-Util.robot index a5bec12e2..a47813994 100644 --- a/tests/resources/Harbor-Util.robot +++ b/tests/resources/Harbor-Util.robot @@ -55,21 +55,21 @@ Down Harbor Should Be Equal As Integers ${rc} 0 Package Harbor Offline - [Arguments] ${golang_image}=golang:${GOLANG_VERSION} ${clarity_image}=goharbor/harbor-clarity-ui-builder:${CLAIR_BUILDER} ${with_notary}=true ${with_clair}=true ${with_migrator}=false ${with_chartmuseum}=true + [Arguments] ${golang_image}=golang:${GOLANG_VERSION} ${with_notary}=true ${with_clair}=true ${with_migrator}=false ${with_chartmuseum}=true Log To Console \nStart Docker Daemon Start Docker Daemon Locally - Log To Console \n\nmake package_offline VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} UIVERSIONTAG=%{Harbor_UI_Version} GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage CLARITYIMAGE=${clarity_image} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} CHARTFLAG=${with_chartmuseum} HTTPPROXY= - ${rc} ${output}= Run And Return Rc And Output make package_offline VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} UIVERSIONTAG=%{Harbor_UI_Version} GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage CLARITYIMAGE=${clarity_image} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} CHARTFLAG=${with_chartmuseum} HTTPPROXY= + Log To Console \n\nmake package_offline VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} UIVERSIONTAG=%{Harbor_UI_Version} GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} CHARTFLAG=${with_chartmuseum} HTTPPROXY= + ${rc} ${output}= Run And Return Rc And Output make package_offline VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} UIVERSIONTAG=%{Harbor_UI_Version} GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} CHARTFLAG=${with_chartmuseum} HTTPPROXY= Log ${rc} Log ${output} Should Be Equal As Integers ${rc} 0 Package Harbor Online - [Arguments] ${golang_image}=golang:${GOLANG_VERSION} ${clarity_image}=goharbor/harbor-clarity-ui-builder:${CLAIR_BUILDER} ${with_notary}=true ${with_clair}=true ${with_migrator}=false ${with_chartmuseum}=true + [Arguments] ${golang_image}=golang:${GOLANG_VERSION} ${with_notary}=true ${with_clair}=true ${with_migrator}=false ${with_chartmuseum}=true Log To Console \nStart Docker Daemon Start Docker Daemon Locally - Log To Console \nmake package_online VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} UIVERSIONTAG=%{Harbor_UI_Version} GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage CLARITYIMAGE=${clarity_image} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} CHARTFLAG=${with_chartmuseum} HTTPPROXY= - ${rc} ${output}= Run And Return Rc And Output make package_online VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} UIVERSIONTAG=%{Harbor_UI_Version} GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage CLARITYIMAGE=${clarity_image} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} CHARTFLAG=${with_chartmuseum} HTTPPROXY= + Log To Console \nmake package_online VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} UIVERSIONTAG=%{Harbor_UI_Version} GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} CHARTFLAG=${with_chartmuseum} HTTPPROXY= + ${rc} ${output}= Run And Return Rc And Output make package_online VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} UIVERSIONTAG=%{Harbor_UI_Version} GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} CHARTFLAG=${with_chartmuseum} HTTPPROXY= Log ${rc} Log ${output} Should Be Equal As Integers ${rc} 0 @@ -150,14 +150,11 @@ Prepare Cert Should Be Equal As Integers ${rc} 0 Compile and Up Harbor With Source Code - [Arguments] ${golang_image}=golang:${GOLANG_VERSION} ${clarity_image}=goharbor/harbor-clarity-ui-builder:${CLAIR_BUILDER} ${with_notary}=true ${with_clair}=true ${with_chartmuseum}=true - ${rc} ${output}= Run And Return Rc And Output docker pull ${clarity_image} - Log ${output} - Should Be Equal As Integers ${rc} 0 + [Arguments] ${golang_image}=golang:${GOLANG_VERSION} ${with_notary}=true ${with_clair}=true ${with_chartmuseum}=true ${rc} ${output}= Run And Return Rc And Output docker pull ${golang_image} Log ${output} Should Be Equal As Integers ${rc} 0 - ${rc} ${output}= Run And Return Rc And Output make install swagger_client GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage CLARITYIMAGE=${clarity_image} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} CHARTFLAG=${with_chartmuseum} HTTPPROXY= + ${rc} ${output}= Run And Return Rc And Output make install swagger_client GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} CHARTFLAG=${with_chartmuseum} HTTPPROXY= Log ${output} Should Be Equal As Integers ${rc} 0 Sleep 20