Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
水淹萌龙
kubesphere
提交
d42f886f
K
kubesphere
项目概览
水淹萌龙
/
kubesphere
与 Fork 源项目一致
Fork自
KubeSphere / kubesphere
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kubesphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
d42f886f
编写于
4月 25, 2019
作者:
R
runzexia
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update api docs & fmt code
上级
a266d0e9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
10 deletion
+34
-10
pkg/apis/devops/v1alpha2/register.go
pkg/apis/devops/v1alpha2/register.go
+29
-5
pkg/models/devops/common.go
pkg/models/devops/common.go
+4
-4
pkg/models/tenant/devops.go
pkg/models/tenant/devops.go
+1
-1
未找到文件。
pkg/apis/devops/v1alpha2/register.go
浏览文件 @
d42f886f
...
...
@@ -48,6 +48,7 @@ func addWebService(c *restful.Container) error {
Doc
(
"get devops project"
)
.
Metadata
(
restfulspec
.
KeyOpenAPITags
,
tags
)
.
Param
(
webservice
.
PathParameter
(
"devops"
,
"projectId"
))
.
Returns
(
http
.
StatusOK
,
"success"
,
&
devops
.
DevOpsProject
{})
.
Writes
(
&
devops
.
DevOpsProject
{}))
webservice
.
Route
(
webservice
.
PATCH
(
"/devops/{devops}"
)
.
...
...
@@ -55,57 +56,80 @@ func addWebService(c *restful.Container) error {
Doc
(
"get devops project"
)
.
Metadata
(
restfulspec
.
KeyOpenAPITags
,
tags
)
.
Param
(
webservice
.
PathParameter
(
"devops"
,
"projectId"
))
.
Returns
(
http
.
StatusOK
,
"success"
,
&
devops
.
DevOpsProject
{})
.
Writes
(
&
devops
.
DevOpsProject
{}))
webservice
.
Route
(
webservice
.
GET
(
"/devops/{devops}/defaultroles"
)
.
To
(
devopsapi
.
GetDevOpsProjectDefaultRoles
)
.
Doc
(
"get devops project defaultroles"
)
.
Metadata
(
restfulspec
.
KeyOpenAPITags
,
tags
)
.
Param
(
webservice
.
PathParameter
(
"devops"
,
"projectId"
))
.
Returns
(
http
.
StatusOK
,
"success"
,
&
devops
.
DefaultRoles
)
.
Writes
(
&
devops
.
DefaultRoles
))
webservice
.
Route
(
webservice
.
GET
(
"/devops/{devops}/members"
)
.
To
(
devopsapi
.
GetDevOpsProjectMembersHandler
)
.
Doc
(
"get devops project members"
)
.
Metadata
(
restfulspec
.
KeyOpenAPITags
,
tags
)
.
Writes
(
&
[]
*
devops
.
DevOpsProjectMembership
{}))
Param
(
webservice
.
PathParameter
(
"devops"
,
"projectId"
))
.
Returns
(
http
.
StatusOK
,
"success"
,
[]
*
devops
.
DevOpsProjectMembership
{})
.
Writes
([]
*
devops
.
DevOpsProjectMembership
{}))
webservice
.
Route
(
webservice
.
GET
(
"/devops/{devops}/members/{members}"
)
.
To
(
devopsapi
.
GetDevOpsProjectMemberHandler
)
.
Doc
(
"get devops project member"
)
.
Metadata
(
restfulspec
.
KeyOpenAPITags
,
tags
)
.
Param
(
webservice
.
PathParameter
(
"devops"
,
"projectId"
))
.
Param
(
webservice
.
PathParameter
(
"members"
,
"username"
))
.
Returns
(
http
.
StatusOK
,
"success"
,
[]
*
devops
.
DevOpsProjectMembership
{})
.
Writes
(
&
devops
.
DevOpsProjectMembership
{}))
webservice
.
Route
(
webservice
.
POST
(
"/devops/{devops}/members"
)
.
To
(
devopsapi
.
AddDevOpsProjectMemberHandler
)
.
Doc
(
"add devops project members"
)
.
Metadata
(
restfulspec
.
KeyOpenAPITags
,
tags
)
.
Param
(
webservice
.
PathParameter
(
"devops"
,
"projectId"
))
.
Returns
(
http
.
StatusOK
,
"success"
,
&
devops
.
DevOpsProjectMembership
{})
.
Writes
(
&
devops
.
DevOpsProjectMembership
{}))
webservice
.
Route
(
webservice
.
POST
(
"/devops/{devops}/pipelines"
)
.
To
(
devopsapi
.
CreateDevOpsProjectPipelineHandler
)
.
Doc
(
"add devops project pipeline"
)
.
Metadata
(
restfulspec
.
KeyOpenAPITags
,
tags
)
.
Reads
(
devops
.
ProjectPipeline
{}))
Param
(
webservice
.
PathParameter
(
"devops"
,
"projectId"
))
.
Returns
(
http
.
StatusOK
,
"success"
,
&
devops
.
ProjectPipeline
{})
.
Writes
(
&
devops
.
ProjectPipeline
{})
.
Reads
(
&
devops
.
ProjectPipeline
{}))
webservice
.
Route
(
webservice
.
PUT
(
"/devops/{devops}/pipelines/{pipelines}"
)
.
To
(
devopsapi
.
UpdateDevOpsProjectPipelineHandler
)
.
Doc
(
"add devops project pipeline"
)
.
Doc
(
"update devops project pipeline"
)
.
Param
(
webservice
.
PathParameter
(
"devops"
,
"projectId"
))
.
Param
(
webservice
.
PathParameter
(
"pipelines"
,
"pipelineId"
))
.
Metadata
(
restfulspec
.
KeyOpenAPITags
,
tags
)
.
Reads
(
devops
.
ProjectPipeline
{}))
Returns
(
http
.
StatusOK
,
"success"
,
&
devops
.
ProjectPipeline
{})
.
Writes
(
&
devops
.
ProjectPipeline
{})
.
Reads
(
&
devops
.
ProjectPipeline
{}))
webservice
.
Route
(
webservice
.
GET
(
"/devops/{devops}/pipelines/{pipelines}/config"
)
.
To
(
devopsapi
.
GetDevOpsProjectPipelineHandler
)
.
Doc
(
"get devops project pipeline config"
)
.
Metadata
(
restfulspec
.
KeyOpenAPITags
,
tags
)
.
Param
(
webservice
.
PathParameter
(
"devops"
,
"projectId"
))
.
Param
(
webservice
.
PathParameter
(
"pipelines"
,
"pipelineId"
))
.
Returns
(
http
.
StatusOK
,
"ok"
,
devops
.
ProjectPipeline
{})
.
Writes
(
devops
.
ProjectPipeline
{}))
webservice
.
Route
(
webservice
.
GET
(
"/devops/{devops}/pipelines/{pipelines}/sonarStatus"
)
.
To
(
devopsapi
.
GetPipelineSonarStatusHandler
)
.
Doc
(
"get devops project pipeline sonarStatus"
)
.
Metadata
(
restfulspec
.
KeyOpenAPITags
,
tags
)
.
Param
(
webservice
.
PathParameter
(
"devops"
,
"projectId"
))
.
Param
(
webservice
.
PathParameter
(
"pipelines"
,
"pipelineId"
))
.
Returns
(
http
.
StatusOK
,
"ok"
,
[]
devops
.
SonarStatus
{})
.
Writes
([]
devops
.
SonarStatus
{}))
webservice
.
Route
(
webservice
.
GET
(
"/devops/{devops}/pipelines/{pipelines}/branches/{branches}/sonarStatus"
)
.
To
(
devopsapi
.
GetMultiBranchesPipelineSonarStatusHandler
)
.
Doc
(
"get devops project pipeline sonarStatus"
)
.
Metadata
(
restfulspec
.
KeyOpenAPITags
,
tags
)
.
Param
(
webservice
.
PathParameter
(
"devops"
,
"projectId"
))
.
Param
(
webservice
.
PathParameter
(
"pipelines"
,
"pipelineId"
))
.
Param
(
webservice
.
PathParameter
(
"branches"
,
"branchName"
))
.
Returns
(
http
.
StatusOK
,
"ok"
,
[]
devops
.
SonarStatus
{})
.
Writes
([]
devops
.
SonarStatus
{}))
webservice
.
Route
(
webservice
.
DELETE
(
"/devops/{devops}/pipelines/{pipelines}"
)
.
...
...
pkg/models/devops/common.go
浏览文件 @
d42f886f
...
...
@@ -314,9 +314,9 @@ func CheckProjectUserInRole(username, projectId string, roles []string) error {
return
nil
}
func
GetProjectUserRole
(
username
,
projectId
string
)
(
string
,
error
)
{
func
GetProjectUserRole
(
username
,
projectId
string
)
(
string
,
error
)
{
if
username
==
KS_ADMIN
{
return
ProjectOwner
,
nil
return
ProjectOwner
,
nil
}
dbconn
:=
devops_mysql
.
OpenDatabase
()
membership
:=
&
DevOpsProjectMembership
{}
...
...
@@ -326,8 +326,8 @@ func GetProjectUserRole(username, projectId string) (string ,error) {
db
.
Eq
(
DevOpsProjectMembershipUsernameColumn
,
username
),
db
.
Eq
(
DevOpsProjectMembershipProjectIdColumn
,
projectId
)))
.
LoadOne
(
membership
)
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
return
membership
.
Role
,
nil
return
membership
.
Role
,
nil
}
pkg/models/tenant/devops.go
浏览文件 @
d42f886f
...
...
@@ -254,7 +254,7 @@ func CreateDevopsProject(username string, workspace string, req *devops.DevOpsPr
}
func
GetUserDevopsSimpleRules
(
username
,
projectId
string
)
([]
models
.
SimpleRule
,
error
)
{
role
,
err
:=
devops
.
GetProjectUserRole
(
username
,
projectId
)
role
,
err
:=
devops
.
GetProjectUserRole
(
username
,
projectId
)
if
err
!=
nil
{
glog
.
Errorf
(
"%+v"
,
err
)
return
nil
,
restful
.
NewError
(
http
.
StatusForbidden
,
err
.
Error
())
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录