Editing a Pipeline
Function
This API is used to edit a pipeline.
Calling Method
For details, see Calling APIs.
URI
PUT /v5/{project_id}/api/pipelines/{pipeline_id}
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. |
pipeline_id |
Yes |
String |
Pipeline ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
componentId |
No |
String |
Microservice ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Pipeline name. |
description |
No |
String |
Pipeline description. |
is_publish |
Yes |
Boolean |
Whether the pipeline is a release pipeline. |
sources |
No |
Array of CodeSource objects |
Pipeline source. |
variables |
No |
Array of CustomVariable objects |
Pipeline custom global variables. |
schedules |
No |
Array of PipelineSchedule objects |
Pipeline scheduled execution configuration. |
triggers |
No |
Array of PipelineTrigger objects |
Pipeline code event triggering configuration. |
manifest_version |
No |
String |
Pipeline structure definition version. Default: 3.0. (New version) |
definition |
Yes |
String |
Pipeline structure definition. |
project_name |
No |
String |
Project name. |
group_id |
No |
String |
Pipeline group ID. |
id |
No |
String |
In the replication scenario, the value is the original pipeline ID. |
concurrency_control |
No |
PipelineConcurrencyMgmt object |
Pipeline parallel policy management |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
type |
No |
String |
Pipeline source type. |
params |
No |
params object |
Pipeline source parameters. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
git_type |
No |
String |
Git type. |
codehub_id |
No |
String |
Repo repository ID. |
endpoint_id |
No |
String |
Endpoint ID. |
default_branch |
No |
String |
Default branch. |
git_url |
No |
String |
Git URL. |
ssh_git_url |
No |
String |
SSH_Git URL. |
web_url |
No |
String |
Web URL. |
repo_name |
No |
String |
Pipeline source name. |
alias |
No |
String |
Code repository alias. The alias can contain a maximum of 128 characters, including letters, digits, and underscores (_). |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
pipeline_id |
No |
String |
Pipeline ID. |
name |
No |
String |
Custom parameter name. |
sequence |
No |
Integer |
Custom parameter sequence. |
type |
No |
String |
Custom parameter type. |
value |
No |
String |
Default values of custom parameters. |
is_secret |
No |
Boolean |
Private parameter or not. |
description |
No |
String |
Custom parameter description. |
is_runtime |
No |
Boolean |
Runtime setting or not. |
limits |
No |
Array of objects |
Limited enumerated value. |
is_reset |
No |
Boolean |
Reset or not. |
latest_value |
No |
String |
Latest parameter value. |
runtime_value |
No |
String |
Runtime input value. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
uuid |
No |
String |
Job ID. |
type |
No |
String |
Job type. |
name |
No |
String |
Job name. |
enable |
No |
String |
Available or not. |
days_of_week |
No |
Array of integers |
Specific time in one week. |
time_zone |
No |
String |
Time zone. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
pipeline_id |
No |
String |
Pipeline ID. |
git_url |
No |
String |
Git URL. |
git_type |
No |
String |
Git type. |
is_auto_commit |
No |
Boolean |
Whether to automatically commit. |
events |
No |
Array of CodeEvent objects |
Event. |
hook_id |
No |
String |
Callback ID. |
repo_id |
No |
String |
Repository ID. |
endpoint_id |
No |
String |
Endpoint ID. |
callback_url |
No |
String |
Callback URL. |
security_token |
No |
String |
User token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
type |
No |
String |
Event type. |
enable |
No |
Boolean |
Available or not. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
pipeline_id |
No |
String |
Pipeline ID. |
concurrency_number |
No |
Integer |
Parallel number. |
exceed_action |
No |
String |
Policy for exceeding the allowed parallel number. |
create_time |
No |
Long |
Creation time. |
update_time |
No |
Long |
Update time. |
enable |
No |
Boolean |
Whether it is valid. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
pipeline_id |
String |
Pipeline ID. |
Example Requests
PUT https://{endpoint}/v5/d80a8a6530324b7bac972cbb8a9f28ec/api/pipelines/dab5232b7b354b6db37e695690218c9b?componentId= { "id" : "c0473f77481c4a12b254012876df71b6", "name" : "NewPipeline-20240202101359", "description" : null, "manifest_version" : 3.0, "is_publish" : false, "sources" : [ ], "variables" : [ ], "schedules" : null, "triggers" : [ ], "project_name" : null, "group_id" : null, "concurrency_control" : { "pipeline_id" : null, "concurrency_number" : 5, "exceed_action" : "ABORT", "create_time" : null, "update_time" : null, "enable" : false }, "definition" : "{\"stages\":[{\"name\":\"Stage_1\",\"sequence\":\"0\",\"jobs\":[{\"id\":\"\",\"stage_id\":1706840051315,\"identifier\":\"JOB_HwdAJ\",\"name\":\"Subpipeline\",\"depends_on\":[],\"timeout\":\"\",\"timeout_unit\":\"\",\"steps\":[{\"name\":\"Subpipeline\",\"task\":\"official_devcloud_subPipeline\",\"sequence\":0,\"inputs\":[{\"key\":\"SYSTEM_DEVCLOUD_SUBPIPELINE_TRIGGER_ID\",\"value\":\"dab5232b7b354b6db37e695690218c9b\"},{\"key\":\"_OFFICIAL_DEVCLOUD_JOB_NAME_\",\"value\":\"NewPipeline-blank\"},{\"key\":\"_OFFICIAL_DEVCLOUD_JOB_VERSION_\",\"value\":\"3.0\"}],\"business_type\":\"Normal\",\"runtime_attribution\":\"agent\",\"identifier\":\"1706840079615af0c7bda-8885-4c31-b9e8-1b393b5b0e97\",\"multi_step_editable\":0,\"official_task_version\":\"0.0.18\",\"endpoint_ids\":[]}],\"resource\":\"{\\\"type\\\":\\\"system\\\",\\\"arch\\\":\\\"x86\\\"}\",\"condition\":\"${{ default() }}\",\"exec_type\":\"OCTOPUS_JOB\",\"sequence\":0,\"pipeline_id\":\"c0473f77481c4a12b254012876df71b6\"}],\"identifier\":\"1706840051315bca51592-c211-49fe-ab76-bcf86f5efa84\",\"pre\":[{\"task\":\"official_devcloud_autoTrigger\",\"sequence\":0}],\"post\":null,\"depends_on\":[],\"run_always\":false,\"pipeline_id\":\"c0473f77481c4a12b254012876df71b6\"}]}" }
Example Responses
Status code: 200
OK
{ "pipeline_id" : "8bfbd69eac154a0da341705a36294aca" }
SDK Sample Code
The SDK sample code is as follows.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.codeartspipeline.v2.region.CodeArtsPipelineRegion; import com.huaweicloud.sdk.codeartspipeline.v2.*; import com.huaweicloud.sdk.codeartspipeline.v2.model.*; import java.util.List; import java.util.ArrayList; public class UpdatePipelineInfoSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); CodeArtsPipelineClient client = CodeArtsPipelineClient.newBuilder() .withCredential(auth) .withRegion(CodeArtsPipelineRegion.valueOf("<YOUR REGION>")) .build(); UpdatePipelineInfoRequest request = new UpdatePipelineInfoRequest(); request.withComponentId("<componentId>"); PipelineDTO body = new PipelineDTO(); PipelineConcurrencyMgmt concurrencyControlbody = new PipelineConcurrencyMgmt(); concurrencyControlbody.withConcurrencyNumber(5) .withExceedAction("ABORT") .withEnable(false); body.withConcurrencyControl(concurrencyControlbody); body.withId("c0473f77481c4a12b254012876df71b6"); body.withDefinition("{"stages":[{"name":"Stage_1","sequence":"0","jobs":[{"id":"","stage_id":1706840051315,"identifier":"JOB_HwdAJ","name":"Subpipeline","depends_on":[],"timeout":"","timeout_unit":"","steps":[{"name":"Subpipeline","task":"official_devcloud_subPipeline","sequence":0,"inputs":[{"key":"SYSTEM_DEVCLOUD_SUBPIPELINE_TRIGGER_ID","value":"dab5232b7b354b6db37e695690218c9b"},{"key":"_OFFICIAL_DEVCLOUD_JOB_NAME_","value":"NewPipeline-blank"},{"key":"_OFFICIAL_DEVCLOUD_JOB_VERSION_","value":"3.0"}],"business_type":"Normal","runtime_attribution":"agent","identifier":"1706840079615af0c7bda-8885-4c31-b9e8-1b393b5b0e97","multi_step_editable":0,"official_task_version":"0.0.18","endpoint_ids":[]}],"resource":"{\"type\":\"system\",\"arch\":\"x86\"}","condition":"${{ default() }}","exec_type":"OCTOPUS_JOB","sequence":0,"pipeline_id":"c0473f77481c4a12b254012876df71b6"}],"identifier":"1706840051315bca51592-c211-49fe-ab76-bcf86f5efa84","pre":[{"task":"official_devcloud_autoTrigger","sequence":0}],"post":null,"depends_on":[],"run_always":false,"pipeline_id":"c0473f77481c4a12b254012876df71b6"}]}"); body.withManifestVersion("3.0"); body.withIsPublish(false); body.withName("NewPipeline-20240202101359"); request.withBody(body); try { UpdatePipelineInfoResponse response = client.updatePipelineInfo(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkcodeartspipeline.v2.region.codeartspipeline_region import CodeArtsPipelineRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkcodeartspipeline.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] credentials = BasicCredentials(ak, sk) client = CodeArtsPipelineClient.new_builder() \ .with_credentials(credentials) \ .with_region(CodeArtsPipelineRegion.value_of("<YOUR REGION>")) \ .build() try: request = UpdatePipelineInfoRequest() request.component_id = "<componentId>" concurrencyControlbody = PipelineConcurrencyMgmt( concurrency_number=5, exceed_action="ABORT", enable=False ) request.body = PipelineDTO( concurrency_control=concurrencyControlbody, id="c0473f77481c4a12b254012876df71b6", definition="{"stages":[{"name":"Stage_1","sequence":"0","jobs":[{"id":"","stage_id":1706840051315,"identifier":"JOB_HwdAJ","name":"Subpipeline","depends_on":[],"timeout":"","timeout_unit":"","steps":[{"name":"Subpipeline","task":"official_devcloud_subPipeline","sequence":0,"inputs":[{"key":"SYSTEM_DEVCLOUD_SUBPIPELINE_TRIGGER_ID","value":"dab5232b7b354b6db37e695690218c9b"},{"key":"_OFFICIAL_DEVCLOUD_JOB_NAME_","value":"NewPipeline-blank"},{"key":"_OFFICIAL_DEVCLOUD_JOB_VERSION_","value":"3.0"}],"business_type":"Normal","runtime_attribution":"agent","identifier":"1706840079615af0c7bda-8885-4c31-b9e8-1b393b5b0e97","multi_step_editable":0,"official_task_version":"0.0.18","endpoint_ids":[]}],"resource":"{\"type\":\"system\",\"arch\":\"x86\"}","condition":"${{ default() }}","exec_type":"OCTOPUS_JOB","sequence":0,"pipeline_id":"c0473f77481c4a12b254012876df71b6"}],"identifier":"1706840051315bca51592-c211-49fe-ab76-bcf86f5efa84","pre":[{"task":"official_devcloud_autoTrigger","sequence":0}],"post":null,"depends_on":[],"run_always":false,"pipeline_id":"c0473f77481c4a12b254012876df71b6"}]}", manifest_version="3.0", is_publish=False, name="NewPipeline-20240202101359" ) response = client.update_pipeline_info(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" codeartspipeline "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartspipeline/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartspipeline/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartspipeline/v2/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := codeartspipeline.NewCodeArtsPipelineClient( codeartspipeline.CodeArtsPipelineClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.UpdatePipelineInfoRequest{} componentIdRequest:= "<componentId>" request.ComponentId = &componentIdRequest concurrencyNumberConcurrencyControl:= int32(5) exceedActionConcurrencyControl:= "ABORT" enableConcurrencyControl:= false concurrencyControlbody := &model.PipelineConcurrencyMgmt{ ConcurrencyNumber: &concurrencyNumberConcurrencyControl, ExceedAction: &exceedActionConcurrencyControl, Enable: &enableConcurrencyControl, } idPipelineDto:= "c0473f77481c4a12b254012876df71b6" manifestVersionPipelineDto:= "3.0" request.Body = &model.PipelineDto{ ConcurrencyControl: concurrencyControlbody, Id: &idPipelineDto, Definition: "{"stages":[{"name":"Stage_1","sequence":"0","jobs":[{"id":"","stage_id":1706840051315,"identifier":"JOB_HwdAJ","name":"Subpipeline","depends_on":[],"timeout":"","timeout_unit":"","steps":[{"name":"Subpipeline","task":"official_devcloud_subPipeline","sequence":0,"inputs":[{"key":"SYSTEM_DEVCLOUD_SUBPIPELINE_TRIGGER_ID","value":"dab5232b7b354b6db37e695690218c9b"},{"key":"_OFFICIAL_DEVCLOUD_JOB_NAME_","value":"NewPipeline-blank"},{"key":"_OFFICIAL_DEVCLOUD_JOB_VERSION_","value":"3.0"}],"business_type":"Normal","runtime_attribution":"agent","identifier":"1706840079615af0c7bda-8885-4c31-b9e8-1b393b5b0e97","multi_step_editable":0,"official_task_version":"0.0.18","endpoint_ids":[]}],"resource":"{\"type\":\"system\",\"arch\":\"x86\"}","condition":"${{ default() }}","exec_type":"OCTOPUS_JOB","sequence":0,"pipeline_id":"c0473f77481c4a12b254012876df71b6"}],"identifier":"1706840051315bca51592-c211-49fe-ab76-bcf86f5efa84","pre":[{"task":"official_devcloud_autoTrigger","sequence":0}],"post":null,"depends_on":[],"run_always":false,"pipeline_id":"c0473f77481c4a12b254012876df71b6"}]}", ManifestVersion: &manifestVersionPipelineDto, IsPublish: false, Name: "NewPipeline-20240202101359", } response, err := client.UpdatePipelineInfo(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot