云服务器内容精选

  • 请求示例 POST https://{endpoint}/v3/templates/task { "flow" : { "initial" : { "state_3" : "always" }, "state_3" : { "state_4" : "always" }, "state_4" : { "state_5" : "always", "Task_1" : "always", "Task_2" : "always" }, "state_5" : { "final" : "always" } }, "states" : { "initial" : { "type" : "stage", "name" : "initial", "module_or_template_id" : null, "module_or_template_name" : null, "display_name" : "Initial", "dsl_method" : "initial", "parameters" : { "display" : "hidden" }, "params" : null, "is_manual_mxecution" : false, "execution_mode" : "parallel" }, "state_3" : { "type" : "stage", "name" : "state_3", "module_or_template_id" : null, "module_or_template_name" : null, "display_name" : "Source", "dsl_method" : "source", "parameters" : null, "params" : null, "is_manual_execution" : false, "execution_mode" : "parallel" }, "Task_1" : { "type" : "task", "name" : "Task_1", "module_or_template_id" : "00012", "module_or_template_name" : "Maven", "display_name" : "Build_Task", "dsl_method" : "buildJob", "parameters" : { "__repository__" : { "repo_name" : "fdfdfdf", "url" : "git@example.com:CloudPipelineTest-Copy00001/fdfdfdf.git" } }, "params" : null, "is_manual_execution" : false, "execution_mode" : null, "job_parameter_palidate" : true, "is_show_code_hub_url" : false, "is_execute" : true, "job_id" : "00012", "job_name" : "Maven", "project_id" : "4719b59466624abfbae0f83c3ce3a0dc" }, "Task_2" : { "type" : "task", "name" : "Task_2", "module_or_template_id" : "d7dffaefb6d94c63a09cf141668356c7", "module_or_template_name" : "codecheck_template", "display_name" : "Code_Check_Task", "dsl_method" : "codeCheck", "parameters" : { "language" : { "disable" : null, "name" : "Java", "display_name" : "Java", "id" : "782aade71ffb4ab780303555eb2e4825", "language" : "java" }, "codeBranch" : "master", "__repository__" : { "repo_name" : "fdfdfdf", "url" : "git@example.com:CloudPipelineTest-Copy00001/fdfdfdf.git" } }, "params" : null, "is_manual_execution" : false, "execution_mode" : null, "job_parameter_palidate" : true, "is_show_code_hub_url" : false, "is_execute" : true, "job_id" : "d7dffaefb6d94c63a09cf141668356c7", "job_name" : "codecheck_template", "project_id" : "4719b59466624abfbae0f83c3ce3a0dc" }, "state_4" : { "type" : "stage", "name" : "state_4", "module_or_template_id" : null, "module_or_template_name" : null, "display_name" : "Build_and_Check", "dsl_method" : "build", "parameters" : null, "params" : null, "is_manual_mxecution" : false, "execution_mode" : "parallel" }, "state_5" : { "type" : "stage", "name" : "state_5", "module_or_template_id" : null, "module_or_template_name" : null, "display_name" : "Release", "dsl_method" : "release", "parameters" : null, "params" : null, "is_manual_mxecution" : false, "execution_mode" : "parallel" }, "final" : { "type" : "stage", "name" : "final", "module_or_template_id" : null, "module_or_template_name" : null, "display_name" : "Final", "dsl_method" : "final", "parameters" : null, "params" : null, "is_manual_mxecution" : false, "execution_mode" : "parallel" } }, "workflow" : { "parameter" : [ { "name" : "serviceName", "value" : "pipeline-20201229165622", "description" : "this is a text type param", "paramtype" : "normalparam", "display_name" : null, "isStatic" : true, "isDefault" : true, "constraints" : null }, { "name" : "releaseVersion", "value" : "1.0.0", "description" : "this is a growth type param", "paramtype" : "growthparam", "display_name" : null, "isStatic" : false, "isDefault" : true, "constraints" : null } ], "source" : [ { "scmType" : "codehub", "codeHubName" : "fdfdfdf", "hookFlag" : false, "branches" : [ ], "defaultBranch" : "master", "branch" : "", "codeHubId" : "5224040", "gitUrl" : "git@example.com:CloudPipelineTest-Copy00001/fdfdfdf.git", "webUrl" : "https://example.com/codehub/project/bc97c4d99c7d4f98bb6cd104a77fddd6/codehub/140000127/home", "branchList" : [ "master" ] } ], "name" : "pipeline-123123", "description" : "", "project_id" : "bc97c4d99c7d4f98bb6cd104a77fddd6", "project_name" : "CloudPipelineTest-Copy" }, "changeInfo" : null }
  • 请求示例 获取流水线列表。 指定查询的项目ID为”e12ed176898d4841aa9881fe9b933c87”,创建人ID为”847a5317086c41798469d0868535943a”,并根据流水线名称降序排序。 POST https://{endpoint}/v3/pipelines/list { "pipeline_name" : "", "project_ids" : "e12ed176898d4841aa9881fe9b933c87", "creator_ids" : "847a5317086c41798469d0868535943a", "executor_ids" : "847a5317086c41798469d0868535943a", "status" : "waiting,running,verifying,handling,suspending,completed", "outcome" : "error,success,aborted", "sort_key" : "pipeline_name", "sort_dir" : "desc", "git_url" : "", "offset" : 4, "limit" : 10 }
  • 响应示例 状态码: 200 OK { "offset" : 0, "limit" : 10, "total" : 88, "result" : [ { "project_id" : "e12ed176898d4841aa9881fe9b933c87", "project_name" : "Pipeline_Beta_自动测试", "pipeline_id" : "d33f98177c3e44f8841b005e1badcaed", "pipeline_name" : "马云多仓", "creator_id" : "847a5317086c41798469d0868535943a", "creator_name" : "大Beta测试账号", "executor_id" : "847a5317086c41798469d0868535943a", "executor_name" : "大Beta测试账号", "start_time" : "2022-09-08 17:08:02", "create_time" : "2022-07-28 17:02:11", "watched" : "true" }, { "project_id" : "e12ed176898d4841aa9881fe9b933c87", "project_name" : "Pipeline_Beta_自动测试", "pipeline_id" : "2ec08a45031c4d2896292a48b7fb1a30", "pipeline_name" : "门禁专用测试_勿删", "creator_id" : "847a5317086c41798469d0868535943a", "creator_name" : "大Beta测试账号", "executor_id" : "847a5317086c41798469d0868535943a", "executor_name" : "大Beta测试账号", "start_time" : "2022-09-08 16:52:03", "create_time" : "2020-10-29 17:05:02", "watched" : "true" } ] }
  • 请求参数 表1 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token,通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 表2 请求Body参数 参数 是否必选 参数类型 描述 pipeline_name 否 String 流水线名字。查询时进行模糊匹配。 project_ids 否 String 项目id,有多个值时用逗号分隔,id个数取值[0,10],非必选。如果该参数有值,则获取对应项目下的流水线列表;如果没有值,则获取用户有权限的所有项目的流水线列表 creator_ids 否 String 创建人id,有多个值时用逗号分隔,id个数取值[0,10],非必选 executor_ids 否 String 执行人id。有多个值时用逗号分隔,id个数取值[0,10],非必选 status 否 String 流水线运行状态.取值和含义:waiting:等待;running:执行中;verifying:待审核;suspending:挂起;completed:完成 outcome 否 String 流水线执行结果。取值及含义:success:成功;error:失败;aborted:终止 sort_key 否 String 用于排序的字段。取值为:pipeline_name,create_time,start_time sort_dir 否 String 排序方式。asc按排序字段升序,desc按排序字段降序 git_url 否 String 代码仓地址。仅支持codehub仓库,如:git@codehub.XXX.git offset 否 Integer 偏移量。表示从此偏移量开始查询,offset大于等于0,默认取值为0 limit 否 Integer 每次查询的条目数量。取值[10-50],默认取值为10
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 offset Integer 偏移量,表示从此偏移量开始查询,offset大于等于0 limit Integer 每次查询的条目数量 total Integer 总条目数量 result Array of PipelineBasicInfo objects 流水线列表 表4 PipelineBasicInfo 参数 参数类型 描述 project_id String 项目id project_name String 项目名称 pipeline_id String 流水线id pipeline_name String 流水线名称 creator_id String 流水线创建人id creator_name String 流水线创建人名字 executor_id String 流水线执行人id executor_name String 流水线执行人名字 start_time String 启动时间 create_time String 创建时间 watched String 用户是否关注流水线:true(关注),false(未关注) 状态码: 400 表5 响应Body参数 参数 参数类型 描述 error_msg String 错误信息 error_code String 错误码