mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-31 20:11:33 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
a0335bbf65
@ -30,6 +30,6 @@ notifications:
|
||||
- name: harbor
|
||||
disabled: false
|
||||
url: http://ui/service/notifications
|
||||
timeout: 500ms
|
||||
timeout: 3000ms
|
||||
threshold: 5
|
||||
backoff: 1s
|
||||
|
@ -134,6 +134,10 @@ func (ra *RepJobAPI) Delete() {
|
||||
ra.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
|
||||
}
|
||||
|
||||
if job == nil {
|
||||
ra.CustomAbort(http.StatusNotFound, fmt.Sprintf("job %d not found", ra.jobID))
|
||||
}
|
||||
|
||||
if job.Status == models.JobPending || job.Status == models.JobRunning {
|
||||
ra.CustomAbort(http.StatusBadRequest, fmt.Sprintf("job is %s, can not be deleted", job.Status))
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"sort"
|
||||
@ -210,6 +211,10 @@ func (ra *RepositoryAPI) GetTags() {
|
||||
ra.CustomAbort(http.StatusInternalServerError, "")
|
||||
}
|
||||
|
||||
if project == nil {
|
||||
ra.CustomAbort(http.StatusNotFound, fmt.Sprintf("project %s not found", projectName))
|
||||
}
|
||||
|
||||
if project.Public == 0 {
|
||||
userID := ra.ValidateUser()
|
||||
if !checkProjectPermission(userID, project.ProjectID) {
|
||||
|
@ -1,68 +0,0 @@
|
||||
version: '2'
|
||||
services:
|
||||
log:
|
||||
image: daocloud.io/harbor/deploy_log:latest
|
||||
volumes:
|
||||
- /var/log/harbor/:/var/log/docker/
|
||||
ports:
|
||||
- 1514:514
|
||||
registry:
|
||||
image: daocloud.io/library/registry:2.3.0
|
||||
volumes:
|
||||
- /data/registry:/storage
|
||||
- ./config/registry/:/etc/registry/
|
||||
ports:
|
||||
- 5001:5001
|
||||
command:
|
||||
/etc/registry/config.yml
|
||||
depends_on:
|
||||
- log
|
||||
logging:
|
||||
driver: "syslog"
|
||||
options:
|
||||
syslog-address: "tcp://127.0.0.1:1514"
|
||||
syslog-tag: "registry"
|
||||
mysql:
|
||||
image: daocloud.io/harbor/deploy_mysql:latest
|
||||
volumes:
|
||||
- /data/database:/var/lib/mysql
|
||||
env_file:
|
||||
- ./config/db/env
|
||||
depends_on:
|
||||
- log
|
||||
logging:
|
||||
driver: "syslog"
|
||||
options:
|
||||
syslog-address: "tcp://127.0.0.1:1514"
|
||||
syslog-tag: "mysql"
|
||||
ui:
|
||||
image: daocloud.io/harbor/deploy_ui:latest
|
||||
env_file:
|
||||
- ./config/ui/env
|
||||
volumes:
|
||||
- ./config/ui/app.conf:/etc/ui/app.conf
|
||||
- ./config/ui/private_key.pem:/etc/ui/private_key.pem
|
||||
depends_on:
|
||||
- log
|
||||
logging:
|
||||
driver: "syslog"
|
||||
options:
|
||||
syslog-address: "tcp://127.0.0.1:1514"
|
||||
syslog-tag: "ui"
|
||||
proxy:
|
||||
image: daocloud.io/library/nginx:1.9
|
||||
volumes:
|
||||
- ./config/nginx:/etc/nginx
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
depends_on:
|
||||
- mysql
|
||||
- registry
|
||||
- ui
|
||||
- log
|
||||
logging:
|
||||
driver: "syslog"
|
||||
options:
|
||||
syslog-address: "tcp://127.0.0.1:1514"
|
||||
syslog-tag: "proxy"
|
1
contrib/prebuild-install/README.md
Normal file
1
contrib/prebuild-install/README.md
Normal file
@ -0,0 +1 @@
|
||||
docker-compose.sh is used to configure docker-compose.yml to pull images from platform like docker hub, daocloud.io and others. If you don't want to waste time on building images, you can execute this script to pull images from platform you prefer. Currently, we only support daocloud.io and docker hub, the default is docker hub.
|
32
contrib/prebuild-install/docker-compose.sh
Executable file
32
contrib/prebuild-install/docker-compose.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#/bin/bash
|
||||
read -p "Please input the platform name you want to pull images, for docker hub, enter 1; for daocloud.io, enter 2, otherwise enter the name of the platform, the default is 1:" choice
|
||||
cd ../../Deploy
|
||||
template_file="docker-compose.yml.template"
|
||||
yml_file='docker-compose.yml'
|
||||
if test -e $template_file
|
||||
then
|
||||
cp $template_file $yml_file
|
||||
else
|
||||
cp $yml_file $template_file
|
||||
fi
|
||||
platform=''
|
||||
choice=${choice:-1}
|
||||
if [ $choice == '1' ]
|
||||
then
|
||||
platform='prjharbor/'
|
||||
elif [ $choice == '2' ]
|
||||
then
|
||||
platform='daocloud.io/harbor/'
|
||||
else
|
||||
platform=$choice
|
||||
fi
|
||||
version='0.3.0'
|
||||
log='deploy_log:'
|
||||
db='deploy_mysql:'
|
||||
job_service='deploy_jobservice:'
|
||||
ui='deploy_ui:'
|
||||
sed -i -- '/build: .\/log\//c\ image: '$platform$log$version'' $yml_file
|
||||
sed -i -- '/build: .\/db\//c\ image: '$platform$db$version'' $yml_file
|
||||
sed -i -- '/ui:/{n;N;N;d}' $yml_file && sed -i -- '/ui:/a\\ image: '$platform$ui$version'' $yml_file
|
||||
sed -i -- '/jobservice:/{n;N;N;d}' $yml_file && sed -i -- '/jobservice:/a\\ image: '$platform$job_service$version'' $yml_file
|
||||
echo "succeed! "
|
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import requests
|
||||
import simplejson
|
||||
import json
|
||||
import logging
|
||||
import requests
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
@ -52,7 +52,8 @@ class HarborClient(object):
|
||||
project_id, project_name))
|
||||
return project_id
|
||||
else:
|
||||
pritn("Fail to get project id from project name", project_name)
|
||||
logging.error("Fail to get project id from project name",
|
||||
project_name)
|
||||
return None
|
||||
|
||||
# GET /search
|
||||
@ -107,8 +108,8 @@ class HarborClient(object):
|
||||
def create_project(self, project_name, is_public=False):
|
||||
result = False
|
||||
path = '%s://%s/api/projects' % (self.protocol, self.host)
|
||||
request_body = simplejson.dumps({'project_name': project_name,
|
||||
'public': is_public})
|
||||
request_body = json.dumps({'project_name': project_name,
|
||||
'public': is_public})
|
||||
response = requests.post(path,
|
||||
cookies={'beegosessionID': self.session_id},
|
||||
data=request_body)
|
||||
@ -129,7 +130,7 @@ class HarborClient(object):
|
||||
result = False
|
||||
path = '%s://%s/api/projects/%s/publicity?project_id=%s' % (
|
||||
self.protocol, self.host, project_id, project_id)
|
||||
request_body = simplejson.dumps({'public': is_public})
|
||||
request_body = json.dumps({'public': is_public})
|
||||
response = requests.put(path,
|
||||
cookies={'beegosessionID': self.session_id},
|
||||
data=request_body)
|
||||
@ -175,11 +176,11 @@ class HarborClient(object):
|
||||
def create_user(self, username, email, password, realname, comment):
|
||||
result = False
|
||||
path = '%s://%s/api/users' % (self.protocol, self.host)
|
||||
request_body = simplejson.dumps({'username': username,
|
||||
'email': email,
|
||||
'password': password,
|
||||
'realname': realname,
|
||||
'comment': comment})
|
||||
request_body = json.dumps({'username': username,
|
||||
'email': email,
|
||||
'password': password,
|
||||
'realname': realname,
|
||||
'comment': comment})
|
||||
response = requests.post(path,
|
||||
cookies={'beegosessionID': self.session_id},
|
||||
data=request_body)
|
||||
@ -199,9 +200,9 @@ class HarborClient(object):
|
||||
result = False
|
||||
path = '%s://%s/api/users/%s?user_id=%s' % (self.protocol, self.host,
|
||||
user_id, user_id)
|
||||
request_body = simplejson.dumps({'email': email,
|
||||
'realname': realname,
|
||||
'comment': comment})
|
||||
request_body = json.dumps({'email': email,
|
||||
'realname': realname,
|
||||
'comment': comment})
|
||||
response = requests.put(path,
|
||||
cookies={'beegosessionID': self.session_id},
|
||||
data=request_body)
|
||||
@ -236,8 +237,8 @@ class HarborClient(object):
|
||||
result = False
|
||||
path = '%s://%s/api/users/%s/password?user_id=%s' % (
|
||||
self.protocol, self.host, user_id, user_id)
|
||||
request_body = simplejson.dumps({'old_password': old_password,
|
||||
'new_password': new_password})
|
||||
request_body = json.dumps({'old_password': old_password,
|
||||
'new_password': new_password})
|
||||
response = requests.put(path,
|
||||
cookies={'beegosessionID': self.session_id},
|
||||
data=request_body)
|
||||
|
@ -184,7 +184,7 @@ func GetTopRepos(countNum int) ([]models.TopRepo, error) {
|
||||
for i := 0; i < len(list); i++ {
|
||||
for _, v := range usrnameList {
|
||||
if v.RepoName == list[i].RepoName {
|
||||
list[i].Creator = v.Creator
|
||||
// list[i].Creator = v.Creator
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -770,9 +770,11 @@ func TestGetTopRepos(t *testing.T) {
|
||||
if topRepos[0].AccessCount != 1 {
|
||||
t.Errorf("error occured in get top reop's access count, expected: %v, actual: %v", 1, topRepos[0].AccessCount)
|
||||
}
|
||||
if topRepos[0].Creator != currentUser.Username {
|
||||
t.Errorf("error occured in get top reop's creator, expected: %v, actual: %v", currentUser.Username, topRepos[0].Creator)
|
||||
}
|
||||
/*
|
||||
if topRepos[0].Creator != currentUser.Username {
|
||||
t.Errorf("error occured in get top reop's creator, expected: %v, actual: %v", currentUser.Username, topRepos[0].Creator)
|
||||
}
|
||||
*/
|
||||
err = ToggleProjectPublicity(currentProject.ProjectID, publicityOff)
|
||||
if err != nil {
|
||||
t.Errorf("Error occurred in ToggleProjectPublicity: %v", err)
|
||||
|
@ -19,5 +19,5 @@ package models
|
||||
type TopRepo struct {
|
||||
RepoName string `json:"name"`
|
||||
AccessCount int64 `json:"count"`
|
||||
Creator string `json:"creator"`
|
||||
// Creator string `json:"creator"`
|
||||
}
|
||||
|
@ -18,8 +18,7 @@
|
||||
<table class="table table-pane table-header">
|
||||
<thead>
|
||||
<th width="60%">// 'repository_name' | tr //</th>
|
||||
<th width="15%">// 'count' | tr //</th>
|
||||
<th width="25%">// 'creator' | tr //</th>
|
||||
<th width="40%">// 'count' | tr //</th>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
@ -30,7 +29,7 @@
|
||||
<td colspan="5" height="120px" class="empty-hint" ng-if="vm.top10Repositories.length === 0"><h4 class="text-muted">// 'no_top_repositories' | tr //</h4></td>
|
||||
</tr>
|
||||
<tr ng-if="vm.top10Repositories.length > 0" ng-repeat="t in vm.top10Repositories">
|
||||
<td width="60%">//t.name//</td><td width="15%">//t.count//</td><td width="25%">//t.creator === '' ? '-' : t.creator //</td>
|
||||
<td width="60%">//t.name//</td><td width="40%">//t.count//</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
Loading…
Reference in New Issue
Block a user