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 \ V1Methods
__construct
Constructor.
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
↳ steps
↳ results
↳ create_time
↳ start_time
↳ 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
Google 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
↳ build_trigger_id
string
Output only. The ID of the BuildTrigger
that triggered this build, if it was triggered automatically.
↳ options
↳ log_url
string
Output only. URL to logs for this build in Google Cloud Console.
↳ substitutions
↳ 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
↳ 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.
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.
var
string
$this
getId
Output only. Unique identifier of the build.
string
setId
Output only. Unique identifier of the build.
var
string
$this
getProjectId
Output only. ID of the project.
string
setProjectId
Output only. ID of the project.
var
string
$this
getStatus
Output only. Status of the build.
int
setStatus
Output only. Status of the build.
var
int
$this
getStatusDetail
Output only. Customer-readable message about the current status.
string
setStatusDetail
Output only. Customer-readable message about the current status.
var
string
$this
getSource
The location of the source files to build.
hasSource
clearSource
setSource
The location of the source files to build.
$this
getSteps
Required. The operations to be performed on the workspace.
setSteps
Required. The operations to be performed on the workspace.
$this
getResults
Output only. Results of the build.
hasResults
clearResults
setResults
Output only. Results of the build.
$this
getCreateTime
Output only. Time at which the request to create the build was received.
hasCreateTime
clearCreateTime
setCreateTime
Output only. Time at which the request to create the build was received.
$this
getStartTime
Output only. Time at which execution of the build was started.
hasStartTime
clearStartTime
setStartTime
Output only. Time at which execution of the build was started.
$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.
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.
$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.
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.
$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
.
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
.
var
string[]
$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.
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.
$this
getArtifacts
Artifacts produced by the build that should be uploaded upon successful completion of all build steps.
hasArtifacts
clearArtifacts
setArtifacts
Artifacts produced by the build that should be uploaded upon successful completion of all build steps.
$this
getLogsBucket
Google 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
.
string
setLogsBucket
Google 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
.
var
string
$this
getSourceProvenance
Output only. A permanent fixed identifier for source.
hasSourceProvenance
clearSourceProvenance
setSourceProvenance
Output only. A permanent fixed identifier for source.
$this
getBuildTriggerId
Output only. The ID of the BuildTrigger
that triggered this build, if it
was triggered automatically.
string
setBuildTriggerId
Output only. The ID of the BuildTrigger
that triggered this build, if it
was triggered automatically.
var
string
$this
getOptions
Special options for this build.
hasOptions
clearOptions
setOptions
Special options for this build.
$this
getLogUrl
Output only. URL to logs for this build in Google Cloud Console.
string
setLogUrl
Output only. URL to logs for this build in Google Cloud Console.
var
string
$this
getSubstitutions
Substitutions data for Build
resource.
setSubstitutions
Substitutions data for Build
resource.
$this
getTags
Tags for annotation of a Build
. These are not docker tags.
setTags
Tags for annotation of a Build
. These are not docker tags.
var
string[]
$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
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
$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.
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.
$this
getApproval
Output only. Describes this build's approval configuration, status, and result.
hasApproval
clearApproval
setApproval
Output only. Describes this build's approval configuration, status, and result.
$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.
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.
var
string
$this
getAvailableSecrets
Secrets and secret environment variables.
hasAvailableSecrets
clearAvailableSecrets
setAvailableSecrets
Secrets and secret environment variables.
$this
getWarnings
Output only. Non-fatal problems encountered during the execution of the build.
setWarnings
Output only. Non-fatal problems encountered during the execution of the build.
$this
getFailureInfo
Output only. Contains information about the build when status=FAILURE.
hasFailureInfo
clearFailureInfo
setFailureInfo
Output only. Contains information about the build when status=FAILURE.
$this