Creating a Build Task
Function
This API is used to create a build task.
Calling Method
For details, see Calling APIs.
URI
POST /v3/jobs/create
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API. (Value of X-Subject-Token in the response header.) Global tenant tokens are not supported. Use a region-level token whose scope is project. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
arch |
Yes |
String |
Architecture. |
project_id |
Yes |
String |
ID of the project to which the build task belongs. |
job_name |
Yes |
String |
Task name. |
auto_update_sub_module |
No |
String |
Whether to automatically update submodules. |
flavor |
No |
String |
Executor flavors. |
parameters |
No |
Array of CreateBuildJobParameter objects |
Parameters for build execution. |
scms |
No |
Array of CreateBuildJobScm objects |
SCMs of build execution. |
steps |
Yes |
Array of CreateBuildJobSteps objects |
Build actions. |
host_type |
No |
String |
Host type. |
build_config_type |
No |
String |
Build configuration type. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
No |
String |
Parameter definition name. The default value is hudson.model.StringParameterDefinition. |
params |
No |
Array of CreateBuildJobParameterParam objects |
Subparameters of build execution parameters. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
No |
String |
Parameter field name. |
value |
No |
String |
Parameter field value. |
limits |
No |
Array of LimitsParam objects |
Restrictions on enumeration parameters. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
disable |
No |
String |
Whether the configuration takes effect. The default value is 0, indicating that the configuration takes effect. |
display_name |
No |
String |
Parameter display name. |
name |
No |
String |
Parameter name. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
branch |
No |
String |
Branch. |
url |
Yes |
String |
Code repository address. |
repo_id |
No |
String |
Repo ID. |
web_url |
No |
String |
HTTP address of the code repository. |
scm_type |
Yes |
String |
Repository type, such as Repo and GitHub. |
is_auto_build |
No |
Boolean |
Whether to enable auto build. |
build_type |
No |
String |
Build type. |
depth |
No |
String |
Clone depth. |
end_point_id |
No |
String |
endpointId |
source |
No |
String |
source |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
result |
result object |
Result. |
status |
String |
Status information. |
error |
String |
Error message. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Example Requests
POST https://{endpoint}/v3/jobs/create { "arch" : "x86-64", "project_id" : "a287e712be6c404ca26e5f69040fa12b", "job_name" : "examplejob", "auto_update_sub_module" : "false", "flavor" : "2u8g", "parameters" : [ { "name" : "hudson.model.StringParameterDefinition", "params" : [ { "name" : "name", "value" : "codeBranch" }, { "name" : "type", "value" : "normalparam" }, { "name" : "defaultValue", "value" : "master" }, { "name" : "description", "value" : "description" }, { "name" : "deletion", "value" : "false" }, { "name" : "defaults", "value" : "true" }, { "name" : "staticVar", "value" : "false" }, { "name" : "sensitiveVar", "value" : "false" } ] } ], "scms" : [ { "branch" : "master", "url" : "git@codehub.devcloud.cn-north-7.ulanqab.huawei.com:soso-test00001/an.git", "repo_id" : "2111746211", "web_url" : "https://codehub.devcloud.cn-north-7.ulanqab.huawei.com/codehub/2111746211/home", "scm_type" : "codehub", "is_auto_build" : false, "build_type" : "branch", "depth" : "1" } ], "steps" : [ { "properties" : null, "module_id" : "devcloud2018.codeci_action_20043.action", "name" : "Build with Maven", "version" : "20231001.6", "enable" : true } ], "host_type" : "devcloud" }
Example Responses
Status code: 200
OK
{ "result" : { "job_id" : "db8467d972cc47f7a1bd2a3a3e77596a" }, "error" : null, "status" : "success" }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
500 |
Internal Server Error |
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