创建项目_项目 API列表_API参考_开发指南_CodePipeline

阿里云产品文档 xtyly 4年前 (2016-11-09) 3次浏览 已收录 0个评论

描述说明:在CodePipeline中创建一个项目。请求信息请求行 RequestLine

  1. POST /job/create HTTP/1.1

请求行参数 URI Param

名称 类型 是否必须 描述 JobName String 是 项目名称 DeployType String 是 目前支持且仅支持ecs_deploy、swarm_deploy、k8s_deploy、none_deploy_with_dockerhub、ecs_deploy_aliyunscm、swarm_deploy_aliyunscm、k8s_deploy_aliyunscm JsonContent String 是 项目字段内容

返回信息返回行 ResponseLine

  1. HTTP/1.1 200 OK

返回码 HTTP Status Code

Status Code 描述 201 Created 401 Authentication failed 403 The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource, or may need an account of some sort. 404 Job not found 500 Internal Error

返回体 ResponseBody

  1. {
  2. "RequestId": "string"
  3. }

返回体解释无部署类型说明目前CodePipeline创建项目的API只支持从指定模板创建项目,指定模板包括ecs_deploy、swarm_deploy、k8s_deploy和none_deploy_with_dockerhub。ecs_deploy类型项目的JsonContent字段说明如下:

字段 是否必须 描述 _assignedNode 是 构建节点类型 _name 是 项目名称,必须与JobName相同 _userRemoteConfigs_url 是 代码仓库部分的仓库地址 _userRemoteConfigs_credentialsId 否 代码仓库部分的证书 _branches_name 否 代码分支 _builder_buildcommand_buildComman 否 构建命令 _builder_ecs-deploy_entries_bucket 是 部署ECS部分的目标Bucket _builder_ecs-deploy_entries_sourceFile 是 部署ECS部分的打包上传目录 _builder_ecs-deploy_entries_selectedRegion 是 部署ECS部分的OSS Bucket所在区域 _builder_ecs-deploy_target 是 部署ECS部分的目标机器,多个目标机器请用逗号分隔 _builder_ecs-deploy_arguments 是 部署ECS部分的部署命令 _builder_ecs-deploy_checkcommands 否 部署ECS部分的检查命令 _builder_ecs-deploy_rollbackcommands 否 部署ECS部分的回滚命令 _builder_ecs-deploy_workspace 是 部署ECS部分的工作空间

_assignedNode字段说明:

可选值 说明 slave-java 国内节点 java构建环境 slave-java-cache 国内节点 java构建环境带缓存 slave-java-hk 海外节点 java构建环境 slave-nodejs 国内节点 nodejs构建环境 slave-nodejs-hk 海外节点 nodejs构建环境 slave-php 国内节点 php构建环境 slave-php-hk 海外节点 php构建环境 slave-python 国内节点 python构建环境 slave-python-hk 海外节点 python构建环境 slave-python3 国内节点 python3构建环境 slave-python3-hk 海外节点 python3构建环境 slave-go 国内节点 go构建环境 slave-go-hk 海外节点 go构建环境

JsonContent示例:

  1. {
  2. "_userRemoteConfigs_url": "https://code.aliyun.com/CodePipeline/java-demo.git",
  3. "_branches_name": "*/master",
  4. "_name": "ecs",
  5. "_builder_ecs-deploy_target": "alicloud-deploy-763d877295e03b741b0618ab3a382673",
  6. "_builder_ecs-deploy_entries_sourceFile": "target/demo.war",
  7. "_builder_ecs-deploy_entries_selectedRegion": "cn-beijing",
  8. "_builder_buildcommand_buildComman": "mvn package -B -DskipTestsnmvn test",
  9. "_assignedNode": "slave-java",
  10. "_builder_ecs-deploy_entries_bucket": "test-ossplugin1",
  11. "_builder_ecs-deploy_checkcommands": "",
  12. "_builder_ecs-deploy_workspace": "/tmp",
  13. "_builder_ecs-deploy_rollbackcommands": "",
  14. "_builder_ecs-deploy_arguments": "#!/bin/bashn#以下脚本命令适于ubuntu系统,其他操作系统请自行修改nexport PATH=$PATH:/bin:/usr/binnpwdncd /tmpnapt-get install openjdk-7-jdk -yynwget https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.15/bin/apache-tomcat-8.5.15.tar.gzntar -zxvf apache-tomcat-8.5.15.tar.gz -C /optncp /tmp/demo.war /opt/apache-tomcat-8.5.15/webapps/n/opt/apache-tomcat-8.5.15/bin/shutdown.shn/opt/apache-tomcat-8.5.15/bin/startup.sh",
  15. "_userRemoteConfigs_credentialsId": "demo-id"
  16. }

