Creates a pipeline.
Function
Creates a pipeline.
URI
POST /v5/{project_id}/api/pipelines
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
component_id |
No |
String |
Component ID |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. Can be obtained by calling the IAM API for obtaining the user token (the value of X-Subject-Token in the response header). |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
No |
String |
Pipeline name |
description |
No |
String |
Description |
is_publish |
No |
Boolean |
Indicates whether the pipeline is a release pipeline. |
sources |
No |
Array of CodeSource objects |
Pipeline Source |
variables |
No |
Array of CustomVariable objects |
Customizing Global Variables for Pipelines |
schedules |
No |
Array of PipelineSchedule objects |
Scheduled Pipeline Execution Configuration |
triggers |
No |
Array of PipelineTrigger objects |
Pipeline Code Event Triggering Configuration |
manifest_version |
No |
String |
Pipeline structure definition version. The default value is 3.0 in the new version. |
definition |
No |
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. |
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 code repository ID |
endpoint_id |
No |
String |
Extension point ID. |
default_branch |
No |
String |
Default Branch |
git_url |
No |
String |
git link |
ssh_git_url |
No |
String |
ssh_git link |
web_url |
No |
String |
Web page URL. |
repo_name |
No |
String |
Pipeline Source Name |
alias |
No |
String |
Alias of the code repository. The alias can contain a maximum of 128 characters, including uppercase letters, lowercase letters, digits, and underscores (_). |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
pipeline_id |
No |
String |
Pipeline ID |
name |
No |
String |
Custom Parameter Name |
sequence |
No |
Integer |
User-defined Parameter Sequence |
type |
No |
String |
Custom Parameter Type |
value |
No |
String |
Default values of customized parameters |
is_secret |
No |
Boolean |
Indicates whether the parameter is private. |
description |
No |
String |
User-defined Parameter Description |
is_runtime |
No |
Boolean |
Indicates whether to set during running. |
limits |
No |
Array of objects |
Limited |
is_reset |
No |
Boolean |
Reset or Not |
latest_value |
No |
String |
Latest Parameter Value |
runtime_value |
No |
String |
Value Transferred During Running |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
uuid |
No |
String |
The task ID. |
type |
No |
String |
Task Type |
name |
No |
String |
Task |
enable |
No |
String |
Available or Not |
days_of_week |
No |
Array of integers |
Specific time in a week |
time_zone |
No |
String |
Time Zone |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
pipeline_id |
No |
String |
Pipeline ID |
git_url |
No |
String |
git link |
git_type |
No |
String |
Git Type |
is_auto_commit |
No |
Boolean |
Whether to automatically commit statements |
events |
No |
Array of CodeEvent objects |
Event |
hook_id |
No |
String |
Callback ID |
repo_id |
No |
String |
Specifies the repository ID. |
endpoint_id |
No |
String |
Extension point ID. |
callback_url |
No |
String |
Callback Link |
security_token |
No |
String |
User token |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
pipeline_id |
String |
Pipeline ID |
Example Requests
POST https://{endpoint}/v5/d80a8a6530324b7bac972cbb8a9f28ec/api/pipelines { "name" : "New Pipeline-20231024204112", "description" : "", "is_publish" : false, "sources" : [ { "type" : "code", "params" : { "git_type" : "codehub", "codehub_id" : "2111699317", "endpoint_id" : "", "default_branch" : "master", "git_url" : "https://codehub.devcloud.cn-north-7.ulanqab.huawei.com/0213yjw100001/0213yjw1-android.git", "ssh_git_url" : "git@codehub.devcloud.cn-north-7.ulanqab.huawei.com:0213yjw100001/0213yjw1-android.git", "web_url" : "", "repo_name" : "0213yjw1-android", "alias" : "" } } ], "definition" : "{\"stages\": [_1\",\"sequence\":\"0\",\"jobs\":[{\"id\":\"\",\"stage_id\":1698151278179,\"identifier\":\"1698151278179f6548479-2eaf-420a-92a4-92d9a711c51b\",\"name\": \"Create Task in the {\"id\":1698151278179,\"identifier\":\"169815127817987dd9f1d-7821-46e4-89be-2a95b01b0533\",\"run_always\":false,\"name\": \"Phase\",\"depends_on\":[] ,\"timeout\":\"\",\"timeout_unit\":\"\",\"steps\":[],\"exec_type\":\"AGENTLESS_JOB\",\"sequence\":0}],\"rule_templates\":[],\"pre\":[{\"task\":\"official_devcloud_autoTrigger\",\"sequence\":0}],\"post\":[],\"depends_on\":[]}]}" }
Example Responses
Status code: 200
OK
{ "pipeline_id" : "8bfbd69eac154a0da341705a36294aca" }
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.