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

StartBuild

Starts running a build.

Request Syntax

{ "artifactsOverride": { "encryptionDisabled": boolean, "location": "string", "name": "string", "namespaceType": "string", "overrideArtifactName": boolean, "packaging": "string", "path": "string", "type": "string" }, "buildspecOverride": "string", "cacheOverride": { "location": "string", "type": "string" }, "certificateOverride": "string", "computeTypeOverride": "string", "environmentTypeOverride": "string", "environmentVariablesOverride": [ { "name": "string", "type": "string", "value": "string" } ], "gitCloneDepthOverride": number, "idempotencyToken": "string", "imageOverride": "string", "insecureSslOverride": boolean, "privilegedModeOverride": boolean, "projectName": "string", "reportBuildStatusOverride": boolean, "serviceRoleOverride": "string", "sourceAuthOverride": { "resource": "string", "type": "string" }, "sourceLocationOverride": "string", "sourceTypeOverride": "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 AWS CodeBuild 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

cacheOverride

A ProjectCache object specified for this build that overrides the one defined in the build project.

Type: ProjectCache object

Required: No

certificateOverride

The name of a certificate for this build that overrides the one specified in the build project.

Type: String

Required: No

computeTypeOverride

The name of a compute type for this build that overrides the one specified in the build project.

Type: String

Valid Values: BUILD_GENERAL1_SMALL | BUILD_GENERAL1_MEDIUM | BUILD_GENERAL1_LARGE

Required: No

environmentTypeOverride

A container type for this build that overrides the one specified in the build project.

Type: String

Valid Values: WINDOWS_CONTAINER | LINUX_CONTAINER

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

gitCloneDepthOverride

The user-defined depth of history, with a minimum value of 0, that overrides, for this build only, any previous depth of history defined in the build project.

Type: Integer

Valid Range: Minimum value of 0.

Required: No

idempotencyToken

A unique, case sensitive identifier you provide to ensure the idempotency of the StartBuild request. The token is included in the StartBuild request and is valid for 12 hours. If you repeat the StartBuild request with the same token, but change a parameter, AWS CodeBuild returns a parameter mismatch error.

Type: String

Required: No

imageOverride

The name of an image for this build that overrides the one specified in the build project.

Type: String

Length Constraints: Minimum length of 1.

Required: No

insecureSslOverride

Enable this flag to override the insecure SSL setting that is specified in the build project. The insecure SSL setting determines whether to ignore SSL warnings while connecting to the project source code. This override applies only if the build's source is GitHub Enterprise.

Type: Boolean

Required: No

privilegedModeOverride

Enable this flag to override privileged mode in the build project.

Type: Boolean

Required: No

reportBuildStatusOverride

Set to true to report to your source provider the status of a build's start and completion. If you use this option with a source provider other than GitHub, an invalidInputException is thrown.

Type: Boolean

Required: No

serviceRoleOverride

The name of a service role for this build that overrides the one specified in the build project.

Type: String

Length Constraints: Minimum length of 1.

Required: No

sourceAuthOverride

An authorization type for this build that overrides the one defined in the build project. This override applies only if the build project's source is BitBucket or GitHub.

Type: SourceAuth object

Required: No

sourceLocationOverride

A location that overrides for this build the source location for the one defined in the build project.

Type: String

Required: No

sourceTypeOverride

A source input type for this build that overrides the source input defined in the build project

Type: String

Valid Values: CODECOMMIT | CODEPIPELINE | GITHUB | S3 | BITBUCKET | GITHUB_ENTERPRISE

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

{ "build": { "arn": "string", "artifacts": { "encryptionDisabled": boolean, "location": "string", "md5sum": "string", "overrideArtifactName": boolean, "sha256sum": "string" }, "buildComplete": boolean, "buildStatus": "string", "cache": { "location": "string", "type": "string" }, "currentPhase": "string", "encryptionKey": "string", "endTime": number, "environment": { "certificate": "string", "computeType": "string", "environmentVariables": [ { "name": "string", "type": "string", "value": "string" } ], "image": "string", "privilegedMode": boolean, "type": "string" }, "id": "string", "initiator": "string", "logs": { "deepLink": "string", "groupName": "string", "streamName": "string" }, "networkInterface": { "networkInterfaceId": "string", "subnetId": "string" }, "phases": [ { "contexts": [ { "message": "string", "statusCode": "string" } ], "durationInSeconds": number, "endTime": number, "phaseStatus": "string", "phaseType": "string", "startTime": number } ], "projectName": "string", "serviceRole": "string", "source": { "auth": { "resource": "string", "type": "string" }, "buildspec": "string", "gitCloneDepth": number, "insecureSsl": boolean, "location": "string", "reportBuildStatus": boolean, "type": "string" }, "sourceVersion": "string", "startTime": number, "timeoutInMinutes": number, "vpcConfig": { "securityGroupIds": [ "string" ], "subnets": [ "string" ], "vpcId": "string" } } }

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: