阿里云首页 云效2020

常见问题FAQ

下面的示例主要是Java语言的示例,更多语言的示例参考这个地址

https://api.aliyun.com/#/?product=devops-rdc&version=2020-03-03&api=ListPipelines&tab=DEMO&lang=GO

标题:执行流水线的api ExecutePipeline

回复:1、普通模式的流水线如果不传递分支运行时使用的是输入源默认配置的分支。那直接传递流水线id就可以

2、普通模式的流水线如果指定分支运行,需要传递参数见截图示例,参数key是输入源的名称,可以从network中获取,一旦流水线的输入源确定了固定了,这个值就固定了不会变了,分支就是根据自己需要传就可以;

3、分支模式的流水线目前还不支持通过api触发

api1api2

//运行流水线 //方法名:ExecutePipeline public static void main (String args[]) throws ClientException {

DefaultProfile profile = DefaultProfile.getProfile(

"cn-hangzhou", // 地域ID "LTAIaaaaaaaaaaaacq9", // RAM账号的AccessKey ID: "e0ybbbbbbbbbbbbbbbbA"); // RAM账号Access Key Secret IAcsClient client = new DefaultAcsClient(profile); ExecutePipelineRequest executePipelineRequest = new ExecutePipelineRequest(); executePipelineRequest.setSysEndpoint("api-devops.cn-beijing.aliyuncs.com"); executePipelineRequest.setOrgId("5ef1887c87f8da7d5e937200"); executePipelineRequest.setPipelineId((long) 1039); JSONObject body = new JSONObject(); body.put("125867-demo111_imageecs_lIWV", "dev"); executePipelineRequest.setParameters(body.toString()); ExecutePipelineResponse listPipelinesResponse = client.getAcsResponse(executePipelineRequest); System.out.println(listPipelinesResponse.getObject()); }

}

标题:查看流水线列表的api ListPipelines

回复:api3

public class ListPipelines {

//查看流水线列表 //方法名:ListPipelines public static void main (String args[]) throws ClientException {

DefaultProfile profile = DefaultProfile.getProfile(

"cn-hangzhou", // 地域ID "LTAIaaaaaaaaaaaaaaaaa9", // RAM账号的AccessKey ID: "e0ymbbbbbbbbbbbbbbbbbbbbbbbbbZ7A"); // RAM账号Access Key Secret IAcsClient client = new DefaultAcsClient(profile); ListPipelinesRequest listPipelinesRequest = new ListPipelinesRequest(); listPipelinesRequest.setSysEndpoint("api-devops.cn-beijing.aliyuncs.com"); listPipelinesRequest.setOrgId("5ef1887c87f8da7d5e937200"); listPipelinesRequest.setPageSize(100); listPipelinesRequest.setPageStart(0); ListPipelinesResponse listPipelinesResponse = client.getAcsResponse(listPipelinesRequest); System.out.println(listPipelinesResponse.getObject()); }

}