Updated on 2023-12-06 GMT+08:00

Creating a Build Job

Function

Creating a Build Job

Calling Method

For details, see Calling APIs.

URI

POST /v3/jobs/create

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. Obtain the value by calling the IAM service interface. (value of X-Subject-Token in the response header). Global tenant tokens are not supported. Use a region-level token whose scope is project.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

arch

Yes

String

Architecture Using Machines

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

Indicates whether to automatically update submodules.

flavor

No

String

Executor Specifications

parameters

No

Array of CreateBuildJobParameter objects

List of build execution parameters

scms

No

Array of CreateBuildJobScm objects

Build Execution SCM

steps

Yes

Array of CreateBuildJobSteps objects

Build Execution Steps

host_type

No

String

Host Type

build_config_type

No

String

Configuration Type

Table 3 CreateBuildJobParameter

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 Construction Execution Parameters

Table 4 CreateBuildJobParameterParam

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

Table 5 LimitsParam

Parameter

Mandatory

Type

Description

disable

No

String

Indicates whether the configuration takes effect. The default value is 0, indicating that the configuration takes effect.

display_name

No

String

Name of a parameter.

name

No

String

Parameter

Table 6 CreateBuildJobScm

Parameter

Mandatory

Type

Description

branch

No

String

Branch

url

Yes

String

Code Repository Address

repo_id

No

String

Specifies the 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

Indicates whether to automatically build.

build_type

No

String

Build Type

depth

No

String

Clone Depth

end_point_id

No

String

endpointId

source

No

String

source

Table 7 CreateBuildJobSteps

Parameter

Mandatory

Type

Description

properties

No

Map<String,Object>

Specific Construction Procedure

module_id

Yes

String

Indicates the ID of the building module.

name

Yes

String

Building Module Name

version

No

String

Build version

enable

No

Boolean

Whether to enable this feature.

Response Parameters

Status code: 200

Table 8 Response body parameters

Parameter

Type

Description

result

result object

Result

status

String

Status Information

error

String

Error Message

Table 9 result

Parameter

Type

Description

job_id

String

Build task ID.

Status code: 400

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Status code: 401

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Status code: 403

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Status code: 404

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Status code: 500

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Example Requests

POST https://{endpoint}/v3/jobs/create

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.