Starts a build with the specified configuration. This method returns a long-running Operation
, which includes the build ID. Pass the build ID to GetBuild
to determine the build status (such as SUCCESS
or FAILURE
).
Scopes
You will need authorization for the https://www.googleapis.com/auth/cloud-platform scope to make a valid call.
If unset, the scope for this method defaults to https://www.googleapis.com/auth/cloud-platform.
You can set the scope for this method like this: cloudbuild1 --scope <scope> projects locations-builds-create ...
Required Scalar Argument
- <parent> (string)
- The parent resource where this build will be created. Format:
projects/{project}/locations/{location}
- The parent resource where this build will be created. Format:
Required Request Value
The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.
For example, a structure like this:
Build:
approval:
config:
approval-required: boolean
result:
approval-time: string
approver-account: string
comment: string
decision: string
url: string
state: string
artifacts:
images: [string]
objects:
location: string
paths: [string]
timing:
end-time: string
start-time: string
build-trigger-id: string
create-time: string
failure-info:
detail: string
type: string
finish-time: string
id: string
images: [string]
log-url: string
logs-bucket: string
name: string
options:
automap-substitutions: boolean
default-logs-bucket-behavior: string
disk-size-gb: string
dynamic-substitutions: boolean
env: [string]
log-streaming-option: string
logging: string
machine-type: string
pool:
name: string
requested-verify-option: string
secret-env: [string]
source-provenance-hash: [string]
substitution-option: string
worker-pool: string
project-id: string
queue-ttl: string
results:
artifact-manifest: string
artifact-timing:
end-time: string
start-time: string
build-step-images: [string]
build-step-outputs: [string]
num-artifacts: string
service-account: string
source:
connected-repository:
dir: string
repository: string
revision: string
git-source:
dir: string
revision: string
url: string
repo-source:
branch-name: string
commit-sha: string
dir: string
invert-regex: boolean
project-id: string
repo-name: string
substitutions: { string: string }
tag-name: string
storage-source:
bucket: string
generation: string
object: string
source-fetcher: string
storage-source-manifest:
bucket: string
generation: string
object: string
source-provenance:
resolved-connected-repository:
dir: string
repository: string
revision: string
resolved-git-source:
dir: string
revision: string
url: string
resolved-repo-source:
branch-name: string
commit-sha: string
dir: string
invert-regex: boolean
project-id: string
repo-name: string
substitutions: { string: string }
tag-name: string
resolved-storage-source:
bucket: string
generation: string
object: string
source-fetcher: string
resolved-storage-source-manifest:
bucket: string
generation: string
object: string
start-time: string
status: string
status-detail: string
substitutions: { string: string }
tags: [string]
timeout: string
can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.
-
-r .approval.config approval-required=false
- Whether or not approval is needed. If this is set on a build, it will become pending when created, and will need to be explicitly approved to start.
-
..result approval-time=aliquyam
- Output only. The time when the approval decision was made.
approver-account=eos
- Output only. Email of the user that called the ApproveBuild API to approve or reject a build at the time that the API was called.
comment=at
- Optional. An optional comment for this manual approval result.
decision=dolores
- Required. The decision of this manual approval.
-
url=consetetur
- Optional. An optional URL tied to this manual approval result. This field is essentially the same as comment, except that it will be rendered by the UI differently. An example use case is a link to an external job that approved this Build.
-
.. state=gubergren
- Output only. The state of this build's approval.
-
..artifacts images=dolor
- A list of images to be pushed upon the successful completion of all build steps. The images will be 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 is marked FAILURE.
- Each invocation of this argument appends the given value to the array.
objects location=aliquyam
- Cloud Storage bucket and optional object path, in the form "gs://bucket/path/to/somewhere/". (see Bucket Name Requirements). Files in the workspace matching any path pattern will be uploaded to Cloud Storage with this location as a prefix.
paths=no
- Path globs used to match files in the build's workspace.
- Each invocation of this argument appends the given value to the array.
timing end-time=amet.
- End of time span.
-
start-time=ipsum
- Start of time span.
-
.... build-trigger-id=lorem
- Output only. The ID of the
BuildTrigger
that triggered this build, if it was triggered automatically.
- Output only. The ID of the
create-time=accusam
- Output only. Time at which the request to create the build was received.
failure-info detail=gubergren
- Explains the failure issue in more detail using hard-coded text.
-
type=sadipscing
- The name of the failure.
-
.. finish-time=at
- 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.
id=sit
- Output only. Unique identifier of the build.
images=duo
- 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 markedFAILURE
. - Each invocation of this argument appends the given value to the 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
log-url=sit
- Output only. URL to logs for this build in Google Cloud Console.
logs-bucket=magna
- 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
.
- Cloud Storage bucket where logs should be written (see Bucket Name Requirements). Logs file names will be of the format
name=et
- Output only. The 'Build' name with format:
projects/{project}/locations/{location}/builds/{build}
, where {build} is a unique identifier generated by the service.
- Output only. The 'Build' name with format:
options automap-substitutions=true
- Option to include built-in and custom substitutions as env variables for all build steps.
default-logs-bucket-behavior=dolor
- Optional. Option to specify how default logs buckets are setup.
disk-size-gb=lorem
- Requested disk size for the VM that runs the build. Note that this is NOT "disk free"; some of the space will be used by the operating system and build utilities. Also note that this is the minimum disk size that will be allocated for the build -- the build may run with a larger disk than requested. At present, the maximum disk size is 2000GB; builds that request more than the maximum are rejected with an error.
dynamic-substitutions=false
- Option to specify whether or not to apply bash style string operations to the substitutions. NOTE: this is always enabled for triggered builds and cannot be overridden in the build configuration file.
env=amet.
- A list of global environment variable definitions that will exist for all build steps in this build. If a variable is defined in both globally and in a build step, the variable will use the build step value. The elements are of the form "KEY=VALUE" for the environment variable "KEY" being given the value "VALUE".
- Each invocation of this argument appends the given value to the array.
log-streaming-option=no
- Option to define build log streaming behavior to Cloud Storage.
logging=nonumy
- Option to specify the logging mode, which determines if and where build logs are stored.
machine-type=sed
- Compute Engine machine type on which to run the build.
-
pool name=kasd
- The
WorkerPool
resource to execute the build on. You must havecloudbuild.workerpools.use
on the project hosting the WorkerPool. Format projects/{project}/locations/{location}/workerPools/{workerPoolId}
- The
-
.. requested-verify-option=lorem
- Requested verifiability options.
secret-env=sanctus
- A list of global environment variables, which are encrypted using a Cloud Key Management Service crypto key. These values must be specified in the build's
Secret
. These variables will be available to all build steps in this build. - Each invocation of this argument appends the given value to the array.
- A list of global environment variables, which are encrypted using a Cloud Key Management Service crypto key. These values must be specified in the build's
source-provenance-hash=nonumy
- Requested hash for SourceProvenance.
- Each invocation of this argument appends the given value to the array.
substitution-option=rebum.
- Option to specify behavior when there is an error in the substitution checks. NOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot be overridden in the build configuration file.
-
worker-pool=tempor
- This field deprecated; please use
pool.name
instead.
- This field deprecated; please use
-
.. project-id=dolore
- Output only. ID of the project.
queue-ttl=eos
- 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.
- 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
results artifact-manifest=amet.
- Path to the artifact manifest for non-container artifacts uploaded to Cloud Storage. Only populated when artifacts are uploaded to Cloud Storage.
artifact-timing end-time=dolore
- End of time span.
-
start-time=amet
- Start of time span.
-
.. build-step-images=ut
- List of build step digests, in the order corresponding to build step indices.
- Each invocation of this argument appends the given value to the array.
build-step-outputs=at
- List of build step outputs, produced by builder images, in the order corresponding to build step indices. Cloud Builders can produce this output by writing to
$BUILDER_OUTPUT/output
. Only the first 50KB of data is stored. - Each invocation of this argument appends the given value to the array.
- List of build step outputs, produced by builder images, in the order corresponding to build step indices. Cloud Builders can produce this output by writing to
-
num-artifacts=sit
- Number of non-container artifacts uploaded to Cloud Storage. Only populated when artifacts are uploaded to Cloud Storage.
-
.. service-account=vero
- 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.
- IAM service account whose credentials will be used at build runtime. Must be of the format
source.connected-repository dir=duo
- Directory, relative to the source root, in which to run the build.
repository=sadipscing
- Required. Name of the Google Cloud Build repository, formatted as
projects/*/locations/*/connections/*/repositories/*
.
- Required. Name of the Google Cloud Build repository, formatted as
-
revision=ut
- The revision to fetch from the Git repository such as a branch, a tag, a commit SHA, or any Git ref.
-
..git-source dir=rebum.
- Directory, relative to the source root, in which to run the build. This must be a relative path. If a step's
dir
is specified and is an absolute path, this value is ignored for that step's execution.
- Directory, relative to the source root, in which to run the build. This must be a relative path. If a step's
revision=duo
- The revision to fetch from the Git repository such as a branch, a tag, a commit SHA, or any Git ref. Cloud Build uses
git fetch
to fetch the revision from the Git repository; therefore make sure that the string you provide forrevision
is parsable by the command. For information on string values accepted bygit fetch
, see https://git-scm.com/docs/gitrevisions#_specifying_revisions. For information ongit fetch
, see https://git-scm.com/docs/git-fetch.
- The revision to fetch from the Git repository such as a branch, a tag, a commit SHA, or any Git ref. Cloud Build uses
-
url=kasd
- Location of the Git repo to build. This will be used as a
git remote
, see https://git-scm.com/docs/git-remote.
- Location of the Git repo to build. This will be used as a
-
..repo-source branch-name=sadipscing
- Regex matching branches to build. The syntax of the regular expressions accepted is the syntax accepted by RE2 and described at https://github.com/google/re2/wiki/Syntax
commit-sha=tempor
- Explicit commit SHA to build.
dir=sea
- Directory, relative to the source root, in which to run the build. This must be a relative path. If a step's
dir
is specified and is an absolute path, this value is ignored for that step's execution.
- Directory, relative to the source root, in which to run the build. This must be a relative path. If a step's
invert-regex=false
- Only trigger a build if the revision regex does NOT match the revision regex.
project-id=lorem
- ID of the project that owns the Cloud Source Repository. If omitted, the project ID requesting the build is assumed.
repo-name=magna
- Name of the Cloud Source Repository.
substitutions=key=takimata
- Substitutions to use in a triggered build. Should only be used with RunBuildTrigger
- the value will be associated with the given
key
-
tag-name=rebum.
- Regex matching tags to build. The syntax of the regular expressions accepted is the syntax accepted by RE2 and described at https://github.com/google/re2/wiki/Syntax
-
..storage-source bucket=at
- Cloud Storage bucket containing the source (see Bucket Name Requirements).
generation=invidunt
- Cloud Storage generation for the object. If the generation is omitted, the latest generation will be used.
object=clita
- Cloud Storage object containing the source. This object must be a zipped (
.zip
) or gzipped archive file (.tar.gz
) containing source to build.
- Cloud Storage object containing the source. This object must be a zipped (
-
source-fetcher=stet
- Optional. Option to specify the tool to fetch the source file for the build.
-
..storage-source-manifest bucket=aliquyam
- Cloud Storage bucket containing the source manifest (see Bucket Name Requirements).
generation=ut
- Cloud Storage generation for the object. If the generation is omitted, the latest generation will be used.
-
object=sit
- Cloud Storage object containing the source manifest. This object must be a JSON file.
-
...source-provenance.resolved-connected-repository dir=vero
- Directory, relative to the source root, in which to run the build.
repository=rebum.
- Required. Name of the Google Cloud Build repository, formatted as
projects/*/locations/*/connections/*/repositories/*
.
- Required. Name of the Google Cloud Build repository, formatted as
-
revision=dolores
- The revision to fetch from the Git repository such as a branch, a tag, a commit SHA, or any Git ref.
-
..resolved-git-source dir=consetetur
- Directory, relative to the source root, in which to run the build. This must be a relative path. If a step's
dir
is specified and is an absolute path, this value is ignored for that step's execution.
- Directory, relative to the source root, in which to run the build. This must be a relative path. If a step's
revision=dolores
- The revision to fetch from the Git repository such as a branch, a tag, a commit SHA, or any Git ref. Cloud Build uses
git fetch
to fetch the revision from the Git repository; therefore make sure that the string you provide forrevision
is parsable by the command. For information on string values accepted bygit fetch
, see https://git-scm.com/docs/gitrevisions#_specifying_revisions. For information ongit fetch
, see https://git-scm.com/docs/git-fetch.
- The revision to fetch from the Git repository such as a branch, a tag, a commit SHA, or any Git ref. Cloud Build uses
-
url=sed
- Location of the Git repo to build. This will be used as a
git remote
, see https://git-scm.com/docs/git-remote.
- Location of the Git repo to build. This will be used as a
-
..resolved-repo-source branch-name=invidunt
- Regex matching branches to build. The syntax of the regular expressions accepted is the syntax accepted by RE2 and described at https://github.com/google/re2/wiki/Syntax
commit-sha=clita
- Explicit commit SHA to build.
dir=dolor
- Directory, relative to the source root, in which to run the build. This must be a relative path. If a step's
dir
is specified and is an absolute path, this value is ignored for that step's execution.
- Directory, relative to the source root, in which to run the build. This must be a relative path. If a step's
invert-regex=false
- Only trigger a build if the revision regex does NOT match the revision regex.
project-id=magna
- ID of the project that owns the Cloud Source Repository. If omitted, the project ID requesting the build is assumed.
repo-name=diam
- Name of the Cloud Source Repository.
substitutions=key=nonumy
- Substitutions to use in a triggered build. Should only be used with RunBuildTrigger
- the value will be associated with the given
key
-
tag-name=et
- Regex matching tags to build. The syntax of the regular expressions accepted is the syntax accepted by RE2 and described at https://github.com/google/re2/wiki/Syntax
-
..resolved-storage-source bucket=sanctus
- Cloud Storage bucket containing the source (see Bucket Name Requirements).
generation=accusam
- Cloud Storage generation for the object. If the generation is omitted, the latest generation will be used.
object=tempor
- Cloud Storage object containing the source. This object must be a zipped (
.zip
) or gzipped archive file (.tar.gz
) containing source to build.
- Cloud Storage object containing the source. This object must be a zipped (
-
source-fetcher=sed
- Optional. Option to specify the tool to fetch the source file for the build.
-
..resolved-storage-source-manifest bucket=est
- Cloud Storage bucket containing the source manifest (see Bucket Name Requirements).
generation=takimata
- Cloud Storage generation for the object. If the generation is omitted, the latest generation will be used.
-
object=dolor
- Cloud Storage object containing the source manifest. This object must be a JSON file.
-
... start-time=diam
- Output only. Time at which execution of the build was started.
status=at
- Output only. Status of the build.
status-detail=erat
- Output only. Customer-readable message about the current status.
substitutions=key=justo
- Substitutions data for
Build
resource. - the value will be associated with the given
key
- Substitutions data for
tags=ipsum
- Tags for annotation of a
Build
. These are not docker tags. - Each invocation of this argument appends the given value to the array.
- Tags for annotation of a
timeout=accusam
- 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 fromstartTime
. Default time is 60 minutes.
- 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
About Cursors
The cursor position is key to comfortably set complex nested structures. The following rules apply:
- The cursor position is always set relative to the current one, unless the field name starts with the
.
character. Fields can be nested such as in-r f.s.o
. - The cursor position is set relative to the top-level structure if it starts with
.
, e.g.-r .s.s
- You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify
-r struct.sub_struct=bar
. - You can move the cursor one level up by using
..
. Each additional.
moves it up one additional level. E.g....
would go three levels up.
Optional Output Flags
The method's return value a JSON encoded structure, which will be written to standard output by default.
- -o out
- out specifies the destination to which to write the server's result to.
It will be a JSON-encoded structure.
The destination may be
-
to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.
- out specifies the destination to which to write the server's result to.
It will be a JSON-encoded structure.
The destination may be
Optional Method Properties
You may set the following properties to further configure the call. Please note that -p
is followed by one
or more key-value-pairs, and is called like this -p k1=v1 k2=v2
even though the listing below repeats the
-p
for completeness.
- -p project-id=string
- Required. ID of the project.
Optional General Properties
The following properties can configure any call, and are not specific to this method.
-
-p $-xgafv=string
- V1 error format.
-
-p access-token=string
- OAuth access token.
-
-p alt=string
- Data format for response.
-
-p callback=string
- JSONP
-
-p fields=string
- Selector specifying which fields to include in a partial response.
-
-p key=string
- API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
-
-p oauth-token=string
- OAuth 2.0 token for the current user.
-
-p pretty-print=boolean
- Returns response with indentations and line breaks.
-
-p quota-user=string
- Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
-
-p upload-type=string
- Legacy upload protocol for media (e.g. "media", "multipart").
-
-p upload-protocol=string
- Upload protocol for media (e.g. "raw", "multipart").