Merge branch 'master' of https://github.com/vmware/harbor into fixIssue

This commit is contained in:
pfh 2018-04-16 11:35:33 +08:00
commit c67e1a2e4b
13 changed files with 52 additions and 18 deletions

View File

@ -134,7 +134,7 @@ Save the [Keepalived configuration file](https://github.com/vmware/harbor/blob/r
**Important**
You need to change the **<change_to_VIP_address>** to the real IP address.(There are two place.)
You need to change the **<change_to_VIP_address>** to your VIP address.(There are two place.)
Change **harbor_node1_IP** (Two places) and **harbor_node2_IP** (Two places)to the real harbor nodes IPs.
@ -212,8 +212,6 @@ In harbor.cfg
redis_url = 192.168.1.217:6379
```
If you have multiple Redis servers then separate them with ";"
##### 7> Provide the Clair DB connection information
In harbor.cfg
@ -247,7 +245,7 @@ For example if you use swift as the storage backend then you need to set the fol
```
registry_storage_provider_name = swift
registry_storage_provider_config = username:yourusername,password:yourpass,authurl:http://192.168.1.217/identity/v3,tenant:admin,domain:default,region:RegionOne,container:docker_images
registry_storage_provider_config = username: yourusername,password: yourpass,authurl: http://192.168.1.217/identity/v3,tenant: admin,domain: default,region: RegionOne,container: docker_images
```
**Important**

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

View File

@ -79,6 +79,10 @@ After the project is created, you can browse repositories, members, logs, replic
![browse project](img/new_browse_project.png)
There are two views to show repositories, listview, and cardview, you can switch between them by click correspond icon.
![browse repositories](img/browse_project_repositories.png)
All logs can be listed by clicking "Logs". You can apply a filter by username, or operations and dates under "Advanced Search".
![browse project](img/log_search_advanced.png)

View File

@ -27,6 +27,8 @@ services:
options:
syslog-address: "tcp://127.0.0.1:1514"
tag: "clair"
env_file:
./common/config/clair/clair_env
networks:
harbor-clair:
external: false

View File

@ -59,7 +59,7 @@ services:
volumes:
- ./common/config/ui/app.conf:/etc/ui/app.conf:z
- ./common/config/ui/private_key.pem:/etc/ui/private_key.pem:z
- ./common/config/ui/certificates/:/etc/ui/certifates/
- ./common/config/ui/certificates/:/etc/ui/certificates/:z
- /data/secretkey:/etc/ui/key:z
- /data/ca_download/:/etc/ui/ca/:z
- /data/psc/:/etc/ui/token/:z
@ -82,7 +82,7 @@ services:
restart: always
volumes:
- /data/job_logs:/var/log/jobs:z
- ./common/config/jobservice/app.conf:/etc/jobservice/app.conf:z
- ./common/config/jobservice/config.yml:/etc/jobservice/config.yml:z
- /data/secretkey:/etc/jobservice/key:z
networks:
- harbor

View File

@ -324,7 +324,7 @@ func (ra *RepositoryAPI) Delete() {
return
}
if repository == nil {
ra.HandleNotFound(fmt.Sprintf("repository %s not found", repoName))
log.Warningf("the repository %s not found after deleting tags", repoName)
return
}

View File

@ -195,7 +195,7 @@ func TestGetReposTop(t *testing.T) {
assert.Equal(int(200), code, "response code should be 200")
if r, ok := repos.([]*repoResp); ok {
assert.Equal(int(1), len(r), "the length should be 1")
assert.Equal(r[0].Name, "library/docker", "the name of repository should be library/docker")
assert.Equal(r[0].Name, "library/busybox", "the name of repository should be library/busybox")
} else {
t.Error("unexpected response")
}

View File

@ -48,7 +48,7 @@ func TestSearch(t *testing.T) {
} else {
assert.Equal(int(200), httpStatusCode, "httpStatusCode should be 200")
assert.Equal("library", result.Repositories[0].ProjectName, "Project name should be library")
assert.Equal("library/docker", result.Repositories[0].RepositoryName, "Repository name should be library/docker")
assert.Equal("library/busybox", result.Repositories[0].RepositoryName, "Repository name should be library/busybox")
assert.True(result.Repositories[0].ProjectPublic, "Project public status should be 1 (true)")
}
@ -60,7 +60,7 @@ func TestSearch(t *testing.T) {
} else {
assert.Equal(int(200), httpStatusCode, "httpStatusCode should be 200")
assert.Equal("library", result.Repositories[0].ProjectName, "Project name should be library")
assert.Equal("library/docker", result.Repositories[0].RepositoryName, "Repository name should be library/docker")
assert.Equal("library/busybox", result.Repositories[0].RepositoryName, "Repository name should be library/busybox")
assert.True(result.Repositories[0].ProjectPublic, "Project public status should be 1 (true)")
}

View File

@ -43,7 +43,7 @@ func filter(req *http.Request, resp http.ResponseWriter) {
}
if matchRepoTagDelete(req) {
resp.WriteHeader(http.StatusServiceUnavailable)
_, err := resp.Write([]byte("The system is in read only mode. Any modification is not prohibited."))
_, err := resp.Write([]byte("The system is in read only mode. Any modification is prohibited."))
if err != nil {
log.Errorf("failed to write response body: %v", err)
}

View File

@ -160,8 +160,9 @@ type readonlyHandler struct {
func (rh readonlyHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
if config.ReadOnly() {
if req.Method == http.MethodDelete || req.Method == http.MethodPost || req.Method == http.MethodPatch {
http.Error(rw, marshalError("DENIED", "The system is in read only mode. Any modification is not prohibited."), http.StatusForbidden)
if req.Method == http.MethodDelete || req.Method == http.MethodPost || req.Method == http.MethodPatch || req.Method == http.MethodPut {
log.Warningf("The request is prohibited in readonly mode, url is: %s", req.URL.Path)
http.Error(rw, marshalError("DENIED", "The system is in read only mode. Any modification is prohibited."), http.StatusForbidden)
return
}
}

View File

@ -2,11 +2,11 @@
IP=`ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'`
docker pull hello-world
docker pull docker
docker pull busybox
docker login -u admin -p Harbor12345 $IP:5000
docker tag hello-world $IP:5000/library/hello-world:latest
docker push $IP:5000/library/hello-world:latest
docker tag docker $IP:5000/library/docker:latest
docker push $IP:5000/library/docker:latest
docker tag busybox $IP:5000/library/busybox:latest
docker push $IP:5000/library/busybox:latest

View File

@ -105,6 +105,15 @@ Delete Repo
Sleep 1
Click Element xpath=//button[contains(.,"CLOSE")]
Delete Repo on CardView
[Arguments] ${reponame}
Click Element xpath=//hbr-gridview//span[contains(.,'reponame')]//clr-dropdown/button
Sleep 1
Click Element xpath=//hbr-gridview//span[contains(.,'reponame')]//clr-dropdown/clr-dropdown-menu/button[contains(.,'Delete')]
Sleep 1
Click Element //clr-modal//button[contains(.,'DELETE')]
Sleep 3
Delete Project
[Arguments] ${projectname}
Sleep 1
@ -190,6 +199,11 @@ Go Into Repo
Sleep 2
Capture Page Screenshot gointo_${repoName}.png
Switch To CardView
Sleep 2
Click Element xpath=//hbr-repository-gridview//span[1]/clr-icon
Sleep 5
Expand Repo
[Arguments] ${projectname}
Click Element //repository//clr-dg-row[contains(.,'${projectname}')]//button/clr-icon

View File

@ -541,6 +541,21 @@ Test Case - Delete Multi Tag
Delete Success
Close Browser
Test Case - Delete Repo on CardView
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor
Create An New Project project${d}
Push Image ${ip} test${d} Test1@34 project${d} hello-world
Push Image ${ip} test${d} Test1@34 project${d} busybox
Sleep 2
Go Into Project project${d}
Switch To CardView
Delete Repo on CardView hello-world
# Verify
Delete Success
Close Browser
Test Case - Delete Multi Member
Init Chrome Driver
${d}= Get Current Date result_format=%m%s