Help Center/ CodeArts Build/ API Reference/ Task APIs/ Execute the build job.
Updated on 2023-12-06 GMT+08:00

Execute the build job.

Function

Run the build task command to transfer user-defined parameters.

Calling Method

For details, see Calling APIs.

URI

POST /v3/jobs/build

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

job_id

Yes

String

build task ID, which is a string of 32 characters consisting of digits and letters at the end of the browser URL when the build task is edited.

parameter

No

Array of ParameterItem objects

User-defined parameter

scm

No

Scm object

Code Information

Table 3 ParameterItem

Parameter

Mandatory

Type

Description

name

Yes

String

Parameter

value

Yes

String

Parameter

Table 4 Scm

Parameter

Mandatory

Type

Description

build_tag

No

String

Code Tag

build_commit_id

No

String

Code submission ID.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

octopus_job_name

String

Temporary Task Name

actual_build_number

String

Actual Build Times

daily_build_number

String

Build Daily No.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Status code: 403

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Status code: 404

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Status code: 500

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Example Requests

Execute the build task whose task ID is f9d6c8466d614a9788e9a0acf6c15f46, code repository name is codeBranch, and code repository branch is master.

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

{
  "job_id" : "f9d6c8466d614a9788e9a0acf6c15f46",
  "parameter" : [ {
    "name" : "codeBranch",
    "value" : "master"
  } ],
  "scm" : {
    "build_tag" : null,
    "build_commit_id" : "build_commit_id"
  }
}

Example Responses

Status code: 200

OK

{
  "octopus_job_name" : "j_Oaqg...",
  "actual_build_number" : "20",
  "daily_build_number" : "20200612.20"
}

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.