Java示例

  1. String command = "#!/bin/bashn" +
  2. "#以下脚本命令适于ubuntu系统,其他操作系统请自行修改n" +
  3. "export PATH=$PATH:/bin:/usr/binn" +
  4. "pwdn" +
  5. "cd /tmpn" +
  6. "apt-get install openjdk-7-jdk -yyn" +
  7. "wget https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.15/bin/apache-tomcat-8.5.15.tar.gzn" +
  8. "tar -zxvf apache-tomcat-8.5.15.tar.gz -C /optn" +
  9. "cp /tmp/demo.war /opt/apache-tomcat-8.5.15/webapps/n" +
  10. "/opt/apache-tomcat-8.5.15/bin/shutdown.shn" +
  11. "/opt/apache-tomcat-8.5.15/bin/startup.sh";
  12. Map<String, String> map = new HashMap<String, String>();
  13. map.put("_assignedNode","slave-java");
  14. map.put("_name","ecs");
  15. map.put("_userRemoteConfigs_url","https://code.aliyun.com/CodePipeline/java-demo.git");
  16. map.put("_userRemoteConfigs_credentialsId","demo-id");
  17. map.put("_branches_name","*/master");
  18. map.put("_builder_buildcommand_buildComman","mvn package -B -DskipTestsnmvn test");
  19. map.put("_builder_ecs-deploy_entries_bucket","test-ossplugin1");
  20. map.put("_builder_ecs-deploy_entries_sourceFile","target/demo.war");
  21. map.put("_builder_ecs-deploy_entries_selectedRegion","cn-beijing");
  22. map.put("_builder_ecs-deploy_target","alicloud-deploy-763d877295e03b741b0618ab3a382673");
  23. map.put("_builder_ecs-deploy_arguments",command);
  24. map.put("_builder_ecs-deploy_workspace","/tmp");
  25. map.put("_builder_ecs-deploy_checkcommands","");
  26. map.put("_builder_ecs-deploy_rollbackcommands","");
  27. String jsonStr = JSON.toJSONString(map);
  28. CreateJobRequest createJobRequest = new CreateJobRequest();
  29. try {
  30. createJobRequest.setAcceptFormat(FormatType.JSON);
  31. createJobRequest.setJobName("ecs");
  32. createJobRequest.setDeployType("ecs_deploy");
  33. createJobRequest.setJsonContent(jsonStr);
  34. CreateJobResponse createJobResponse = client.getAcsResponse(createJobRequest);
  35. System.out.println(createJobResponse.getRequestId());
  36. } catch (ServerException e) {
  37. e.printStackTrace();
  38. Assert.fail();
  39. } catch (ClientException e) {
  40. e.printStackTrace();
  41. Assert.fail();
  42. }

创建好的项目配置如图:创建项目_项目 API列表_API参考_开发指南_CodePipeline创建项目_项目 API列表_API参考_开发指南_CodePipeline创建项目_项目 API列表_API参考_开发指南_CodePipeline创建项目_项目 API列表_API参考_开发指南_CodePipeline创建项目_项目 API列表_API参考_开发指南_CodePipelineswarm_deploy类型项目的JsonContent字段说明如下:

