Menu
AWS CodeBuild
API Reference (API Version 2016-10-06)

StartBuild

Starts running a build.

Request Syntax

Copy
{ "artifactsOverride": { "location": "string", "name": "string", "namespaceType": "string", "packaging": "string", "path": "string", "type": "string" }, "buildspecOverride": "string", "environmentVariablesOverride": [ { "name": "string", "value": "string" } ], "projectName": "string", "sourceVersion": "string", "timeoutInMinutesOverride": number }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

Note

In the following list, the required parameters are described first.

projectName

The name of the build project to start running a build.

Type: String

Length Constraints: Minimum length of 1.

Required: Yes

artifactsOverride

Build output artifact settings that override, for this build only, the latest ones already defined in the build project.

Type: ProjectArtifacts object

Required: No

buildspecOverride

A build spec declaration that overrides, for this build only, the latest one already defined in the build project.

Type: String

Required: No

environmentVariablesOverride

A set of environment variables that overrides, for this build only, the latest ones already defined in the build project.

Type: Array of EnvironmentVariable objects

Required: No

sourceVersion

A version of the build input to be built, for this build only. If not specified, the latest version will be used. If specified, must be one of:

  • For AWS CodeCommit: the commit ID to use.

  • For GitHub: the commit ID, pull request ID, branch name, or tag name that corresponds to the version of the source code you want to build. If a pull request ID is specified, it must use the format pr/pull-request-ID (for example pr/25). If a branch name is specified, the branch's HEAD commit ID will be used. If not specified, the default branch's HEAD commit ID will be used.

  • For Bitbucket: the commit ID, branch name, or tag name that corresponds to the version of the source code you want to build. If a branch name is specified, the branch's HEAD commit ID will be used. If not specified, the default branch's HEAD commit ID will be used.

  • For Amazon Simple Storage Service (Amazon S3): the version ID of the object representing the build input ZIP file to use.

Type: String

Required: No

timeoutInMinutesOverride

The number of build timeout minutes, from 5 to 480 (8 hours), that overrides, for this build only, the latest setting already defined in the build project.

Type: Integer

Valid Range: Minimum value of 5. Maximum value of 480.

Required: No

Response Syntax

Copy
{ "build": { "arn": "string", "artifacts": { "location": "string", "md5sum": "string", "sha256sum": "string" }, "buildComplete": boolean, "buildStatus": "string", "currentPhase": "string", "endTime": number, "environment": { "computeType": "string", "environmentVariables": [ { "name": "string", "value": "string" } ], "image": "string", "privilegedMode": boolean, "type": "string" }, "id": "string", "initiator": "string", "logs": { "deepLink": "string", "groupName": "string", "streamName": "string" }, "phases": [ { "contexts": [ { "message": "string", "statusCode": "string" } ], "durationInSeconds": number, "endTime": number, "phaseStatus": "string", "phaseType": "string", "startTime": number } ], "projectName": "string", "source": { "auth": { "resource": "string", "type": "string" }, "buildspec": "string", "location": "string", "type": "string" }, "sourceVersion": "string", "startTime": number, "timeoutInMinutes": number } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

build

Information about the build to be run.

Type: Build object

Errors

For information about the errors that are common to all actions, see Common Errors.

AccountLimitExceededException

An AWS service limit was exceeded for the calling AWS account.

HTTP Status Code: 400

InvalidInputException

The input value that was provided is not valid.

HTTP Status Code: 400

ResourceNotFoundException

The specified AWS resource cannot be found.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: