Google Cloud Build V1 Client - Class Build (0.16.2)

Reference documentation and code samples for the Google Cloud Build V1 Client class Build.

A build resource in the Cloud Build API.

At a high level, a Build describes where to find source code, how to build it (for example, the builder image to run on the source), and where to store the built artifacts. Fields can include the following variables, which will be expanded when the build is created:

  • $PROJECT_ID: the project ID of the build.
  • $PROJECT_NUMBER: the project number of the build.
  • $LOCATION: the location/region of the build.
  • $BUILD_ID: the autogenerated ID of the build.
  • $REPO_NAME: the source repository name specified by RepoSource.
  • $BRANCH_NAME: the branch name specified by RepoSource.
  • $TAG_NAME: the tag name specified by RepoSource.
  • $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or resolved from the specified branch or tag.
  • $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA.

Generated from protobuf message google.devtools.cloudbuild.v1.Build

Namespace

Google \ Cloud \ Build \ V1

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ name string

Output only. The 'Build' name with format: projects/{project}/locations/{location}/builds/{build}, where {build} is a unique identifier generated by the service.

↳ id string

Output only. Unique identifier of the build.

↳ project_id string

Output only. ID of the project.

↳ status int

Output only. Status of the build.

↳ status_detail string

Output only. Customer-readable message about the current status.

↳ source Google\Cloud\Build\V1\Source

The location of the source files to build.

↳ steps array<Google\Cloud\Build\V1\BuildStep>

Required. The operations to be performed on the workspace.

↳ results Google\Cloud\Build\V1\Results

Output only. Results of the build.

↳ create_time Google\Protobuf\Timestamp

Output only. Time at which the request to create the build was received.

↳ start_time Google\Protobuf\Timestamp

Output only. Time at which execution of the build was started.

↳ finish_time Google\Protobuf\Timestamp

Output only. Time at which execution of the build was finished. The difference between finish_time and start_time is the duration of the build's execution.

↳ timeout Google\Protobuf\Duration

Amount of time that this build should be allowed to run, to second granularity. If this amount of time elapses, work on the build will cease and the build status will be TIMEOUT. timeout starts ticking from startTime. Default time is 60 minutes.

↳ images array

A list of images to be pushed upon the successful completion of all build steps. The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the Build resource's results field. If any of the images fail to be pushed, the build status is marked FAILURE.

↳ queue_ttl Google\Protobuf\Duration

TTL in queue for this build. If provided and the build is enqueued longer than this value, the build will expire and the build status will be EXPIRED. The TTL starts ticking from create_time.

↳ artifacts Google\Cloud\Build\V1\Artifacts

Artifacts produced by the build that should be uploaded upon successful completion of all build steps.

↳ logs_bucket string

Cloud Storage bucket where logs should be written (see Bucket Name Requirements). Logs file names will be of the format ${logs_bucket}/log-${build_id}.txt.

↳ source_provenance Google\Cloud\Build\V1\SourceProvenance

Output only. A permanent fixed identifier for source.

↳ build_trigger_id string

Output only. The ID of the BuildTrigger that triggered this build, if it was triggered automatically.

↳ options Google\Cloud\Build\V1\BuildOptions

Special options for this build.

↳ log_url string

Output only. URL to logs for this build in Google Cloud Console.

↳ substitutions array|Google\Protobuf\Internal\MapField

Substitutions data for Build resource.

↳ tags array

Tags for annotation of a Build. These are not docker tags.

↳ secrets array<Google\Cloud\Build\V1\Secret>

Secrets to decrypt using Cloud Key Management Service. Note: Secret Manager is the recommended technique for managing sensitive data with Cloud Build. Use available_secrets to configure builds to access secrets from Secret Manager. For instructions, see: https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets

↳ timing array|Google\Protobuf\Internal\MapField

Output only. Stores timing information for phases of the build. Valid keys are: * BUILD: time to execute all build steps. * PUSH: time to push all artifacts including docker images and non docker artifacts. * FETCHSOURCE: time to fetch source. * SETUPBUILD: time to set up build. If the build does not specify source or images, these keys will not be included.

↳ approval Google\Cloud\Build\V1\BuildApproval

Output only. Describes this build's approval configuration, status, and result.

↳ service_account string

IAM service account whose credentials will be used at build runtime. Must be of the format projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}. ACCOUNT can be email address or uniqueId of the service account.

↳ available_secrets Google\Cloud\Build\V1\Secrets

Secrets and secret environment variables.

↳ warnings array<Google\Cloud\Build\V1\Build\Warning>

Output only. Non-fatal problems encountered during the execution of the build.

↳ failure_info Google\Cloud\Build\V1\Build\FailureInfo

Output only. Contains information about the build when status=FAILURE.

getName

Output only. The 'Build' name with format: projects/{project}/locations/{location}/builds/{build}, where {build} is a unique identifier generated by the service.

Returns
Type Description
string

setName

Output only. The 'Build' name with format: projects/{project}/locations/{location}/builds/{build}, where {build} is a unique identifier generated by the service.