字段 是否必须 描述 _assignedNode 是 构建节点类型 _name 是 项目名称,必须与JobName相同 _userRemoteConfigs_url 是 代码仓库部分的仓库地址 _userRemoteConfigs_credentialsId 否 代码仓库部分的证书 _branches_name 否 代码分支 _builder_buildcommand_buildComman 否 构建命令 _builder_docker-hub_repoName 是 docker镜像构建部分的镜像仓库名称 _builder_docker-hub_repoTag 是 docker镜像构建部分的镜像版本号 _builder_docker-hub_registry_url 是 docker镜像构建部分的Registry地址 _builder_docker-hub_registry_credentialsId 是 docker镜像构建部分的Registry证书 _builder_docker-hub_dockerfilePath 是 docker镜像构建部分的Dockerfile路径 _builder_docker-hub_skipTagLatest 否 docker镜像构建部分的是否推送latest标签 _builder_docker-deploy_masterurl 是 部署容器应用部分的集群接入点地址 _builder_docker-deploy_credentialsId 是 部署容器应用部分的集群证书 _builder_docker-deploy_appName 是 部署容器应用部分的应用名称 _builder_docker-deploy_composeTemplate 是 部署容器应用部分的编排模板 _builder_docker-deploy_envFile 是 部署容器应用部分的配置项 _builder_docker-deploy_publishStrategy 是 部署容器应用部分的发布策略

_builder_docker-deploy_publishStrategy字段说明:

可选值 说明 rolling 标准发布 blue-green 蓝绿发布

JsonContent示例:

  1. {
  2. "_userRemoteConfigs_url": "https://code.aliyun.com/CodePipeline/java-demo.git",
  3. "_branches_name": "*/master",
  4. "_builder_docker-deploy_envFile": "",
  5. "_name": "swarm",
  6. "_builder_docker-hub_repoName": "codepipeline/nginx",
  7. "_builder_docker-deploy_appName": "test",
  8. "_builder_docker-deploy_composeTemplate": "docker-compose.yml",
  9. "_builder_buildcommand_buildComman": "mvn package -B -DskipTestsnmvn test",
  10. "_builder_docker-deploy_credentialsId": "demo-docker-id",
  11. "_assignedNode": "slave-java",
  12. "_builder_docker-hub_repoTag": "latest",
  13. "_builder_docker-hub_registry_url": "https://registry.cn-hangzhou.aliyuncs.com/v2/",
  14. "_builder_docker-hub_dockerfilePath": "Dockerfile",
  15. "_builder_docker-hub_registry_credentialsId": "demo-registry-id",
  16. "_builder_docker-deploy_masterurl": "mock_url",
  17. "_builder_docker-deploy_publishStrategy": "rolling",
  18. "_userRemoteConfigs_credentialsId": "demo-id"
  19. }

Java示例

  1. Map map = new HashMap();
  2. map.put("_name","swarm");
  3. map.put("_assignedNode","slave-java");
  4. map.put("_userRemoteConfigs_url","https://code.aliyun.com/CodePipeline/java-demo.git");
  5. map.put("_userRemoteConfigs_credentialsId","demo-id");
  6. map.put("_branches_name","*/master");
  7. map.put("_builder_buildcommand_buildComman","mvn package -B -DskipTestsnmvn test");
  8. map.put("_builder_docker-hub_repoName","codepipeline/nginx");
  9. map.put("_builder_docker-hub_repoTag","latest");
  10. map.put("_builder_docker-hub_registry_url","https://registry.cn-hangzhou.aliyuncs.com/v2/");
  11. map.put("_builder_docker-hub_registry_credentialsId","demo-registry-id");
  12. map.put("_builder_docker-hub_dockerfilePath","Dockerfile");
  13. map.put("_builder_docker-deploy_masterurl","mock_url");
  14. map.put("_builder_docker-deploy_credentialsId","demo-docker-id");
  15. map.put("_builder_docker-deploy_appName","test");
  16. map.put("_builder_docker-deploy_composeTemplate","docker-compose.yml");
  17. map.put("_builder_docker-deploy_envFile","");
  18. map.put("_builder_docker-deploy_publishStrategy","rolling");
  19. String jsonStr = JSON.toJSONString(map);
  20. System.out.println(jsonStr);
  21. CreateJobRequest createJobRequest = new CreateJobRequest();
  22. try {
  23. createJobRequest.setAcceptFormat(FormatType.JSON);
  24. createJobRequest.setJobName("swarm");
  25. createJobRequest.setDeployType("swarm_deploy");
  26. createJobRequest.setJsonContent(jsonStr);
  27. CreateJobResponse createJobResponse = client.getAcsResponse(createJobRequest);
  28. System.out.println(createJobResponse.getRequestId());
  29. } catch (ServerException e) {
  30. e.printStackTrace();
  31. Assert.fail();
  32. } catch (ClientException e) {
  33. e.printStackTrace();
  34. Assert.fail();
  35. }

