未验证 提交 39e8de7d 编写于 作者: S soulseen

update devops api doc & remove not used api

Signed-off-by: Nsoulseen <sunzhu@yunify.com>
上级 72875c78
......@@ -30,7 +30,7 @@ const jenkinsHeaderPre = "X-"
func GetPipeline(req *restful.Request, resp *restful.Response) {
projectName := req.PathParameter("devops")
pipelineName := req.PathParameter("pipelines")
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("pipelineName")
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("pipelineName")
branchName := req.PathParameter("branchName")
runId := req.PathParameter("runId")
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("pipelineName")
branchName := req.PathParameter("branchName")
runId := req.PathParameter("runId")
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("pipelineName")
branchName := req.PathParameter("branchName")
runId := req.PathParameter("runId")
nodeId := req.PathParameter("nodeId")
stepId := req.PathParameter("stepId")
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("pipelineName")
runId := req.PathParameter("runId")
nodeId := req.PathParameter("nodeId")
stepId := req.PathParameter("stepId")
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("scmId")
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("scmId")
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("scmId")
organizationId := req.PathParameter("organizationId")
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("pipelineName")
branchName := req.PathParameter("branchName")
runId := req.PathParameter("runId")
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("pipelineName")
runId := req.PathParameter("runId")
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("pipelineName")
branchName := req.PathParameter("branchName")
runId := req.PathParameter("runId")
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("pipelineName")
runId := req.PathParameter("runId")
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("pipelineName")
branchName := req.PathParameter("branchName")
runId := req.PathParameter("runId")
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("pipelineName")
runId := req.PathParameter("runId")
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("pipelineName")
branchName := req.PathParameter("branchName")
runId := req.PathParameter("runId")
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("pipelineName")
runId := req.PathParameter("runId")
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("pipelineName")
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("pipelineName")
branchName := req.PathParameter("branchName")
runId := req.PathParameter("runId")
nodeId := req.PathParameter("nodeId")
stepId := req.PathParameter("stepId")
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("pipelineName")
runId := req.PathParameter("runId")
nodeId := req.PathParameter("nodeId")
stepId := req.PathParameter("stepId")
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("pipelineName")
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("pipelineName")
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("pipelineName")
branchName := req.PathParameter("branchName")
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("pipelineName")
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("pipelineName")
runId := req.PathParameter("runId")
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("pipelineName")
branchName := req.PathParameter("branchName")
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("pipelineName")
runId := req.PathParameter("runId")
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("pipelineName")
branchName := req.PathParameter("branchName")
runId := req.PathParameter("runId")
nodeId := req.PathParameter("nodeId")
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("pipelineName")
runId := req.PathParameter("runId")
nodeId := req.PathParameter("nodeId")
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("pipelineName")
branchName := req.PathParameter("branchName")
runId := req.PathParameter("runId")
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("pipelineName")
runId := req.PathParameter("runId")
projectName := req.PathParameter("devops")
pipelineName := req.PathParameter("pipeline")
runId := req.PathParameter("run")
res, err := devops.GetNodesDetail(projectName, pipelineName, runId, req.Request)
if err != nil {
......
......@@ -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)
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册