工作流

注意事项

  • 目前仅支持 GitLab 的 commitId 查询

请求

Query

正常返回

  1. [{
  2. "task_id": 1,
  3. "url":"xxx",
  4. "status": "created",
  5. "create_time": 1592569298,
  6. "start_time": 1592569298,
  7. "end_time": 1592569298
  8. }]

output

参数名 类型 描述
task_id int64 任务id
url string 具体url
status string 任务状态
create_time int64 任务创建时间
start_time int64 任务开始时间
end_time int64 任务结束时间

错误码对应列表

  1. {
  2. "resultCode":401,"errorMsg":"auth failed!",
  3. "resultCode":400,"errorMsg":"param is illegal!"
  4. }

注意事项

  • 需要有工作流任务重试的权限;

请求

  1. POST /api/directory/workflowTask/id/:id/pipelines/:name/restart

路径参数说明

参数名 类型 描述 默认值 是否必须
id int 任务id must
name string 工作流名称 must

正常返回

output

错误码对应列表

  1. {
  2. "resultCode":0,"errorMsg":"success",
  3. "resultCode":401,"errorMsg":"auth failed!",
  4. "resultCode":403,"errorMsg":"forbidden"
  5. }

注意事项

  • 需要有取消工作流任务的权限;

请求

  1. POST /api/directory/workflowTask/id/:id/pipelines/:name/cancel

路径参数说明

参数名 类型 描述 默认值 是否必须
id int 任务id must
name string 工作流名称 must

正常返回

  1. {
  2. "resultCode": 0,
  3. "errorMsg": "success"
  4. }

output

参数名 类型 描述
resultCode int 返回码
errorMsg string 错误信息

错误码对应列表

注意事项

  • 需要有创建工作流任务的权限;
  • 暂不支持更新环境变量;
  • 暂不支持高级选项,如工作流空间缓存和 Docker 缓存。

请求

  1. POST /api/directory/workflowTask/create

body 参数样例

  1. "workflow_name":"autoproject-workflow-dev",
  2. "env_name":"dev",
  3. "targets":[
  4. {
  5. "name":"redis3",
  6. "build":{
  7. "repos":[
  8. {
  9. "repo_name":"voting-app",
  10. "branch":"master",
  11. "pr":0
  12. },
  13. {
  14. "branch":"master",
  15. "pr":0
  16. },
  17. {
  18. "repo_name":"hello-gerrit2",
  19. "branch":"master",
  20. "pr":0
  21. }
  22. ]
  23. }
  24. }
  25. ]
  26. }

body参数说明

TargetArgs 参数说明
参数名 类型 描述 默认值 是否必须
name string 服务名称 must
build BuildArgs 构建参数 must
BuildArgs 参数说明
参数名 类型 描述 默认值 是否必须
repos [] 关联代码库信息 must
Repository 参数说明

正常返回

  1. {
  2. "workflow_name":"autoproject-workflow-dev",
  3. "task_id":967

返回数据说明

参数名 类型 描述
string 工作流名称
task_id int 任务编号

错误码对应列表