Parameter
Name Description
var string
Returns
Type Description
$this

getId

Output only. Unique identifier of the build.

Returns
Type Description
string

setId

Output only. Unique identifier of the build.

Parameter
Name Description
var string
Returns
Type Description
$this

getProjectId

Output only. ID of the project.

Returns
Type Description
string

setProjectId

Output only. ID of the project.

Parameter
Name Description
var string
Returns
Type Description
$this

getStatus

Output only. Status of the build.

Returns
Type Description
int

setStatus

Output only. Status of the build.

Parameter
Name Description
var int
Returns
Type Description
$this

getStatusDetail

Output only. Customer-readable message about the current status.

Returns
Type Description
string

setStatusDetail

Output only. Customer-readable message about the current status.

Parameter
Name Description
var string
Returns
Type Description
$this

getSource

The location of the source files to build.

Returns
Type Description
Google\Cloud\Build\V1\Source|null

hasSource

clearSource

setSource

The location of the source files to build.

Parameter
Name Description
var Google\Cloud\Build\V1\Source
Returns
Type Description
$this

getSteps

Required. The operations to be performed on the workspace.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setSteps

Required. The operations to be performed on the workspace.

Parameter
Name Description
var array<Google\Cloud\Build\V1\BuildStep>
Returns
Type Description
$this

getResults

Output only. Results of the build.

Returns
Type Description
Google\Cloud\Build\V1\Results|null

hasResults

clearResults

setResults

Output only. Results of the build.

Parameter
Name Description
var Google\Cloud\Build\V1\Results
Returns
Type Description
$this

getCreateTime

Output only. Time at which the request to create the build was received.

Returns
Type Description
Google\Protobuf\Timestamp|null

hasCreateTime

clearCreateTime

setCreateTime

Output only. Time at which the request to create the build was received.

Parameter
Name Description
var Google\Protobuf\Timestamp
Returns
Type Description
$this

getStartTime

Output only. Time at which execution of the build was started.

Returns
Type Description
Google\Protobuf\Timestamp|null

hasStartTime

clearStartTime

setStartTime

Output only. Time at which execution of the build was started.

Parameter
Name Description
var Google\Protobuf\Timestamp
Returns
Type Description
$this

getFinishTime

Output only. Time at which execution of the build was finished.

The difference between finish_time and start_time is the duration of the build's execution.

Returns
Type Description
Google\Protobuf\Timestamp|null

hasFinishTime

clearFinishTime

setFinishTime

Output only. Time at which execution of the build was finished.

The difference between finish_time and start_time is the duration of the build's execution.

Parameter
Name Description
var Google\Protobuf\Timestamp
Returns
Type Description
$this

getTimeout

Amount of time that this build should be allowed to run, to second granularity. If this amount of time elapses, work on the build will cease and the build status will be TIMEOUT.

timeout starts ticking from startTime. Default time is 60 minutes.

Returns
Type Description
Google\Protobuf\Duration|null

hasTimeout

clearTimeout

setTimeout

Amount of time that this build should be allowed to run, to second granularity. If this amount of time elapses, work on the build will cease and the build status will be TIMEOUT.

timeout starts ticking from startTime. Default time is 60 minutes.

Parameter
Name Description
var Google\Protobuf\Duration
Returns
Type Description
$this

getImages

A list of images to be pushed upon the successful completion of all build steps.

The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the Build resource's results field. If any of the images fail to be pushed, the build status is marked FAILURE.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setImages

A list of images to be pushed upon the successful completion of all build steps.

The images are pushed using the builder service account's credentials. The digests of the pushed images will be stored in the Build resource's results field. If any of the images fail to be pushed, the build status is marked FAILURE.

Parameter
Name Description
var string[]
Returns
Type Description
$this

getQueueTtl

TTL in queue for this build. If provided and the build is enqueued longer than this value, the build will expire and the build status will be EXPIRED.

The TTL starts ticking from create_time.

Returns
Type Description
Google\Protobuf\Duration|null

hasQueueTtl

clearQueueTtl

setQueueTtl

TTL in queue for this build. If provided and the build is enqueued longer than this value, the build will expire and the build status will be EXPIRED.

The TTL starts ticking from create_time.

Parameter
Name Description
var Google\Protobuf\Duration
Returns
Type Description
$this

getArtifacts

Artifacts produced by the build that should be uploaded upon successful completion of all build steps.

Returns
Type Description
Google\Cloud\Build\V1\Artifacts|null

hasArtifacts

clearArtifacts

setArtifacts

Artifacts produced by the build that should be uploaded upon successful completion of all build steps.

Parameter
Name Description
var Google\Cloud\Build\V1\Artifacts
Returns
Type Description
$this

getLogsBucket

Cloud Storage bucket where logs should be written (see Bucket Name Requirements).

Logs file names will be of the format ${logs_bucket}/log-${build_id}.txt.

Returns
Type Description
string

setLogsBucket

Cloud Storage bucket where logs should be written (see Bucket Name Requirements).

