注意事项

  • 目前仅支持 GitLab 的 commitId 查询
  • 支持完整的 commitId 或者输入 commitId 前 8 位查询

请求

Query

正常返回

  1. [
  2. {
  3. "task_id": 49,
  4. "create_time": 1639466317,
  5. "start_time": 1639466318,
  6. "end_time": 1639466354,
  7. "url": "http://my.zadig.com/v1/projects/detail/proxy/pipelines/multi/workflow-demo/49"
  8. }
  9. ]

返回说明

参数名类型描述
task_idint64任务 id
urlstring任务具体 url
statusstring任务状态
create_timeint64Unix 时间戳格式的任务创建时间
start_timeint64Unix 时间戳格式的任务开始时间
end_timeint64Unix 时间戳格式的任务结束时间

错误码对应列表

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

注意事项

  • 需要有执行工作流的权限
  • 支持对状态是 failed(失败)/timeout(超时)/cancelled(取消) 的工作流任务进行重试

请求

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

路径参数说明

参数名类型描述默认值是否必须
idint任务 id
pipelineNamestring工作流名称

正常返回

  1. {"message":"success"}

异常返回

注意事项

  • 需要有执行工作流的权限;

请求

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

路径参数说明

参数名类型描述默认值是否必须
idint任务 id
pipelineNamestring工作流名称

正常返回

  1. {"message":"success"}

异常返回

  1. {
  2. "code": 6163,
  3. "description": "mongo: no documents in result",
  4. "extra": {},
  5. "message": "取消工作流任务失败",
  6. "type": "error"
  7. }

注意事项

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

请求

  1. POST /api/directory/workflowTask/create

body 参数样例

body 参数说明

参数名类型描述默认值是否必须
workflow_namestring工作流名称must
env_namestring集成环境名称must
targets[]TargetArgs构建参数option
release_images[]分发镜像信息option
callbackCallback工作流执行完成回调信息option

targets 和 release_images 必须有一个参数存在

TargetArgs 参数说明
BuildArgs 参数说明
参数名类型描述默认值是否必须
repos[]关联代码库信息must
Repository 参数说明
参数名类型描述默认值是否必须
repo_namestring代码库名称must
string分支must
printpr ID0使用 pr 构建时必传
Image 参数说明
参数名类型描述默认值是否必须
imagestring镜像信息must
service_namestring服务名称must
service_modulestring服务组件must
Callback 参数说明
参数名类型描述默认值是否必须
callback_urlstring回调地址must
callback_varsmap[string]Any回调参数optional

正常返回

  1. {
  2. "project_name": "test-project",
  3. "workflow_name": "test-project-workflow-dev",
  4. "task_id": 74
  5. }

异常返回

  1. {
  2. "code": 6540,
  3. "description": "workflow [hello-world-workflow-dev] 在项目 [hellow-world] 中已经存在!",
  4. "extra": {},
  5. "message": "新建或更新wokflow失败",
  6. "type": "error"
  7. }

请求

  1. GET /api/directory/workflowTask/id/:id/pipelines/:pipelineName

路径参数说明

正常返回

  1. {
  2. "workflow_name": "test-project-workflow-dev",
  3. "env_name": "dev",
  4. "targets": [
  5. {
  6. "name": "gss-1",
  7. "service_type": "helm",
  8. "build": {
  9. {
  10. "repo_name": "hzx-test",
  11. "branch": "main",
  12. "pr": 0
  13. }
  14. ]
  15. }
  16. },
  17. {
  18. "name": "gss-2",
  19. "service_type": "helm",
  20. "build": {
  21. "repos": [
  22. {
  23. "repo_name": "hzx-test",
  24. "branch": "main",
  25. "pr": 0
  26. ]
  27. }
  28. }
  29. ],
  30. "images": [
  31. {
  32. "image": "ccr.ccs.tencentyun.com/trial/go-sample-site:20211221120415-1-main",
  33. "service_name": "gss-1",
  34. "registry_repo" : "https://ccr.ccs.tencentyun.com/trial"
  35. },
  36. {
  37. "image": "ccr.ccs.tencentyun.com/trial/go-sample-site:20211221120415-1-main",
  38. "service_name": "gss-2",
  39. "registry_repo" : "https://ccr.ccs.tencentyun.com/trial"
  40. }
  41. ],
  42. "test_reports": [
  43. {
  44. "test_name": "test",
  45. "function_test_report": {
  46. "tests": 24,
  47. "successes": 24,
  48. "failures": 0,
  49. "skips": 0,
  50. "errors": 0,
  51. "detail_url": "/v1/projects/detail/test-project/pipelines/multi/testcase/test-project-workflow-dev/51/test/test-project-workflow-dev-51-test?is_workflow=1&service_name=test&test_type=function"
  52. }
  53. }
  54. ],
  55. }

返回说明

参数名类型描述
workflow_namestring工作流名称
env_namestring环境名称
statusstring任务状态
targets[]构建参数
images[]Image构建生成的镜像信息
test_reports[]测试报告信息
Image 参数说明
参数名类型描述
imagestring镜像地址
service_namestring服务名称
registry_repostring镜像仓库
TestReport 参数说明
参数名类型描述
test_namestring测试名称
function_test_reportFunctionTestReport功能测试报告概览
FunctionTestReport 参数说明
参数名类型描述
testsint测试用例数量
successesint成功数量
failuresint失败数量
skipsint跳过数量
errorsint错误数量
string测试报告详情url

异常返回