创建好的项目配置如图:创建项目_项目 API列表_API参考_开发指南_CodePipeline创建项目_项目 API列表_API参考_开发指南_CodePipelinek8s_deploy类型项目的JsonContent字段说明如下:

字段 是否必须 描述 _assignedNode 是 构建节点类型 _name 是 项目名称,必须与JobName相同 _userRemoteConfigs_url 是 代码仓库部分的仓库地址 _userRemoteConfigs_credentialsId 否 代码仓库部分的证书 _branches_name 否 代码分支 _builder_buildcommand_buildComman 否 构建命令 _builder_docker-hub_repoName 是 docker镜像构建部分的镜像仓库名称 _builder_docker-hub_repoTag 是 docker镜像构建部分的镜像版本号 _builder_docker-hub_registry_url 是 docker镜像构建部分的Registry地址 _builder_docker-hub_registry_credentialsId 是 docker镜像构建部分的Registry证书 _builder_docker-hub_dockerfilePath 是 docker镜像构建部分的Dockerfile路径 _builder_docker-hub_skipTagLatest 否 docker镜像构建部分的是否推送latest标签 _builder_kubes-deploy_authMethod 是 部署Kubernetes部分的认证方式 _builder_kubes-deploy_apiServerUrl 是 部署Kubernetes部分的API服务器地址 _builder_kubes-deploy_credentialsId 是 部署Kubernetes部分的证书 _builder_kubes-deploy_config 是 部署Kubernetes部分的部署配置文件 _builder_kubes-deploy_statusCheckConfig 是 部署Kubernetes部分的状态检查配置 _builder_kubes-deploy_variableState 是 部署Kubernetes部分的变量声明配置

_builder_kubes-deploy_authMethod字段说明:

可选值 说明 certs 证书认证 userPassword 用户名密码认证 token Token认证

JsonContent示例:

  1. {
  2. "_userRemoteConfigs_url": "https://code.aliyun.com/CodePipeline/java-demo.git",
  3. "_branches_name": "*/master",
  4. "_builder_kubes-deploy_statusCheckConfig": "deployments:ds1,ds2",
  5. "_name": "k8s",
  6. "_builder_docker-hub_repoName": "codepipeline/nginx",
  7. "_builder_buildcommand_buildComman": "mvn package -B -DskipTestsnmvn test",
  8. "_assignedNode": "slave-java",
  9. "_builder_docker-hub_repoTag": "latest",
  10. "_builder_kubes-deploy_credentialsId": "demo-docker-id",
  11. "_builder_docker-hub_registry_url": "https://registry.cn-hangzhou.aliyuncs.com/v2/",
  12. "_builder_docker-hub_dockerfilePath": "Dockerfile",
  13. "_builder_kubes-deploy_apiServerUrl": "mock_url",
  14. "_builder_kubes-deploy_authMethod": "certs",
  15. "_builder_docker-hub_registry_credentialsId": "demo-registry-id",
  16. "_userRemoteConfigs_credentialsId": "demo-id",
  17. "_builder_kubes-deploy_variableState": "BUILD_NUMBER,JOB_NAME",
  18. "_builder_kubes-deploy_config": "deployment.yml"
  19. }