Logs file names will be of the format ${logs_bucket}/log-${build_id}.txt.

Parameter
Name Description
var string
Returns
Type Description
$this

getSourceProvenance

Output only. A permanent fixed identifier for source.

Returns
Type Description
Google\Cloud\Build\V1\SourceProvenance|null

hasSourceProvenance

clearSourceProvenance

setSourceProvenance

Output only. A permanent fixed identifier for source.

Parameter
Name Description
var Google\Cloud\Build\V1\SourceProvenance
Returns
Type Description
$this

getBuildTriggerId

Output only. The ID of the BuildTrigger that triggered this build, if it was triggered automatically.

Returns
Type Description
string

setBuildTriggerId

Output only. The ID of the BuildTrigger that triggered this build, if it was triggered automatically.

Parameter
Name Description
var string
Returns
Type Description
$this

getOptions

Special options for this build.

Returns
Type Description
Google\Cloud\Build\V1\BuildOptions|null

hasOptions

clearOptions

setOptions

Special options for this build.

Parameter
Name Description
var Google\Cloud\Build\V1\BuildOptions
Returns
Type Description
$this

getLogUrl

Output only. URL to logs for this build in Google Cloud Console.

Returns
Type Description
string

setLogUrl

Output only. URL to logs for this build in Google Cloud Console.

Parameter
Name Description
var string
Returns
Type Description
$this

getSubstitutions

Substitutions data for Build resource.

Returns
Type Description
Google\Protobuf\Internal\MapField

setSubstitutions

Substitutions data for Build resource.

Parameter
Name Description
var array|Google\Protobuf\Internal\MapField
Returns
Type Description
$this

getTags

Tags for annotation of a Build. These are not docker tags.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setTags

Tags for annotation of a Build. These are not docker tags.

Parameter
Name Description
var string[]
Returns
Type Description
$this

getSecrets

Secrets to decrypt using Cloud Key Management Service.

Note: Secret Manager is the recommended technique for managing sensitive data with Cloud Build. Use available_secrets to configure builds to access secrets from Secret Manager. For instructions, see: https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setSecrets

Secrets to decrypt using Cloud Key Management Service.

Note: Secret Manager is the recommended technique for managing sensitive data with Cloud Build. Use available_secrets to configure builds to access secrets from Secret Manager. For instructions, see: https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets

Parameter
Name Description
var array<Google\Cloud\Build\V1\Secret>
Returns
Type Description
$this

getTiming

Output only. Stores timing information for phases of the build. Valid keys are:

  • BUILD: time to execute all build steps.

  • PUSH: time to push all artifacts including docker images and non docker artifacts.

  • FETCHSOURCE: time to fetch source.
  • SETUPBUILD: time to set up build. If the build does not specify source or images, these keys will not be included.
Returns
Type Description
Google\Protobuf\Internal\MapField

setTiming

Output only. Stores timing information for phases of the build. Valid keys are:

  • BUILD: time to execute all build steps.

  • PUSH: time to push all artifacts including docker images and non docker artifacts.

  • FETCHSOURCE: time to fetch source.
  • SETUPBUILD: time to set up build. If the build does not specify source or images, these keys will not be included.
Parameter
Name Description
var array|Google\Protobuf\Internal\MapField
Returns
Type Description
$this

getApproval

Output only. Describes this build's approval configuration, status, and result.

Returns
Type Description
Google\Cloud\Build\V1\BuildApproval|null

hasApproval

clearApproval

setApproval

Output only. Describes this build's approval configuration, status, and result.

Parameter
Name Description
var Google\Cloud\Build\V1\BuildApproval
Returns
Type Description
$this

getServiceAccount

IAM service account whose credentials will be used at build runtime.

Must be of the format projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}. ACCOUNT can be email address or uniqueId of the service account.

Returns
Type Description
string

setServiceAccount

IAM service account whose credentials will be used at build runtime.

Must be of the format projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}. ACCOUNT can be email address or uniqueId of the service account.

Parameter
Name Description
var string
Returns
Type Description
$this

getAvailableSecrets

Secrets and secret environment variables.

Returns
Type Description
Google\Cloud\Build\V1\Secrets|null

hasAvailableSecrets

clearAvailableSecrets

setAvailableSecrets

Secrets and secret environment variables.

Parameter
Name Description
var Google\Cloud\Build\V1\Secrets
Returns
Type Description
$this

getWarnings

Output only. Non-fatal problems encountered during the execution of the build.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setWarnings

Output only. Non-fatal problems encountered during the execution of the build.

Parameter
Name Description
var array<Google\Cloud\Build\V1\Build\Warning>
Returns
Type Description
$this

getFailureInfo

Output only. Contains information about the build when status=FAILURE.

Returns
Type Description
Google\Cloud\Build\V1\Build\FailureInfo|null

hasFailureInfo

clearFailureInfo

setFailureInfo

Output only. Contains information about the build when status=FAILURE.

Parameter
Name Description
var Google\Cloud\Build\V1\Build\FailureInfo
Returns
Type Description
$this