From 1e66f8fa884c9c23097d7245173dad4d70a4a352 Mon Sep 17 00:00:00 2001 From: wy65701436 Date: Tue, 21 Mar 2017 00:51:14 -0700 Subject: [PATCH 01/14] update git ignore --- .gitignore | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 862a91fed..8e4ac65cd 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,15 @@ src/common/dao/dao.test *.pyc jobservice/test -src/ui/static/dist/ +src/ui/static/index.html +src/ui/static/inline.bundle.js +src/ui/static/inline.bundle.js.map +src/ui/static/main.bundle.js +src/ui/static/main.bundle.js.map +src/ui/static/scripts.bundle.js +src/ui/static/scripts.bundle.js.map +src/ui/static/vendor.bundle.js +src/ui/static/vendor.bundle.js.map src/ui_ng/coverage/ src/ui_ng/dist/ From 1d3a5bfd73b0bc73a992496d5dad62a8ce6cf799 Mon Sep 17 00:00:00 2001 From: wy65701436 Date: Tue, 21 Mar 2017 01:05:00 -0700 Subject: [PATCH 02/14] update git ignore file. --- .gitignore | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 8e4ac65cd..87860b72d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,15 +10,10 @@ src/common/dao/dao.test *.pyc jobservice/test -src/ui/static/index.html -src/ui/static/inline.bundle.js -src/ui/static/inline.bundle.js.map -src/ui/static/main.bundle.js -src/ui/static/main.bundle.js.map -src/ui/static/scripts.bundle.js -src/ui/static/scripts.bundle.js.map -src/ui/static/vendor.bundle.js -src/ui/static/vendor.bundle.js.map +src/ui/static/*.html +src/ui/static/*.bundle.js +src/ui/static/*.bundle.js.map +src/ui/static/harbor-log.*.png src/ui_ng/coverage/ src/ui_ng/dist/ From 6e09ae89e38351de1f3600c0725e7d99f855674b Mon Sep 17 00:00:00 2001 From: Tan Jiang Date: Tue, 21 Mar 2017 18:46:10 +0800 Subject: [PATCH 03/14] Use notary images based on photon, migrate db in notary's images --- Makefile | 8 +- .../notary/mysql-initdb.d/notary.sql | 210 ------------------ make/docker-compose.notary.yml | 10 +- 3 files changed, 8 insertions(+), 220 deletions(-) delete mode 100644 make/common/templates/notary/mysql-initdb.d/notary.sql diff --git a/Makefile b/Makefile index 24438977a..797cca15e 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,7 @@ NOTARYFLAG=false REGISTRYVERSION=2.6.0 NGINXVERSION=1.11.5 PHOTONVERSION=1.0 -NOTARYVERSION=server-0.5.0-fix +NOTARYVERSION=server-0.5.0 NOTARYSIGNERVERSION=signer-0.5.0 MARIADBVERSION=10.1.10 HTTPPROXY= @@ -305,8 +305,8 @@ package_offline: compile build modify_composefile @$(DOCKERPULL) nginx:$(NGINXVERSION) @if [ "$(NOTARYFLAG)" = "true" ] ; then \ echo "pulling notary and mariadb..."; \ - $(DOCKERPULL) jiangd/notary:$(NOTARYVERSION); \ - $(DOCKERPULL) notary:$(NOTARYSIGNERVERSION); \ + $(DOCKERPULL) vmware/notary-photon:$(NOTARYVERSION); \ + $(DOCKERPULL) vmware/notary-photon:$(NOTARYSIGNERVERSION); \ $(DOCKERPULL) mariadb:$(MARIADBVERSION); \ fi @@ -319,7 +319,7 @@ package_offline: compile build modify_composefile $(DOCKERIMAGENAME_DB):$(VERSIONTAG) \ $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) \ nginx:$(NGINXVERSION) registry:$(REGISTRYVERSION) photon:$(PHOTONVERSION) \ - jiangd/notary:$(NOTARYVERSION) notary:$(NOTARYSIGNERVERSION) mariadb:$(MARIADBVERSION); \ + vmware/notary-photon:$(NOTARYVERSION) vmware/notary-photon:$(NOTARYSIGNERVERSION) mariadb:$(MARIADBVERSION); \ else \ $(DOCKERSAVE) -o $(HARBORPKG)/$(DOCKERIMGFILE).$(VERSIONTAG).tgz \ $(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) \ diff --git a/make/common/templates/notary/mysql-initdb.d/notary.sql b/make/common/templates/notary/mysql-initdb.d/notary.sql deleted file mode 100644 index c9dcf9051..000000000 --- a/make/common/templates/notary/mysql-initdb.d/notary.sql +++ /dev/null @@ -1,210 +0,0 @@ --- MySQL dump 10.16 Distrib 10.1.10-MariaDB, for debian-linux-gnu (x86_64) --- --- Host: localhost Database: --- ------------------------------------------------------ --- Server version 10.1.10-MariaDB-1~jessie - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; --- --- Current Database: `notaryserver` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `notaryserver` /*!40100 DEFAULT CHARACTER SET latin1 */; - -USE `notaryserver`; - --- --- Table structure for table `change_category` --- - -DROP TABLE IF EXISTS `change_category`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `change_category` ( - `category` varchar(20) NOT NULL, - PRIMARY KEY (`category`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `change_category` --- - -LOCK TABLES `change_category` WRITE; -/*!40000 ALTER TABLE `change_category` DISABLE KEYS */; -INSERT INTO `change_category` VALUES ('deletion'),('update'); -/*!40000 ALTER TABLE `change_category` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `changefeed` --- - -DROP TABLE IF EXISTS `changefeed`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `changefeed` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `gun` varchar(255) NOT NULL, - `version` int(11) NOT NULL, - `sha256` char(64) DEFAULT NULL, - `category` varchar(20) NOT NULL DEFAULT 'update', - PRIMARY KEY (`id`), - KEY `category` (`category`), - KEY `idx_changefeed_gun` (`gun`), - CONSTRAINT `changefeed_ibfk_1` FOREIGN KEY (`category`) REFERENCES `change_category` (`category`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `changefeed` --- - -LOCK TABLES `changefeed` WRITE; -/*!40000 ALTER TABLE `changefeed` DISABLE KEYS */; -/*!40000 ALTER TABLE `changefeed` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `schema_migrations` --- - -DROP TABLE IF EXISTS `schema_migrations`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `schema_migrations` ( - `version` int(11) NOT NULL, - PRIMARY KEY (`version`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `schema_migrations` --- - -LOCK TABLES `schema_migrations` WRITE; -/*!40000 ALTER TABLE `schema_migrations` DISABLE KEYS */; -INSERT INTO `schema_migrations` VALUES (1),(2),(3),(4),(5); -/*!40000 ALTER TABLE `schema_migrations` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `tuf_files` --- - -DROP TABLE IF EXISTS `tuf_files`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tuf_files` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `deleted_at` timestamp NULL DEFAULT NULL, - `gun` varchar(255) NOT NULL, - `role` varchar(255) NOT NULL, - `version` int(11) NOT NULL, - `data` longblob NOT NULL, - `sha256` char(64) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `gun` (`gun`,`role`,`version`), - KEY `sha256` (`sha256`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `tuf_files` --- - -LOCK TABLES `tuf_files` WRITE; -/*!40000 ALTER TABLE `tuf_files` DISABLE KEYS */; -/*!40000 ALTER TABLE `tuf_files` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Current Database: `notarysigner` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `notarysigner` /*!40100 DEFAULT CHARACTER SET latin1 */; - -USE `notarysigner`; - --- --- Table structure for table `private_keys` --- - -DROP TABLE IF EXISTS `private_keys`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `private_keys` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `deleted_at` timestamp NULL DEFAULT NULL, - `key_id` varchar(255) NOT NULL, - `encryption_alg` varchar(255) NOT NULL, - `keywrap_alg` varchar(255) NOT NULL, - `algorithm` varchar(50) NOT NULL, - `passphrase_alias` varchar(50) NOT NULL, - `public` blob NOT NULL, - `private` blob NOT NULL, - `gun` varchar(255) NOT NULL, - `role` varchar(255) NOT NULL, - `last_used` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `key_id` (`key_id`), - UNIQUE KEY `key_id_2` (`key_id`,`algorithm`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `private_keys` --- - -LOCK TABLES `private_keys` WRITE; -/*!40000 ALTER TABLE `private_keys` DISABLE KEYS */; -/*!40000 ALTER TABLE `private_keys` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `schema_migrations` --- - -DROP TABLE IF EXISTS `schema_migrations`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `schema_migrations` ( - `version` int(11) NOT NULL, - PRIMARY KEY (`version`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `schema_migrations` --- - -LOCK TABLES `schema_migrations` WRITE; -/*!40000 ALTER TABLE `schema_migrations` DISABLE KEYS */; -INSERT INTO `schema_migrations` VALUES (1),(2); -/*!40000 ALTER TABLE `schema_migrations` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2017-02-14 6:32:48 diff --git a/make/docker-compose.notary.yml b/make/docker-compose.notary.yml index 7738c221f..a5ccfc0ae 100644 --- a/make/docker-compose.notary.yml +++ b/make/docker-compose.notary.yml @@ -7,7 +7,7 @@ services: networks: - harbor-notary notary-server: - image: jiangd/notary:server-0.5.0-fix + image: vmware/notary-photon:server-0.5.0 container_name: notary-server networks: - notary-mdb @@ -16,7 +16,7 @@ services: volumes: - ./common/config/notary:/config entrypoint: /usr/bin/env sh - command: -c "notary-server -config=/config/server-config.json -logf=logfmt" + command: -c "/migrations/migrate.sh && notary-server -config=/config/server-config.json -logf=logfmt" depends_on: - notary-db - notary-signer @@ -26,7 +26,7 @@ services: syslog-address: "tcp://127.0.0.1:1514" tag: "notary-server" notary-signer: - image: notary:signer-0.5.0 + image: vmware/notary-photon:signer-0.5.0 container_name: notary-signer networks: notary-mdb: @@ -38,7 +38,7 @@ services: env_file: - ./common/config/notary/signer_env entrypoint: /usr/bin/env sh - command: -c "notary-signer -config=/config/signer-config.json -logf=logfmt" + command: -c "/migrations/migrate.sh && notary-signer -config=/config/signer-config.json -logf=logfmt" depends_on: - notary-db logging: @@ -56,8 +56,6 @@ services: volumes: - ./common/config/notary/mysql-initdb.d:/docker-entrypoint-initdb.d - /data/notary-db:/var/lib/mysql - ports: - - "3306:3306" environment: - TERM=dumb - MYSQL_ALLOW_EMPTY_PASSWORD="true" From c5633f7ce87ab537fdd9bb35a8e270e1c529e9ee Mon Sep 17 00:00:00 2001 From: wy65701436 Date: Tue, 21 Mar 2017 04:56:59 -0700 Subject: [PATCH 04/14] add version support --- .travis.yml | 2 ++ Makefile | 10 ++++------ make/photon/ui/Dockerfile | 1 + src/ui/api/systeminfo.go | 23 +++++++++++++++++++++++ src/ui/api/systeminfo_test.go | 4 +++- 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index d552fba28..e8c3500e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,6 +76,8 @@ before_script: script: - sudo mkdir -p /harbor_storage/ca_download - sudo mv ./tests/ca.crt /harbor_storage/ca_download + - sudo mkdir -p /harbor + - sudo mv ./VERSION /harbor/VERSION - sudo service mysql stop - sudo ./tests/testprepare.sh - docker-compose -f ./make/docker-compose.test.yml up -d diff --git a/Makefile b/Makefile index 797cca15e..371918782 100644 --- a/Makefile +++ b/Makefile @@ -164,8 +164,8 @@ DOCKERCOMPOSEFILENAME=docker-compose.yml DOCKERCOMPOSENOTARYFILENAME=docker-compose.notary.yml # version prepare -VERSIONFILEPATH=$(SRCPATH)/ui/views/sections -VERSIONFILENAME=header-content.htm +VERSIONFILEPATH=$(CURDIR) +VERSIONFILENAME=VERSION GITCMD=$(shell which git) GITTAG=$(GITCMD) describe --tags ifeq ($(DEVFLAG), true) @@ -189,9 +189,7 @@ REGISTRYUSER=user REGISTRYPASSWORD=default version: - @if [ "$(DEVFLAG)" = "false" ] ; then \ - $(SEDCMD) -i 's/version=\"{{.Version}}\"/version=\"$(VERSIONTAG)\"/' -i $(VERSIONFILEPATH)/$(VERSIONFILENAME) ; \ - fi + @printf $(VERSIONTAG) > $(VERSIONFILEPATH)/$(VERSIONFILENAME); check_environment: @$(MAKEPATH)/$(CHECKENVCMD) @@ -420,7 +418,7 @@ cleandockercomposefile: cleanversiontag: @echo "cleaning version TAG" - @$(SEDCMD) -i 's/version=\"$(VERSIONTAG)\"/version=\"{{.Version}}\"/' -i $(VERSIONFILEPATH)/$(VERSIONFILENAME) + @rm -rf $(VERSIONFILEPATH)/$(VERSIONFILENAME) cleanpackage: @echo "cleaning harbor install package" diff --git a/make/photon/ui/Dockerfile b/make/photon/ui/Dockerfile index 039d1603a..6b1e067c1 100644 --- a/make/photon/ui/Dockerfile +++ b/make/photon/ui/Dockerfile @@ -7,6 +7,7 @@ COPY ./make/dev/ui/harbor_ui /harbor/ COPY ./src/ui/views /harbor/views COPY ./src/ui/static /harbor/static COPY ./src/favicon.ico /harbor/favicon.ico +COPY ./VERSION /harbor/VERSION RUN chmod u+x /harbor/harbor_ui diff --git a/src/ui/api/systeminfo.go b/src/ui/api/systeminfo.go index 073dc246a..8b144247d 100644 --- a/src/ui/api/systeminfo.go +++ b/src/ui/api/systeminfo.go @@ -1,6 +1,7 @@ package api import ( + "io/ioutil" "net/http" "os" "strings" @@ -20,6 +21,7 @@ type SystemInfoAPI struct { } const defaultRootCert = "/harbor_storage/ca_download/ca.crt" +const harborVersionFile = "/harbor/VERSION" //SystemInfo models for system info. type SystemInfo struct { @@ -42,6 +44,7 @@ type GeneralInfo struct { ProjectCreationRestrict string `json:"project_creation_restriction"` SelfRegistration bool `json:"self_registration"` HasCARoot bool `json:"has_ca_root"` + HarborVersion string `json:"harbor_version"` } // validate for validating user if an admin. @@ -113,6 +116,7 @@ func (sia *SystemInfoAPI) GetGeneralInfo() { registryURL = l[0] } _, caStatErr := os.Stat(defaultRootCert) + harbor_version := sia.getVersion() info := GeneralInfo{ AdmiralEndpoint: cfg[common.AdmiralEndpoint].(string), WithAdmiral: config.WithAdmiral(), @@ -122,7 +126,26 @@ func (sia *SystemInfoAPI) GetGeneralInfo() { SelfRegistration: cfg[common.SelfRegistration].(bool), RegistryURL: registryURL, HasCARoot: caStatErr == nil, + HarborVersion: harbor_version, } sia.Data["json"] = info sia.ServeJSON() } + +// GetVersion gets harbor version. +func (sia *SystemInfoAPI) getVersion() string { + if _, err := os.Stat(harborVersionFile); err != nil { + if os.IsNotExist(err) { + log.Errorf("Version File doesn't exist.") + return "" + } + } + + version, err := ioutil.ReadFile(harborVersionFile) + if err != nil { + log.Errorf("Error occured getting harbor version: %v", err) + return "" + } + + return string(version[:]) +} diff --git a/src/ui/api/systeminfo_test.go b/src/ui/api/systeminfo_test.go index 80892fd84..26a259ba4 100644 --- a/src/ui/api/systeminfo_test.go +++ b/src/ui/api/systeminfo_test.go @@ -3,8 +3,9 @@ package api import ( "encoding/json" "fmt" - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestGetVolumeInfo(t *testing.T) { @@ -49,6 +50,7 @@ func TestGetGeneralInfo(t *testing.T) { assert.Nil(err, fmt.Sprintf("Unexpected Error: %v", err)) assert.Equal(false, g.WithNotary, "with notary should be false") assert.Equal(true, g.HasCARoot, "has ca root should be true") + assert.NotEmpty(g.HarborVersion, "harbor version should not be empty") } func TestGetCert(t *testing.T) { From 5baf565c00e681a09a1f49fb48fd1b4f70a365de Mon Sep 17 00:00:00 2001 From: wy65701436 Date: Tue, 21 Mar 2017 18:28:01 -0700 Subject: [PATCH 05/14] update swagger.yaml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e8c3500e8..e50c49e3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,6 +76,7 @@ before_script: script: - sudo mkdir -p /harbor_storage/ca_download - sudo mv ./tests/ca.crt /harbor_storage/ca_download + - ls . - sudo mkdir -p /harbor - sudo mv ./VERSION /harbor/VERSION - sudo service mysql stop From e667bd7a79c2b8b6732c54c14cf444490ef9cfc1 Mon Sep 17 00:00:00 2001 From: wy65701436 Date: Tue, 21 Mar 2017 18:39:09 -0700 Subject: [PATCH 06/14] add version file --- VERSION | 1 + src/ui/api/systeminfo.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 VERSION diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..90012116c --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +dev \ No newline at end of file diff --git a/src/ui/api/systeminfo.go b/src/ui/api/systeminfo.go index 8b144247d..de7c47303 100644 --- a/src/ui/api/systeminfo.go +++ b/src/ui/api/systeminfo.go @@ -116,7 +116,7 @@ func (sia *SystemInfoAPI) GetGeneralInfo() { registryURL = l[0] } _, caStatErr := os.Stat(defaultRootCert) - harbor_version := sia.getVersion() + harborVersion := sia.getVersion() info := GeneralInfo{ AdmiralEndpoint: cfg[common.AdmiralEndpoint].(string), WithAdmiral: config.WithAdmiral(), @@ -126,7 +126,7 @@ func (sia *SystemInfoAPI) GetGeneralInfo() { SelfRegistration: cfg[common.SelfRegistration].(bool), RegistryURL: registryURL, HasCARoot: caStatErr == nil, - HarborVersion: harbor_version, + HarborVersion: harborVersion, } sia.Data["json"] = info sia.ServeJSON() From 1a9eb09f1260462ef24d17c5c072efc419a8c9de Mon Sep 17 00:00:00 2001 From: wy65701436 Date: Tue, 21 Mar 2017 18:40:21 -0700 Subject: [PATCH 07/14] add version file, and fix go issue. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e50c49e3b..e8c3500e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,7 +76,6 @@ before_script: script: - sudo mkdir -p /harbor_storage/ca_download - sudo mv ./tests/ca.crt /harbor_storage/ca_download - - ls . - sudo mkdir -p /harbor - sudo mv ./VERSION /harbor/VERSION - sudo service mysql stop From 8268cf66bd57fcbb0167936990db04d1fcaac493 Mon Sep 17 00:00:00 2001 From: wy65701436 Date: Tue, 21 Mar 2017 18:56:42 -0700 Subject: [PATCH 08/14] update swagger --- docs/swagger.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 293894750..213ad9b03 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -2028,6 +2028,9 @@ definitions: has_ca_root: type: boolean description: Indicate whether there is a ca root cert file ready for download in the file system. + harbor_version: + type: string + description: The build version of Harbor. SystemInfo: type: object properties: From 5a764d30ea269a3033990cfd2b88f0d63ded0b54 Mon Sep 17 00:00:00 2001 From: wy65701436 Date: Tue, 21 Mar 2017 22:07:12 -0700 Subject: [PATCH 09/14] remove file exist. --- src/ui/api/systeminfo.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/ui/api/systeminfo.go b/src/ui/api/systeminfo.go index de7c47303..249602144 100644 --- a/src/ui/api/systeminfo.go +++ b/src/ui/api/systeminfo.go @@ -21,7 +21,7 @@ type SystemInfoAPI struct { } const defaultRootCert = "/harbor_storage/ca_download/ca.crt" -const harborVersionFile = "/harbor/VERSION" +const harborVersionFile = "/harbor/VERSION1" //SystemInfo models for system info. type SystemInfo struct { @@ -134,18 +134,10 @@ func (sia *SystemInfoAPI) GetGeneralInfo() { // GetVersion gets harbor version. func (sia *SystemInfoAPI) getVersion() string { - if _, err := os.Stat(harborVersionFile); err != nil { - if os.IsNotExist(err) { - log.Errorf("Version File doesn't exist.") - return "" - } - } - version, err := ioutil.ReadFile(harborVersionFile) if err != nil { log.Errorf("Error occured getting harbor version: %v", err) return "" } - return string(version[:]) } From 677359b606945f94f9058a7e83ba3912b5b14df9 Mon Sep 17 00:00:00 2001 From: wy65701436 Date: Tue, 21 Mar 2017 22:20:44 -0700 Subject: [PATCH 10/14] remove file exist. --- src/ui/api/systeminfo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/api/systeminfo.go b/src/ui/api/systeminfo.go index 249602144..88dff92bc 100644 --- a/src/ui/api/systeminfo.go +++ b/src/ui/api/systeminfo.go @@ -21,7 +21,7 @@ type SystemInfoAPI struct { } const defaultRootCert = "/harbor_storage/ca_download/ca.crt" -const harborVersionFile = "/harbor/VERSION1" +const harborVersionFile = "/harbor/VERSION" //SystemInfo models for system info. type SystemInfo struct { From 3c16d6c1a10c731841ec14b40f33be09f87e952c Mon Sep 17 00:00:00 2001 From: Tan Jiang Date: Wed, 22 Mar 2017 18:15:16 +0800 Subject: [PATCH 11/14] restrict access to notary db --- .../templates/notary/mysql-initdb.d/initial-notaryserver.sql | 4 ++-- .../templates/notary/mysql-initdb.d/initial-notarysigner.sql | 4 ++-- make/docker-compose.notary.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/make/common/templates/notary/mysql-initdb.d/initial-notaryserver.sql b/make/common/templates/notary/mysql-initdb.d/initial-notaryserver.sql index 0cc1e9b22..ae124ed15 100644 --- a/make/common/templates/notary/mysql-initdb.d/initial-notaryserver.sql +++ b/make/common/templates/notary/mysql-initdb.d/initial-notaryserver.sql @@ -1,7 +1,7 @@ CREATE DATABASE IF NOT EXISTS `notaryserver`; -CREATE USER "server"@"%" IDENTIFIED BY ""; +CREATE USER "server"@"notary-server.%" IDENTIFIED BY ""; GRANT ALL PRIVILEGES ON `notaryserver`.* - TO "server"@"%"; + TO "server"@"notary-server.%" diff --git a/make/common/templates/notary/mysql-initdb.d/initial-notarysigner.sql b/make/common/templates/notary/mysql-initdb.d/initial-notarysigner.sql index 1e985d81c..a3917d508 100644 --- a/make/common/templates/notary/mysql-initdb.d/initial-notarysigner.sql +++ b/make/common/templates/notary/mysql-initdb.d/initial-notarysigner.sql @@ -1,7 +1,7 @@ CREATE DATABASE IF NOT EXISTS `notarysigner`; -CREATE USER "signer"@"%" IDENTIFIED BY ""; +CREATE USER "signer"@"notary-signer.%" IDENTIFIED BY ""; GRANT ALL PRIVILEGES ON `notarysigner`.* - TO "signer"@"%"; + TO "signer"@"notary-signer.%"; diff --git a/make/docker-compose.notary.yml b/make/docker-compose.notary.yml index a5ccfc0ae..0b6340366 100644 --- a/make/docker-compose.notary.yml +++ b/make/docker-compose.notary.yml @@ -47,7 +47,7 @@ services: syslog-address: "tcp://127.0.0.1:1514" tag: "notary-signer" notary-db: - image: mariadb:10.1.10 + image: vmware/harbor-notary-db:mariadb-10.1.10 container_name: notary-db networks: notary-mdb: From 8f312302555526a5a3def21ccaba699b57d5a59b Mon Sep 17 00:00:00 2001 From: wy65701436 Date: Wed, 22 Mar 2017 04:30:20 -0700 Subject: [PATCH 12/14] add notary test --- .travis.yml | 1 + tests/notarytest.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100755 tests/notarytest.sh diff --git a/.travis.yml b/.travis.yml index e8c3500e8..b0dd4c556 100644 --- a/.travis.yml +++ b/.travis.yml @@ -100,6 +100,7 @@ script: - sudo make install GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage CLARITYIMAGE=danieljt/harbor-clarity-base:0.8.4 NOTARYFLAG=true - docker ps + - ./tests/notarytest.sh - go run tests/startuptest.go https://localhost/ - go run tests/userlogintest.go -name ${HARBOR_ADMIN} -passwd ${HARBOR_ADMIN_PASSWD} diff --git a/tests/notarytest.sh b/tests/notarytest.sh new file mode 100755 index 000000000..1f48f4449 --- /dev/null +++ b/tests/notarytest.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +TIMEOUT=10 +while [ $TIMEOUT -gt 0 ]; do + STATUS=$(curl -s -o /dev/null -w '%{http_code}' https://127.0.0.1/notary/v2/ -kv) + if [ $STATUS -eq 401 ]; then + echo "Notary is running success." + break + fi + TIMEOUT=$(($TIMEOUT - 1)) + sleep 5 +done + +if [ $TIMEOUT -eq 0 ]; then + echo "Notary is running fail." + exit 1 +fi \ No newline at end of file From 1e90b1eab658fc6568e8bc997399e3c83418a92c Mon Sep 17 00:00:00 2001 From: Tan Jiang Date: Wed, 22 Mar 2017 20:31:21 +0800 Subject: [PATCH 13/14] update Makefile --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 797cca15e..5689515dd 100644 --- a/Makefile +++ b/Makefile @@ -84,7 +84,7 @@ NGINXVERSION=1.11.5 PHOTONVERSION=1.0 NOTARYVERSION=server-0.5.0 NOTARYSIGNERVERSION=signer-0.5.0 -MARIADBVERSION=10.1.10 +MARIADBVERSION=mariadb-10.1.10 HTTPPROXY= #clarity parameters @@ -304,10 +304,10 @@ package_offline: compile build modify_composefile @$(DOCKERPULL) registry:$(REGISTRYVERSION) @$(DOCKERPULL) nginx:$(NGINXVERSION) @if [ "$(NOTARYFLAG)" = "true" ] ; then \ - echo "pulling notary and mariadb..."; \ + echo "pulling notary and harbor-notary-db..."; \ $(DOCKERPULL) vmware/notary-photon:$(NOTARYVERSION); \ $(DOCKERPULL) vmware/notary-photon:$(NOTARYSIGNERVERSION); \ - $(DOCKERPULL) mariadb:$(MARIADBVERSION); \ + $(DOCKERPULL) vmware/harbor-notary-db:$(MARIADBVERSION); \ fi @echo "saving harbor docker image" @@ -319,7 +319,7 @@ package_offline: compile build modify_composefile $(DOCKERIMAGENAME_DB):$(VERSIONTAG) \ $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) \ nginx:$(NGINXVERSION) registry:$(REGISTRYVERSION) photon:$(PHOTONVERSION) \ - vmware/notary-photon:$(NOTARYVERSION) vmware/notary-photon:$(NOTARYSIGNERVERSION) mariadb:$(MARIADBVERSION); \ + vmware/notary-photon:$(NOTARYVERSION) vmware/notary-photon:$(NOTARYSIGNERVERSION) vmware/harbor-notary-db:$(MARIADBVERSION); \ else \ $(DOCKERSAVE) -o $(HARBORPKG)/$(DOCKERIMGFILE).$(VERSIONTAG).tgz \ $(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) \ From 9419b632f2e1ca9457e4c467c479c82eddabcbc7 Mon Sep 17 00:00:00 2001 From: kunw Date: Wed, 22 Mar 2017 20:54:22 +0800 Subject: [PATCH 14/14] Merge latest UI codes. --- src/ui/router.go | 2 +- .../password/password-setting.component.html | 25 ++++--- .../password/password-setting.component.ts | 27 +++++++ src/ui_ng/src/app/app-config.service.ts | 2 - src/ui_ng/src/app/base/modal-event.ts | 4 +- .../base/navigator/navigator.component.html | 2 +- .../app/base/navigator/navigator.component.ts | 21 ++++-- src/ui_ng/src/app/common.css | 8 +++ .../create-project.component.html | 11 +-- .../create-project.component.ts | 22 +++--- .../list-project/list-project.component.html | 6 +- .../add-member/add-member.component.html | 20 +++--- .../member/add-member/add-member.component.ts | 22 +++--- .../project-detail.component.html | 6 +- .../src/app/project/project.component.ts | 2 +- src/ui_ng/src/app/project/project.module.ts | 5 +- src/ui_ng/src/app/project/project.service.ts | 8 +++ .../create-edit-destination.component.html | 19 ++--- .../create-edit-destination.component.ts | 31 +++++--- .../tag-repository.component.html | 4 +- .../tag-repository.component.ts | 14 ++-- src/ui_ng/src/app/repository/tag-view.ts | 2 +- .../create-edit-policy.component.html | 45 +++++------- .../create-edit-policy.component.ts | 40 ++++++++--- .../list-policy/list-policy.component.html | 11 ++- .../list-policy/list-policy.component.ts | 70 +++++++++++++------ .../new-user-form/new-user-form.component.css | 5 ++ .../new-user-form.component.html | 49 +++++-------- .../route/auth-user-activate.service.ts | 3 - src/ui_ng/src/app/shared/shared.const.ts | 1 + .../src/app/shared/target-exists-directive.ts | 66 +++++++++++++++++ src/ui_ng/src/i18n/lang/en-lang.json | 14 ++-- src/ui_ng/src/i18n/lang/zh-lang.json | 16 +++-- src/ui_ng/src/styles.css | 5 ++ 34 files changed, 390 insertions(+), 198 deletions(-) create mode 100644 src/ui_ng/src/app/shared/target-exists-directive.ts diff --git a/src/ui/router.go b/src/ui/router.go index 501956f3a..3ad7008a9 100644 --- a/src/ui/router.go +++ b/src/ui/router.go @@ -62,7 +62,7 @@ func initRouters() { //API: beego.Router("/api/search", &api.SearchAPI{}) beego.Router("/api/projects/:pid([0-9]+)/members/?:mid", &api.ProjectMemberAPI{}) - beego.Router("/api/projects/", &api.ProjectAPI{}, "get:List;post:Post") + beego.Router("/api/projects/", &api.ProjectAPI{}, "get:List;post:Post;head:Head") beego.Router("/api/projects/:id", &api.ProjectAPI{}) beego.Router("/api/projects/:id/publicity", &api.ProjectAPI{}, "put:ToggleProjectPublic") beego.Router("/api/statistics", &api.StatisticAPI{}) diff --git a/src/ui_ng/src/app/account/password/password-setting.component.html b/src/ui_ng/src/app/account/password/password-setting.component.html index 8a48f6d47..0ecc01d30 100644 --- a/src/ui_ng/src/app/account/password/password-setting.component.html +++ b/src/ui_ng/src/app/account/password/password-setting.component.html @@ -7,11 +7,11 @@
- +
-
diff --git a/src/ui_ng/src/app/base/navigator/navigator.component.ts b/src/ui_ng/src/app/base/navigator/navigator.component.ts index dde259aa8..2a12419ce 100644 --- a/src/ui_ng/src/app/base/navigator/navigator.component.ts +++ b/src/ui_ng/src/app/base/navigator/navigator.component.ts @@ -9,9 +9,11 @@ import { SessionUser } from '../../shared/session-user'; import { SessionService } from '../../shared/session.service'; import { CookieService } from 'angular2-cookie/core'; -import { supportedLangs, enLang, languageNames, CommonRoutes } from '../../shared/shared.const'; - +import { supportedLangs, enLang, languageNames, CommonRoutes, AlertType } from '../../shared/shared.const'; +import { errorHandler } from '../../shared/shared.utils'; import { AppConfigService } from '../../app-config.service'; +import { SearchTriggerService } from '../global-search/search-trigger.service'; +import { MessageService } from '../../global-message/message.service'; @Component({ selector: 'navigator', @@ -31,7 +33,9 @@ export class NavigatorComponent implements OnInit { private router: Router, private translate: TranslateService, private cookie: CookieService, - private appConfigService: AppConfigService) { } + private appConfigService: AppConfigService, + private msgService: MessageService, + private searchTrigger: SearchTriggerService) { } ngOnInit(): void { this.selectedLang = this.translate.currentLang; @@ -98,8 +102,10 @@ export class NavigatorComponent implements OnInit { this.router.navigate([CommonRoutes.EMBEDDED_SIGN_IN]); }) .catch(error => { - console.error("Log out with error: ", error); + this.msgService.announceMessage(error.status | 500, errorHandler(error), AlertType.WARNING); }); + //Confirm search result panel is close + this.searchTrigger.closeSearch(false); } //Switch languages @@ -124,5 +130,12 @@ export class NavigatorComponent implements OnInit { //Naviagte to signin page this.router.navigate([CommonRoutes.HARBOR_ROOT]); } + + //Confirm search result panel is close + this.searchTrigger.closeSearch(false); + } + + registryAction(): void { + this.searchTrigger.closeSearch(false); } } \ No newline at end of file diff --git a/src/ui_ng/src/app/common.css b/src/ui_ng/src/app/common.css index ee49bf9fd..f657dee85 100644 --- a/src/ui_ng/src/app/common.css +++ b/src/ui_ng/src/app/common.css @@ -5,4 +5,12 @@ .form-group-label-override { font-size: 14px; font-weight: 400; +} + +.sub-label-for-input { + position: absolute; + top: 26px; + font-size: 10px; + font-weight: 400; + line-height: 12px; } \ No newline at end of file diff --git a/src/ui_ng/src/app/project/create-project/create-project.component.html b/src/ui_ng/src/app/project/create-project/create-project.component.html index 5f78a1b16..725f538a6 100644 --- a/src/ui_ng/src/app/project/create-project/create-project.component.html +++ b/src/ui_ng/src/app/project/create-project/create-project.component.html @@ -1,23 +1,26 @@ - +