Java示例:

  1. Map map = new HashMap();
  2. map.put("_name","k8s");
  3. map.put("_assignedNode","slave-java");
  4. map.put("_userRemoteConfigs_url","https://code.aliyun.com/CodePipeline/java-demo.git");
  5. map.put("_userRemoteConfigs_credentialsId","demo-id");
  6. map.put("_branches_name","*/master");
  7. map.put("_builder_buildcommand_buildComman","mvn package -B -DskipTestsnmvn test");
  8. map.put("_builder_docker-hub_repoName","codepipeline/nginx");
  9. map.put("_builder_docker-hub_repoTag","latest");
  10. map.put("_builder_docker-hub_registry_url","https://registry.cn-hangzhou.aliyuncs.com/v2/");
  11. map.put("_builder_docker-hub_registry_credentialsId","demo-registry-id");
  12. map.put("_builder_docker-hub_dockerfilePath","Dockerfile");
  13. map.put("_builder_kubes-deploy_authMethod","certs");
  14. map.put("_builder_kubes-deploy_apiServerUrl","mock_url");
  15. map.put("_builder_kubes-deploy_credentialsId","demo-docker-id");
  16. map.put("_builder_kubes-deploy_config","deployment.yml");
  17. map.put("_builder_kubes-deploy_statusCheckConfig","deployments:ds1,ds2");
  18. map.put("_builder_kubes-deploy_variableState","BUILD_NUMBER,JOB_NAME");
  19. String jsonStr = JSON.toJSONString(map);
  20. System.out.println(jsonStr);
  21. CreateJobRequest createJobRequest = new CreateJobRequest();
  22. try {
  23. createJobRequest.setAcceptFormat(FormatType.JSON);
  24. createJobRequest.setJobName("k8s");
  25. createJobRequest.setDeployType("k8s_deploy");
  26. createJobRequest.setJsonContent(jsonStr);
  27. CreateJobResponse createJobResponse = client.getAcsResponse(createJobRequest);
  28. System.out.println(createJobResponse.getRequestId());
  29. } catch (ServerException e) {
  30. e.printStackTrace();
  31. Assert.fail();
  32. } catch (ClientException e) {
  33. e.printStackTrace();
  34. Assert.fail();
  35. }

创建好的项目配置如图:创建项目_项目 API列表_API参考_开发指南_CodePipelinenone_deploy_with_dockerhub类型项目的JsonContent字段说明如下:

字段 是否必须 描述 _assignedNode 是 构建节点类型 _name 是 项目名称,必须与JobName相同 _userRemoteConfigs_url 是 代码仓库部分的仓库地址 _userRemoteConfigs_credentialsId 否 代码仓库部分的证书 _branches_name 否 代码分支 _builder_buildcommand_buildComman 否 构建命令 _builder_docker-hub_repoName 是 docker镜像构建部分的镜像仓库名称 _builder_docker-hub_repoTag 是 docker镜像构建部分的镜像版本号 _builder_docker-hub_registry_url 是 docker镜像构建部分的Registry地址 _builder_docker-hub_registry_credentialsId 是 docker镜像构建部分的Registry证书 _builder_docker-hub_dockerfilePath 是 docker镜像构建部分的Dockerfile路径 _builder_docker-hub_skipTagLatest 否 docker镜像构建部分的是否推送latest标签

JsonContent示例:

  1. {
  2. "_userRemoteConfigs_url": "https://code.aliyun.com/CodePipeline/java-demo.git",
  3. "_branches_name": "*/master",
  4. "_builder_kubes-deploy_statusCheckConfig": "deployments:ds1,ds2",
  5. "_name": "dockerhub",
  6. "_builder_docker-hub_repoName": "codepipeline/nginx",
  7. "_builder_buildcommand_buildComman": "mvn package -B -DskipTestsnmvn test",
  8. "_assignedNode": "slave-java",
  9. "_builder_docker-hub_repoTag": "latest",
  10. "_builder_kubes-deploy_credentialsId": "demo-docker-id",
  11. "_builder_docker-hub_registry_url": "https://registry.cn-hangzhou.aliyuncs.com/v2/",
  12. "_builder_docker-hub_dockerfilePath": "Dockerfile"
  13. }

