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 |
Parameter description: CodeArts project ID. Constraints: N/A. Value Range: The value contains 32 characters. Default value: N/A. |
pipeline_id |
Yes |
String |
Parameter description: Pipeline ID. Constraints: N/A. Value Range: The value contains 32 characters. Default value: N/A. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
component_id |
No |
String |
Microservice ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Parameter description: User token. It can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token. Constraints: None. Value range: None. Default value: None. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Parameter description: Pipeline name. Constraints: None. Value range: The value can contain only letters, digits, hyphens (-), and underscores (_). The length is 1128 characters. Default value: None. |
description |
No |
String |
Parameter description: Pipeline description. Constraints: None. Value range: Up to 1024 characters. Default value: None. |
is_publish |
Yes |
Boolean |
Parameter description: Whether the pipeline is a change-triggered pipeline. Constraints: None. Value range: true: this pipeline is a change-triggered pipeline; false: this pipeline is not a change-triggered pipeline. Default value: None. |
sources |
No |
Array of CodeSource objects |
Parameter description: Pipeline source information. Constraints: None. Value range: None. Default value: None. |
variables |
No |
Array of CustomVariable objects |
Parameter description: List of custom pipeline global variables. Constraints: None. Value range: None. Default value: None. |
schedules |
No |
Array of PipelineSchedule objects |
Parameter description: List of pipeline scheduled execution configurations. Constraints: None. Value range: None. Default value: None. |
triggers |
No |
Array of PipelineTrigger objects |
Parameter description: Configurations of pipeline event triggers. Constraints: None. Value range: None. Default value: None. |
manifest_version |
No |
String |
Parameter description: Pipeline structure definition version. Constraints: None. Value range: The default value is 3.0. Default value: None. |
definition |
Yes |
String |
Parameter description: Pipeline structure definition JSON. The structure of this field is complex. You are advised to obtain the value from the pipeline details API after editing a pipeline. Constraints: None. Value range: The default value is 3.0. Default value: None. |
project_name |
No |
String |
Parameter description: Project name. Constraints: None. Value range: None. Default value: None. |
group_id |
No |
String |
Parameter description: Pipeline group ID. Constraints: None. Value range: 32 characters, including only digits and letters. Default value: None. |
id |
No |
String |
Parameter description: Pipeline group ID, which is used for the cloning scenario. Constraints: None. Value range: 32 characters, including only digits and letters. Default value: None. |
concurrency_control |
No |
PipelineConcurrencyMgmt object |
Parameter description: Pipeline concurrency control information. Constraints: None. Value range: A string of 32 characters. Default value: None. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
type |
No |
String |
Parameter description: Pipeline source type. Constraints: None. Value range: Currently, the code source type is supported. Default value: None. |
params |
No |
params object |
Parameter description: Pipeline source parameters, including details about the pipeline source. Constraints: N/A Value range: N/A Default value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
git_type |
No |
String |
Parameter description: Code repository type. Constraints: N/A Value range: CodeArts Repo, Gitee, GitHub, GitCode, and GitLab are supported. Default value: N/A |
codehub_id |
No |
String |
Parameter description: CodeArts Repo code repository ID. Constraints: None. Value range: None. Default value: None. |
endpoint_id |
No |
String |
Parameter description: Code source endpoint ID. Constraints: None. Value range: None. Default value: None. |
default_branch |
No |
String |
Parameter description: Default branch. Constraints: None. Value range: None. Default value: None. |
git_url |
No |
String |
Parameter description: HTTPS address of the Git repository, for example, https://example.com/CloudPipelinezycs00001/2000.git. Constraints: None. Value range: None. Default value: None. |
ssh_git_url |
No |
String |
Parameter description: ssh_git address, for example, https://example.com/CloudPipelinezycs00001/2000.git. Constraints: None. Value range: None. Default value: None. |
web_url |
No |
String |
Parameter description: Web page URL. Constraints: None. Value range: None. Default value: None. |
repo_name |
No |
String |
Parameter description: Pipeline source name. Constraints: None. Value range: None. Default value: None. |
alias |
No |
String |
Parameter description: Code repository alias. The value can contain a maximum of 128 characters, including letters, digits, and underscores (_). Constraints: None. Value range: None. Default value: None. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
pipeline_id |
No |
String |
Parameter description: Pipeline ID. Constraints: None. Value range: 32 characters. Default value: None. |
name |
No |
String |
Parameter description: Custom parameter name. Constraints: None. Value range: 32 characters. Default value: None. |
sequence |
No |
Integer |
Parameter description: Parameter sequence number, which starts from 1. Constraints: None. Value range: None. Default value: None. |
type |
No |
String |
Parameter description: Custom parameter type. Constraints: None. Value range: autoIncrement: auto-increment parameter; enum: enumeration parameter; string: character string parameter. Default value: None. |
value |
No |
String |
Parameter description: Default value of a custom parameter. Constraints: None. Value range: Up to 8192 characters. Default value: None. |
is_secret |
No |
Boolean |
Parameter description: Whether the parameter is private. Constraints: None. Value range: true: private parameter; false: non-private parameter. Default value: false. |
description |
No |
String |
Parameter description: Parameter description. Constraints: None. Value range: Up to 1024 characters. Default value: None. |
is_runtime |
No |
Boolean |
Parameter description: Whether the parameter can be set during runtime. Constraints: None. Value range: true: the parameter can be set during runtime; false: the parameter cannot be set during runtime. Default value: false. |
limits |
No |
Array of objects |
Parameter description: List of enumerated values. Constraints: None. Value range: Up to 1,024 characters. Default value: None. |
is_reset |
No |
Boolean |
Parameter description: Whether to reset. If the auto-increment parameter is edited, the edited value is used. Otherwise, the last digit increases. Constraints: N/A. Value Range: true: Uses the edited parameter value. false: Uses the auto-increment parameter. Default value: false. |
latest_value |
No |
String |
Parameter description: Latest parameter value. Constraints: None. Value range: Up to 8192 characters. Default value: None. |
runtime_value |
No |
String |
Parameter description: Runtime input value. Constraints: None. Value range: None. Default value: None. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
uuid |
No |
String |
Parameter description: ID of a scheduled task. Constraints: None. Value range: None. Default value: None. |
type |
No |
String |
Parameter description: Job type. Constraints: None. Value range: Only fixed is supported. Default value: None. |
name |
No |
String |
Parameter description: Job name. Constraints: None. Value range: None. Default value: None. |
enable |
No |
String |
Parameter description: Whether to enable. Constraints: None. Value range: None. Default value: None. |
days_of_week |
No |
Array of integers |
Parameter description: Specific execution day in a week. Sunday to Saturday: 1 to 7. Constraints: N/A. Value Range: N/A. Default value: N/A. |
time_zone |
No |
String |
Parameter description: Time zone. Constraints: None. Value range: "China Standard Time", "GMT Standard Time", "South Africa Standard Time", "Russian Standard Time", "SE Asia Standard Time", "Singapore Standard Time", "Pacific SA Standard Time", "E. South America Standard Time", "Central Standard Time (Mexico)", "Egypt Standard Time", "Saudi Arabia Standard Time". Default value: None. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
pipeline_id |
No |
String |
Parameter description: Pipeline ID. Constraints: None. Value range: 32 characters, including letters and digits. Default value: None. |
git_url |
No |
String |
Parameter description: Git repository URL. Constraints: None. Value range: 32 characters, including letters and digits. Default value: None. |
git_type |
No |
String |
Parameter description: Git repository type. Constraints: None. Value range: The options include CodeHub, Gitee, GitHub, GitCode, and GitLab. Default value: None. |
is_auto_commit |
No |
Boolean |
Parameter description: Whether to automatically commit code. This feature is only available for Gitee repositories. After a webhook triggers a pipeline, a comment is automatically added. Constraints: N/A. Value Range: The value can be "true" or "false". Default value: N/A. |
events |
No |
Array of CodeEvent objects |
Parameter description: Trigger event list. Constraints: None. Value range: None. Default value: None. |
hook_id |
No |
String |
Parameter description: Callback ID generated by the system. Constraints: None. Value range: None. Default value: None. |
repo_id |
No |
String |
Parameter description: Repo repository ID. Constraints: None. Value range: None. Default value: None. |
endpoint_id |
No |
String |
Parameter description: Code source endpoint ID. Constraints: N/A. Value Range: The value contains 32 characters, including letters and digits. Default value: N/A. |
callback_url |
No |
String |
Parameter description: Callback URL, which is generated when a webhook is registered. Constraints: None. Value range: None. Default value: None. |
security_token |
No |
String |
Parameter description: User token, which is generated when a webhook is registered. Constraints: None. Value range: None. Default value: None. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
type |
No |
String |
Parameter description: Event type. Constraints: N/A Value range: merge_request: MR; push: code push; tag_push: tag; issue: Gitee repository issue; note: Gitee repository comment. Default value: N/A |
enable |
No |
Boolean |
Parameter description: Whether it is available. Constraints: N/A. Value Range: The value can be "true" or "false". Default value: N/A. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
pipeline_id |
No |
String |
Parameter description: Pipeline ID. Constraints: None. Value range: A string of 32 characters. Default value: None. |
concurrency_number |
No |
Integer |
Parameter description: Number of concurrent instances. Maximum concurrent instances vary by your purchases and packages. Constraints: None. Value range: None. Default value: None. |
exceed_action |
No |
String |
Parameter description: Policy when the threshold is exceeded. Constraints: None. Value range: ABORT: ignore; QUEUE: wait in queue. Default value: None. |
create_time |
No |
Long |
Parameter description: Creation time. Constraints: None. Value range: None. Default value: None. |
update_time |
No |
Long |
Parameter description: Update time. Constraints: None. Value range: None. Default value: None. |
enable |
No |
Boolean |
Parameter description: Whether to enable it. Constraints: N/A. Value Range: The value can be "true" or "false". Default value: N/A. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
pipeline_id |
String |
Parameter description: Pipeline ID. Value range: 32 characters, including only digits and letters. |
Example Requests
PUT https://{endpoint}/v5/d80a8a6530324b7bac972cbb8a9f28ec/api/pipelines/dab5232b7b354b6db37e695690218c9b
{
"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 61 |
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.withProjectId("{project_id}");
request.withPipelineId("{pipeline_id}");
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 45 |
# 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.project_id = "{project_id}"
request.pipeline_id = "{pipeline_id}"
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{}
request.ProjectId = "{project_id}"
request.PipelineId = "{pipeline_id}"
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.
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 61 |
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.withProjectId("{project_id}");
request.withPipelineId("{pipeline_id}");
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 45 |
# 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.project_id = "{project_id}"
request.pipeline_id = "{pipeline_id}"
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{}
request.ProjectId = "{project_id}"
request.PipelineId = "{pipeline_id}"
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