Google Cloud Build V1 Client - Class Build (0.14.0)

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
NameDescription
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
TypeDescription
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
NameDescription
var string
Returns
TypeDescription
$this

getId

Output only. Unique identifier of the build.

Returns
TypeDescription
string

setId

Output only. Unique identifier of the build.

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getProjectId

Output only. ID of the project.

Returns
TypeDescription
string

setProjectId

Output only. ID of the project.

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getStatus

Output only. Status of the build.

Returns
TypeDescription
int

setStatus

Output only. Status of the build.

Parameter
NameDescription
var int
Returns
TypeDescription
$this

getStatusDetail

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

Returns
TypeDescription
string

setStatusDetail

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

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getSource

The location of the source files to build.

Returns
TypeDescription
Google\Cloud\Build\V1\Source|null

hasSource

clearSource

setSource

The location of the source files to build.

Parameter
NameDescription
var Google\Cloud\Build\V1\Source
Returns
TypeDescription
$this

getSteps

Required. The operations to be performed on the workspace.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setSteps

Required. The operations to be performed on the workspace.

Parameter
NameDescription
var array<Google\Cloud\Build\V1\BuildStep>
Returns
TypeDescription
$this

getResults

Output only. Results of the build.

Returns
TypeDescription
Google\Cloud\Build\V1\Results|null

hasResults

clearResults

setResults

Output only. Results of the build.

Parameter
NameDescription
var Google\Cloud\Build\V1\Results
Returns
TypeDescription
$this

getCreateTime

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

Returns
TypeDescription
Google\Protobuf\Timestamp|null

hasCreateTime

clearCreateTime

setCreateTime

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

Parameter
NameDescription
var Google\Protobuf\Timestamp
Returns
TypeDescription
$this

getStartTime

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

Returns
TypeDescription
Google\Protobuf\Timestamp|null

hasStartTime

clearStartTime

setStartTime

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

Parameter
NameDescription
var Google\Protobuf\Timestamp
Returns
TypeDescription
$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
TypeDescription
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
NameDescription
var Google\Protobuf\Timestamp
Returns
TypeDescription
$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
TypeDescription
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
NameDescription
var Google\Protobuf\Duration
Returns
TypeDescription
$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
TypeDescription
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
NameDescription
var string[]
Returns
TypeDescription
$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
TypeDescription
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
NameDescription
var Google\Protobuf\Duration
Returns
TypeDescription
$this

getArtifacts

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

Returns
TypeDescription
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
NameDescription
var Google\Cloud\Build\V1\Artifacts
Returns
TypeDescription
$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
TypeDescription
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
NameDescription
var string
Returns
TypeDescription
$this

getSourceProvenance

Output only. A permanent fixed identifier for source.

Returns
TypeDescription
Google\Cloud\Build\V1\SourceProvenance|null

hasSourceProvenance

clearSourceProvenance

setSourceProvenance

Output only. A permanent fixed identifier for source.

Parameter
NameDescription
var Google\Cloud\Build\V1\SourceProvenance
Returns
TypeDescription
$this

getBuildTriggerId

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

Returns
TypeDescription
string

setBuildTriggerId

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

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getOptions

Special options for this build.

Returns
TypeDescription
Google\Cloud\Build\V1\BuildOptions|null

hasOptions

clearOptions

setOptions

Special options for this build.

Parameter
NameDescription
var Google\Cloud\Build\V1\BuildOptions
Returns
TypeDescription
$this

getLogUrl

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

Returns
TypeDescription
string

setLogUrl

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

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getSubstitutions

Substitutions data for Build resource.

Returns
TypeDescription
Google\Protobuf\Internal\MapField

setSubstitutions

Substitutions data for Build resource.

Parameter
NameDescription
var array|Google\Protobuf\Internal\MapField
Returns
TypeDescription
$this

getTags

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

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setTags

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

Parameter
NameDescription
var string[]
Returns
TypeDescription
$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
TypeDescription
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
NameDescription
var array<Google\Cloud\Build\V1\Secret>
Returns
TypeDescription
$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
TypeDescription
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
NameDescription
var array|Google\Protobuf\Internal\MapField
Returns
TypeDescription
$this

getApproval

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

Returns
TypeDescription
Google\Cloud\Build\V1\BuildApproval|null

hasApproval

clearApproval

setApproval

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

Parameter
NameDescription
var Google\Cloud\Build\V1\BuildApproval
Returns
TypeDescription
$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
TypeDescription
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
NameDescription
var string
Returns
TypeDescription
$this

getAvailableSecrets

Secrets and secret environment variables.

Returns
TypeDescription
Google\Cloud\Build\V1\Secrets|null

hasAvailableSecrets

clearAvailableSecrets

setAvailableSecrets

Secrets and secret environment variables.

Parameter
NameDescription
var Google\Cloud\Build\V1\Secrets
Returns
TypeDescription
$this

getWarnings

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

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setWarnings

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

Parameter
NameDescription
var array<Google\Cloud\Build\V1\Build\Warning>
Returns
TypeDescription
$this

getFailureInfo

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

Returns
TypeDescription
Google\Cloud\Build\V1\Build\FailureInfo|null

hasFailureInfo

clearFailureInfo

setFailureInfo

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

Parameter
NameDescription
var Google\Cloud\Build\V1\Build\FailureInfo
Returns
TypeDescription
$this