Java示例:

  1. Map map = new HashMap();
  2. map.put("_name","dockerhub");
  3. map.put("_assignedNode","slave-java");
  4. map.put("_userRemoteConfigs_url","https://code.aliyun.com/CodePipeline/java-demo.git");
  5. map.put("_userRemoteConfigs_credentialsId","demo-id");
  6. map.put("_branches_name","*/master");
  7. map.put("_builder_buildcommand_buildComman","mvn package -B -DskipTestsnmvn test");
  8. map.put("_builder_docker-hub_repoName","codepipeline/nginx");
  9. map.put("_builder_docker-hub_repoTag","latest");
  10. map.put("_builder_docker-hub_registry_url","https://registry.cn-hangzhou.aliyuncs.com/v2/");
  11. map.put("_builder_docker-hub_registry_credentialsId","demo-registry-id");
  12. map.put("_builder_docker-hub_dockerfilePath","Dockerfile");
  13. String jsonStr = JSON.toJSONString(map);
  14. System.out.println(jsonStr);
  15. CreateJobRequest createJobRequest = new CreateJobRequest();
  16. try {
  17. createJobRequest.setAcceptFormat(FormatType.JSON);
  18. createJobRequest.setJobName("dockerhub");
  19. createJobRequest.setDeployType("none_deploy_with_dockerhub");
  20. createJobRequest.setJsonContent(jsonStr);
  21. CreateJobResponse createJobResponse = client.getAcsResponse(createJobRequest);
  22. System.out.println(createJobResponse.getRequestId());
  23. } catch (ServerException e) {
  24. e.printStackTrace();
  25. Assert.fail();
  26. } catch (ClientException e) {
  27. e.printStackTrace();
  28. Assert.fail();
  29. }

