Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
水淹萌龙
kubesphere
提交
39e8de7d
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
39e8de7d
编写于
6月 21, 2019
作者:
S
soulseen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update devops api doc & remove not used api
Signed-off-by:
N
soulseen
<
sunzhu@yunify.com
>
上级
72875c78
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
299 addition
and
389 deletion
+299
-389
pkg/apis/devops/v1alpha2/register.go
pkg/apis/devops/v1alpha2/register.go
+195
-225
pkg/apiserver/devops/devops.go
pkg/apiserver/devops/devops.go
+101
-134
pkg/models/devops/devops.go
pkg/models/devops/devops.go
+3
-26
pkg/models/devops/urlconfig.go
pkg/models/devops/urlconfig.go
+0
-4
未找到文件。
pkg/apis/devops/v1alpha2/register.go
浏览文件 @
39e8de7d
此差异已折叠。
点击以展开。
pkg/apiserver/devops/devops.go
浏览文件 @
39e8de7d
...
...
@@ -30,7 +30,7 @@ const jenkinsHeaderPre = "X-"
func
GetPipeline
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"devops"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
s
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
res
,
err
:=
devops
.
GetPipeline
(
projectName
,
pipelineName
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -54,8 +54,8 @@ func SearchPipelines(req *restful.Request, resp *restful.Response) {
}
func
SearchPipelineRuns
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
res
,
err
:=
devops
.
SearchPipelineRuns
(
projectName
,
pipelineName
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -68,10 +68,10 @@ func SearchPipelineRuns(req *restful.Request, resp *restful.Response) {
}
func
GetBranchPipelineRun
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
branchName
:=
req
.
PathParameter
(
"branch
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
branchName
:=
req
.
PathParameter
(
"branch"
)
runId
:=
req
.
PathParameter
(
"run"
)
res
,
err
:=
devops
.
GetBranchPipelineRun
(
projectName
,
pipelineName
,
branchName
,
runId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -84,10 +84,10 @@ func GetBranchPipelineRun(req *restful.Request, resp *restful.Response) {
}
func
GetPipelineRunNodesbyBranch
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
branchName
:=
req
.
PathParameter
(
"branch
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
branchName
:=
req
.
PathParameter
(
"branch"
)
runId
:=
req
.
PathParameter
(
"run"
)
res
,
err
:=
devops
.
GetPipelineRunNodesbyBranch
(
projectName
,
pipelineName
,
branchName
,
runId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -100,12 +100,12 @@ func GetPipelineRunNodesbyBranch(req *restful.Request, resp *restful.Response) {
}
func
GetBranchStepLog
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
branchName
:=
req
.
PathParameter
(
"branch
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
nodeId
:=
req
.
PathParameter
(
"node
Id
"
)
stepId
:=
req
.
PathParameter
(
"step
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
branchName
:=
req
.
PathParameter
(
"branch"
)
runId
:=
req
.
PathParameter
(
"run"
)
nodeId
:=
req
.
PathParameter
(
"node"
)
stepId
:=
req
.
PathParameter
(
"step"
)
res
,
header
,
err
:=
devops
.
GetBranchStepLog
(
projectName
,
pipelineName
,
branchName
,
runId
,
nodeId
,
stepId
,
req
.
Request
)
...
...
@@ -122,11 +122,11 @@ func GetBranchStepLog(req *restful.Request, resp *restful.Response) {
}
func
GetStepLog
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
nodeId
:=
req
.
PathParameter
(
"node
Id
"
)
stepId
:=
req
.
PathParameter
(
"step
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
runId
:=
req
.
PathParameter
(
"run"
)
nodeId
:=
req
.
PathParameter
(
"node"
)
stepId
:=
req
.
PathParameter
(
"step"
)
res
,
header
,
err
:=
devops
.
GetStepLog
(
projectName
,
pipelineName
,
runId
,
nodeId
,
stepId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -142,7 +142,7 @@ func GetStepLog(req *restful.Request, resp *restful.Response) {
}
func
Validate
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
scmId
:=
req
.
PathParameter
(
"scm
Id
"
)
scmId
:=
req
.
PathParameter
(
"scm"
)
res
,
err
:=
devops
.
Validate
(
scmId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -155,7 +155,7 @@ func Validate(req *restful.Request, resp *restful.Response) {
}
func
GetSCMOrg
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
scmId
:=
req
.
PathParameter
(
"scm
Id
"
)
scmId
:=
req
.
PathParameter
(
"scm"
)
res
,
err
:=
devops
.
GetSCMOrg
(
scmId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -168,8 +168,8 @@ func GetSCMOrg(req *restful.Request, resp *restful.Response) {
}
func
GetOrgRepo
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
scmId
:=
req
.
PathParameter
(
"scm
Id
"
)
organizationId
:=
req
.
PathParameter
(
"organization
Id
"
)
scmId
:=
req
.
PathParameter
(
"scm"
)
organizationId
:=
req
.
PathParameter
(
"organization"
)
res
,
err
:=
devops
.
GetOrgRepo
(
scmId
,
organizationId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -182,10 +182,10 @@ func GetOrgRepo(req *restful.Request, resp *restful.Response) {
}
func
StopBranchPipeline
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
branchName
:=
req
.
PathParameter
(
"branch
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
branchName
:=
req
.
PathParameter
(
"branch"
)
runId
:=
req
.
PathParameter
(
"run"
)
res
,
err
:=
devops
.
StopBranchPipeline
(
projectName
,
pipelineName
,
branchName
,
runId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -198,9 +198,9 @@ func StopBranchPipeline(req *restful.Request, resp *restful.Response) {
}
func
StopPipeline
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
runId
:=
req
.
PathParameter
(
"run"
)
res
,
err
:=
devops
.
StopPipeline
(
projectName
,
pipelineName
,
runId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -213,10 +213,10 @@ func StopPipeline(req *restful.Request, resp *restful.Response) {
}
func
ReplayBranchPipeline
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
branchName
:=
req
.
PathParameter
(
"branch
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
branchName
:=
req
.
PathParameter
(
"branch"
)
runId
:=
req
.
PathParameter
(
"run"
)
res
,
err
:=
devops
.
ReplayBranchPipeline
(
projectName
,
pipelineName
,
branchName
,
runId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -229,9 +229,9 @@ func ReplayBranchPipeline(req *restful.Request, resp *restful.Response) {
}
func
ReplayPipeline
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
runId
:=
req
.
PathParameter
(
"run"
)
res
,
err
:=
devops
.
ReplayPipeline
(
projectName
,
pipelineName
,
runId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -244,10 +244,10 @@ func ReplayPipeline(req *restful.Request, resp *restful.Response) {
}
func
GetBranchRunLog
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
branchName
:=
req
.
PathParameter
(
"branch
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
branchName
:=
req
.
PathParameter
(
"branch"
)
runId
:=
req
.
PathParameter
(
"run"
)
res
,
err
:=
devops
.
GetBranchRunLog
(
projectName
,
pipelineName
,
branchName
,
runId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -259,9 +259,9 @@ func GetBranchRunLog(req *restful.Request, resp *restful.Response) {
}
func
GetRunLog
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
runId
:=
req
.
PathParameter
(
"run"
)
res
,
err
:=
devops
.
GetRunLog
(
projectName
,
pipelineName
,
runId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -273,10 +273,10 @@ func GetRunLog(req *restful.Request, resp *restful.Response) {
}
func
GetBranchArtifacts
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
branchName
:=
req
.
PathParameter
(
"branch
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
branchName
:=
req
.
PathParameter
(
"branch"
)
runId
:=
req
.
PathParameter
(
"run"
)
res
,
err
:=
devops
.
GetBranchArtifacts
(
projectName
,
pipelineName
,
branchName
,
runId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -288,9 +288,9 @@ func GetBranchArtifacts(req *restful.Request, resp *restful.Response) {
}
func
GetArtifacts
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
runId
:=
req
.
PathParameter
(
"run"
)
res
,
err
:=
devops
.
GetArtifacts
(
projectName
,
pipelineName
,
runId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -302,8 +302,8 @@ func GetArtifacts(req *restful.Request, resp *restful.Response) {
}
func
GetPipeBranch
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
res
,
err
:=
devops
.
GetPipeBranch
(
projectName
,
pipelineName
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -315,12 +315,12 @@ func GetPipeBranch(req *restful.Request, resp *restful.Response) {
}
func
CheckBranchPipeline
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
branchName
:=
req
.
PathParameter
(
"branch
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
nodeId
:=
req
.
PathParameter
(
"node
Id
"
)
stepId
:=
req
.
PathParameter
(
"step
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
branchName
:=
req
.
PathParameter
(
"branch"
)
runId
:=
req
.
PathParameter
(
"run"
)
nodeId
:=
req
.
PathParameter
(
"node"
)
stepId
:=
req
.
PathParameter
(
"step"
)
res
,
err
:=
devops
.
CheckBranchPipeline
(
projectName
,
pipelineName
,
branchName
,
runId
,
nodeId
,
stepId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -332,11 +332,11 @@ func CheckBranchPipeline(req *restful.Request, resp *restful.Response) {
}
func
CheckPipeline
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
nodeId
:=
req
.
PathParameter
(
"node
Id
"
)
stepId
:=
req
.
PathParameter
(
"step
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
runId
:=
req
.
PathParameter
(
"run"
)
nodeId
:=
req
.
PathParameter
(
"node"
)
stepId
:=
req
.
PathParameter
(
"step"
)
res
,
err
:=
devops
.
CheckPipeline
(
projectName
,
pipelineName
,
runId
,
nodeId
,
stepId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -348,8 +348,8 @@ func CheckPipeline(req *restful.Request, resp *restful.Response) {
}
func
GetConsoleLog
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
res
,
err
:=
devops
.
GetConsoleLog
(
projectName
,
pipelineName
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -361,8 +361,8 @@ func GetConsoleLog(req *restful.Request, resp *restful.Response) {
}
func
ScanBranch
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
res
,
err
:=
devops
.
ScanBranch
(
projectName
,
pipelineName
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -374,9 +374,9 @@ func ScanBranch(req *restful.Request, resp *restful.Response) {
}
func
RunBranchPipeline
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
branchName
:=
req
.
PathParameter
(
"branch
Name
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
branchName
:=
req
.
PathParameter
(
"branch"
)
res
,
err
:=
devops
.
RunBranchPipeline
(
projectName
,
pipelineName
,
branchName
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -389,8 +389,8 @@ func RunBranchPipeline(req *restful.Request, resp *restful.Response) {
}
func
RunPipeline
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
res
,
err
:=
devops
.
RunPipeline
(
projectName
,
pipelineName
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -402,39 +402,6 @@ func RunPipeline(req *restful.Request, resp *restful.Response) {
resp
.
Write
(
res
)
}
func
GetBranchStepsStatus
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"projectName"
)
pipelineName
:=
req
.
PathParameter
(
"pipelineName"
)
branchName
:=
req
.
PathParameter
(
"branchName"
)
runId
:=
req
.
PathParameter
(
"runId"
)
nodeId
:=
req
.
PathParameter
(
"nodeId"
)
res
,
err
:=
devops
.
GetBranchStepsStatus
(
projectName
,
pipelineName
,
branchName
,
runId
,
nodeId
,
req
.
Request
)
if
err
!=
nil
{
parseErr
(
err
,
resp
)
return
}
resp
.
Header
()
.
Set
(
restful
.
HEADER_ContentType
,
restful
.
MIME_JSON
)
resp
.
Write
(
res
)
}
func
GetStepsStatus
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"projectName"
)
pipelineName
:=
req
.
PathParameter
(
"pipelineName"
)
runId
:=
req
.
PathParameter
(
"runId"
)
nodeId
:=
req
.
PathParameter
(
"nodeId"
)
res
,
err
:=
devops
.
GetStepsStatus
(
projectName
,
pipelineName
,
runId
,
nodeId
,
req
.
Request
)
if
err
!=
nil
{
parseErr
(
err
,
resp
)
return
}
resp
.
Header
()
.
Set
(
restful
.
HEADER_ContentType
,
restful
.
MIME_JSON
)
resp
.
Write
(
res
)
}
func
GetCrumb
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
res
,
err
:=
devops
.
GetCrumb
(
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -482,9 +449,9 @@ func CheckCron(req *restful.Request, resp *restful.Response) {
}
func
GetPipelineRun
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
runId
:=
req
.
PathParameter
(
"run"
)
res
,
err
:=
devops
.
GetPipelineRun
(
projectName
,
pipelineName
,
runId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -497,9 +464,9 @@ func GetPipelineRun(req *restful.Request, resp *restful.Response) {
}
func
GetBranchPipeline
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
branchName
:=
req
.
PathParameter
(
"branch
Name
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
branchName
:=
req
.
PathParameter
(
"branch"
)
res
,
err
:=
devops
.
GetBranchPipeline
(
projectName
,
pipelineName
,
branchName
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -512,9 +479,9 @@ func GetBranchPipeline(req *restful.Request, resp *restful.Response) {
}
func
GetPipelineRunNodes
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
runId
:=
req
.
PathParameter
(
"run"
)
res
,
err
:=
devops
.
GetPipelineRunNodes
(
projectName
,
pipelineName
,
runId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -526,11 +493,11 @@ func GetPipelineRunNodes(req *restful.Request, resp *restful.Response) {
}
func
GetBranchNodeSteps
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
branchName
:=
req
.
PathParameter
(
"branch
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
nodeId
:=
req
.
PathParameter
(
"node
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
branchName
:=
req
.
PathParameter
(
"branch"
)
runId
:=
req
.
PathParameter
(
"run"
)
nodeId
:=
req
.
PathParameter
(
"node"
)
res
,
err
:=
devops
.
GetBranchNodeSteps
(
projectName
,
pipelineName
,
branchName
,
runId
,
nodeId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -542,10 +509,10 @@ func GetBranchNodeSteps(req *restful.Request, resp *restful.Response) {
}
func
GetNodeSteps
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
nodeId
:=
req
.
PathParameter
(
"node
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
runId
:=
req
.
PathParameter
(
"run"
)
nodeId
:=
req
.
PathParameter
(
"node"
)
res
,
err
:=
devops
.
GetNodeSteps
(
projectName
,
pipelineName
,
runId
,
nodeId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -603,10 +570,10 @@ func GithubWebhook(req *restful.Request, resp *restful.Response) {
}
func
GetBranchNodesDetail
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
branchName
:=
req
.
PathParameter
(
"branch
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
branchName
:=
req
.
PathParameter
(
"branch"
)
runId
:=
req
.
PathParameter
(
"run"
)
res
,
err
:=
devops
.
GetBranchNodesDetail
(
projectName
,
pipelineName
,
branchName
,
runId
,
req
.
Request
)
if
err
!=
nil
{
...
...
@@ -617,9 +584,9 @@ func GetBranchNodesDetail(req *restful.Request, resp *restful.Response) {
}
func
GetNodesDetail
(
req
*
restful
.
Request
,
resp
*
restful
.
Response
)
{
projectName
:=
req
.
PathParameter
(
"
projectName
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline
Name
"
)
runId
:=
req
.
PathParameter
(
"run
Id
"
)
projectName
:=
req
.
PathParameter
(
"
devops
"
)
pipelineName
:=
req
.
PathParameter
(
"pipeline"
)
runId
:=
req
.
PathParameter
(
"run"
)
res
,
err
:=
devops
.
GetNodesDetail
(
projectName
,
pipelineName
,
runId
,
req
.
Request
)
if
err
!=
nil
{
...
...
pkg/models/devops/devops.go
浏览文件 @
39e8de7d
...
...
@@ -138,6 +138,7 @@ func Validate(scmId string, req *http.Request) ([]byte, error) {
baseUrl
:=
fmt
.
Sprintf
(
jenkins
.
Server
+
ValidateUrl
,
scmId
)
log
.
Info
(
"Jenkins-url: "
+
baseUrl
)
req
.
Method
=
http
.
MethodPut
resBody
,
err
:=
sendJenkinsRequest
(
baseUrl
,
req
)
if
err
!=
nil
{
log
.
Error
(
err
)
...
...
@@ -177,6 +178,7 @@ func StopBranchPipeline(projectName, pipelineName, branchName, runId string, req
baseUrl
:=
fmt
.
Sprintf
(
jenkins
.
Server
+
StopBranchPipelineUrl
+
req
.
URL
.
RawQuery
,
projectName
,
pipelineName
,
branchName
,
runId
)
log
.
Info
(
"Jenkins-url: "
+
baseUrl
)
req
.
Method
=
http
.
MethodPut
res
,
err
:=
sendJenkinsRequest
(
baseUrl
,
req
)
if
err
!=
nil
{
log
.
Error
(
err
)
...
...
@@ -190,6 +192,7 @@ func StopPipeline(projectName, pipelineName, runId string, req *http.Request) ([
baseUrl
:=
fmt
.
Sprintf
(
jenkins
.
Server
+
StopPipelineUrl
+
req
.
URL
.
RawQuery
,
projectName
,
pipelineName
,
runId
)
log
.
Info
(
"Jenkins-url: "
+
baseUrl
)
req
.
Method
=
http
.
MethodPut
res
,
err
:=
sendJenkinsRequest
(
baseUrl
,
req
)
if
err
!=
nil
{
log
.
Error
(
err
)
...
...
@@ -368,32 +371,6 @@ func RunPipeline(projectName, pipelineName string, req *http.Request) ([]byte, e
return
res
,
err
}
func
GetBranchStepsStatus
(
projectName
,
pipelineName
,
branchName
,
runId
,
nodeId
string
,
req
*
http
.
Request
)
([]
byte
,
error
)
{
baseUrl
:=
fmt
.
Sprintf
(
jenkins
.
Server
+
GetBranchStepsStatusUrl
+
req
.
URL
.
RawQuery
,
projectName
,
pipelineName
,
branchName
,
runId
,
nodeId
)
log
.
Info
(
"Jenkins-url: "
+
baseUrl
)
res
,
err
:=
sendJenkinsRequest
(
baseUrl
,
req
)
if
err
!=
nil
{
log
.
Error
(
err
)
return
nil
,
err
}
return
res
,
err
}
func
GetStepsStatus
(
projectName
,
pipelineName
,
runId
,
nodeId
string
,
req
*
http
.
Request
)
([]
byte
,
error
)
{
baseUrl
:=
fmt
.
Sprintf
(
jenkins
.
Server
+
GetStepsStatusUrl
+
req
.
URL
.
RawQuery
,
projectName
,
pipelineName
,
runId
,
nodeId
)
log
.
Info
(
"Jenkins-url: "
+
baseUrl
)
res
,
err
:=
sendJenkinsRequest
(
baseUrl
,
req
)
if
err
!=
nil
{
log
.
Error
(
err
)
return
nil
,
err
}
return
res
,
err
}
func
GetCrumb
(
req
*
http
.
Request
)
([]
byte
,
error
)
{
baseUrl
:=
fmt
.
Sprintf
(
jenkins
.
Server
+
GetCrumbUrl
)
log
.
Info
(
"Jenkins-url: "
+
baseUrl
)
...
...
pkg/models/devops/urlconfig.go
浏览文件 @
39e8de7d
...
...
@@ -40,10 +40,6 @@ const (
ReplayPipelineUrl
=
"/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/%s/replay/"
GetBranchArtifactsUrl
=
"/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/runs/%s/artifacts/?"
GetArtifactsUrl
=
"/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/%s/artifacts/?"
GetBranchStepsStatusUrl
=
"/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/runs/%s/nodes/%s/steps/?"
GetStepsStatusUrl
=
"/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/%s/nodes/%s/steps/?"
CheckBranchPipelineUrl
=
"/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/runs/%s/nodes/%s/steps/%s/"
CheckPipelineUrl
=
"/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/%s/nodes/%s/steps/%s/"
GetBranchNodeStepsUrl
=
"/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/runs/%s/nodes/%s/steps/?"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录