k8s_deploy_aliyunscm类型项目的JsonContent字段说明如下:注意: 与k8s_deploy类型相比k8s_deploy_aliyunscm类型的变动是:

  • 源码管理从Git插件换成aliyuncode插件来拉取源码,去掉了 _userRemoteConfigs_url_userRemoteConfigs_credentialsId_branches_name字段, 增加了_aliyuncodescm_namespace_aliyuncodescm_repos_aliyuncodescm_branchname字段。
  • 去掉了 _builder_docker-hub_registry_credentialsId 字段, 会通过获取STS Token作为凭证进行镜像的拉取和推送
  • 阿里云Code产品的主账户无法查看和获取子账户代码仓库, 想要通过aliyuncode元am管理插件获取子账户代码仓库时,请确保子账户下对应的代码仓库已经授权主账户拉取权限
  • 字段 是否必须 描述 _assignedNode 是 构建节点类型 _name 是 项目名称,必须与JobName相同 _aliyuncodescm_namespace 是 代码仓库部分的命名空间 _aliyuncodescm_repos 是 代码仓库部分的仓库名称 _aliyuncodescm_branchname 是 代码仓库部分的分支名称 _builder_buildcommand_buildComman 否 构建命令 _builder_docker-hub_repoName 是 docker镜像构建部分的镜像仓库名称 _builder_docker-hub_repoTag 是 docker镜像构建部分的镜像版本号 _builder_docker-hub_registry_url 是 docker镜像构建部分的Registry地址 _builder_docker-hub_dockerfilePath 是 docker镜像构建部分的Dockerfile路径 _builder_docker-hub_skipTagLatest 否 docker镜像构建部分的是否推送latest标签 _builder_kubes-deploy_authMethod 是 部署Kubernetes部分的认证方式 _builder_kubes-deploy_apiServerUrl 是 部署Kubernetes部分的API服务器地址 _builder_kubes-deploy_credentialsId 是 部署Kubernetes部分的证书 _builder_kubes-deploy_config 是 部署Kubernetes部分的部署配置文件 _builder_kubes-deploy_statusCheckConfig 是 部署Kubernetes部分的状态检查配置 _builder_kubes-deploy_variableState 是 部署Kubernetes部分的变量声明配置

    _builder_kubes-deploy_authMethod字段说明:

    可选值 说明 certs 证书认证 userPassword 用户名密码认证 token Token认证

    JsonContent示例:

    1. {
    2. "_aliyuncodescm_namespace","shuwei.yin"
    3. "_aliyuncodescm_repos","k8s-codepipeline-app-demo"
    4. "_aliyuncodescm_branchname","master"
    5. "_builder_kubes-deploy_statusCheckConfig": "deployments:ds1,ds2",
    6. "_name": "k8s",
    7. "_builder_docker-hub_repoName": "codepipeline/nginx",
    8. "_builder_buildcommand_buildComman": "mvn package -B -DskipTestsnmvn test",
    9. "_assignedNode": "slave-java",
    10. "_builder_docker-hub_repoTag": "latest",
    11. "_builder_kubes-deploy_credentialsId": "demo-docker-id",
    12. "_builder_docker-hub_registry_url": "https://registry.cn-hangzhou.aliyuncs.com/v2/",
    13. "_builder_docker-hub_dockerfilePath": "Dockerfile",
    14. "_builder_kubes-deploy_apiServerUrl": "mock_url",
    15. "_builder_kubes-deploy_authMethod": "certs",
    16. "_userRemoteConfigs_credentialsId": "demo-id",
    17. "_builder_kubes-deploy_variableState": "BUILD_NUMBER,JOB_NAME",
    18. "_builder_kubes-deploy_config": "deployment.yml"
    19. }

    Java示例:

    1. Map map = new HashMap();
    2. map.put("_name","k8s");
    3. map.put("_assignedNode","slave-java");
    4. map.put("_aliyuncodescm_namespace","shuwei.yin");
    5. map.put("_aliyuncodescm_repos","k8s-codepipeline-app-demo");
    6. map.put("_aliyuncodescm_branchname","master");
    7. map.put("_builder_buildcommand_buildComman","mvn package -B -DskipTestsnmvn test");
    8. map.put("_builder_docker-hub_repoName","codepipeline/nginx");
    9. map.put("_builder_docker-hub_repoTag","latest");
    10. map.put("_builder_docker-hub_registry_url","https://registry.cn-hangzhou.aliyuncs.com/v2/");
    11. map.put("_builder_docker-hub_dockerfilePath","Dockerfile");
    12. map.put("_builder_kubes-deploy_authMethod","certs");
    13. map.put("_builder_kubes-deploy_apiServerUrl","mock_url");
    14. map.put("_builder_kubes-deploy_credentialsId","demo-docker-id");
    15. map.put("_builder_kubes-deploy_config","deployment.yml");
    16. map.put("_builder_kubes-deploy_statusCheckConfig","deployments:ds1,ds2");
    17. map.put("_builder_kubes-deploy_variableState","BUILD_NUMBER,JOB_NAME");
    18. String jsonStr = JSON.toJSONString(map);
    19. System.out.println(jsonStr);
    20. CreateJobRequest createJobRequest = new CreateJobRequest();
    21. try {
    22. createJobRequest.setAcceptFormat(FormatType.JSON);
    23. createJobRequest.setJobName("k8s");
    24. createJobRequest.setDeployType("k8s_deploy");
    25. createJobRequest.setJsonContent(jsonStr);
    26. CreateJobResponse createJobResponse = client.getAcsResponse(createJobRequest);
    27. System.out.println(createJobResponse.getRequestId());
    28. } catch (ServerException e) {
    29. e.printStackTrace();
    30. Assert.fail();
    31. } catch (ClientException e) {
    32. e.printStackTrace();
    33. Assert.fail();
    34. }

    创建项目_项目 API列表_API参考_开发指南_CodePipeline


    阿里云百科网 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
    转载请注明原文链接:创建项目_项目 API列表_API参考_开发指南_CodePipeline
    喜欢 (0)
    [sp91@qq.com]
    分享 (0)
    发表我的评论
    取消评论
    表情 贴图 加粗 删除线 居中 斜体 签到

    Hi,您需要填写昵称和邮箱!

    • 昵称 (必填)
    • 邮箱 (必填)
    • 网址