gcloud beta builds submit Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud beta builds submit - submit a build using Cloud Build
- SYNOPSIS
gcloud beta builds submit[[SOURCE]--no-source][--async][--no-cache][--default-buckets-behavior=DEFAULT_BUCKETS_BEHAVIOR][--dir=DIR][--disk-size=DISK_SIZE][--gcs-log-dir=GCS_LOG_DIR][--gcs-source-staging-dir=GCS_SOURCE_STAGING_DIR][--git-source-dir=GIT_SOURCE_DIR][--git-source-revision=GIT_SOURCE_REVISION][--ignore-file=IGNORE_FILE][--machine-type=MACHINE_TYPE][--polling-interval=POLLING_INTERVAL; default=1][--region=REGION][--revision=REVISION][--service-account=SERVICE_ACCOUNT][--substitutions=[KEY=VALUE,…]][--suppress-logs][--timeout=TIMEOUT][--worker-pool=WORKER_POOL][--config=CONFIG; default="cloudbuild.yaml" |--pack=[builder=BUILDER],[env=ENV],[image=IMAGE] |--tag=TAG,-tTAG][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
(BETA)Submit a build using Cloud Build.When the
builds/use_kanikoproperty isTrue, buildssubmitted with--tagwill use Kaniko(https://github.com/GoogleContainerTools/kaniko) to execute builds. Kanikoexecutes directives in a Dockerfile, with remote layer caching for fasterbuilds. By default, Kaniko will cache layers for 6 hours. To override this, setthebuilds/kaniko_cache_ttlproperty.- EXAMPLES
- To submit a build with source located at storage URL
gs://bucket/object.zip:gcloudbetabuildssubmit"gs://bucket/object.zip"--tag=gcr.io/my-project/imageTo submit a build with source located at storage URL
gs://bucket/object.zipusing config fileconfig.yaml:gcloudbetabuildssubmit"gs://bucket/object.zip"--config=config.yamlTo submit a build with source from a source manifest:
gcloudbetabuildssubmit"gs://bucket/manifest.json"--config=config.yamlTo submit a build with local source
source.tgzasynchronously:gcloudbetabuildssubmit"source.tgz"--tag=gcr.io/my-project/image--asyncTo submit a build with source from a Git repository
https://github.com/owner/repo:gcloudbetabuildssubmit"https://github.com/owner/repo"--git-source-revision=main--config=config.yamlTo submit a build with source from a 2nd-gen Cloud Build repository resource
projects/my-project/locations/us-west1/connections/my-conn/repositories/my-repo:gcloudbetabuildssubmit"projects/my-project/locations/us-west1/connections/my-conn/repositories/my-repo"--revision=mainTo submit a build with source from a Developer Connect GitRepositoryLinkresource
projects/my-project/locations/us-west1/connections/my-conn/gitRepositoryLinks/my-repo-link:gcloudbetabuildssubmit"projects/my-project/locations/us-west1/connections/my-conn/gitRepositoryLinks/my-repo-link"--revision=main - POSITIONAL ARGUMENTS
- At most one of these can be specified:
- [
SOURCE] - The location of the source to build. The location can be a directory on a localdisk, an archive file (e.g., .zip, .tar.gz) or a manifest file (.json) in GoogleCloud Storage, a Git repo url starting withhttp:// orhttps://, a 2nd-gen Cloud Build repository resource, or a Developer ConnectGitRepositoryLink resource. If the source is a local directory, this commandskips the files specified in the
--ignore-file. If--ignore-fileis not specified, use.gcloudignorefile.If a.gcloudignorefile is absent and a.gitignorefile is present in the local source directory, gcloud will use a generatedGit-compatible.gcloudignorefile that respects your .gitignoredfiles. The global.gitignoreis not respected. For more informationon.gcloudignore, seegcloud topicgcloudignore. --no-source- Specify that no source should be uploaded with this build.
- [
- At most one of these can be specified:
- FLAGS
--async- Return immediately, without waiting for the operation in progress to complete.
--no-cache- If set, disable layer caching when building with Kaniko.
This has the same effect as setting the builds/kaniko_cache_ttl property to 0for this build. This can be useful in cases where Dockerfile builds arenon-deterministic and a non-deterministic result should not be cached.
--default-buckets-behavior=DEFAULT_BUCKETS_BEHAVIOR- How default buckets are setup.
DEFAULT_BUCKETS_BEHAVIORmust be one of:default-logs-bucket-behavior-unspecified,legacy-bucket,regional-user-owned-bucket. --dir=DIR- Directory, relative to the source root, in which to run the build. This is usedwhen the build source is a 2nd-gen Cloud Build repository resource, or aDeveloper Connect GitRepositoryLink resource. This must be a relative path. If astep's
diris specified and is an absolute path, this value isignored for that step's execution. --disk-size=DISK_SIZE- Machine disk size (GB) to run the build.
--gcs-log-dir=GCS_LOG_DIR- A directory in Google Cloud Storage to hold build logs. If this field is notset,
gs://[PROJECT_NUMBER].cloudbuild-logs.googleusercontent.com/will be created and used orgs://[PROJECT_NUMBER]-[builds/region]-cloudbuild-logsis used whenyou set--default-buckets-behaviortoREGIONAL_USER_OWNED_BUCKET. --gcs-source-staging-dir=GCS_SOURCE_STAGING_DIR- A directory in Google Cloud Storage to copy the source used for staging thebuild. If the specified bucket does not exist, Cloud Build will create one. Ifyou don't set this field,
gs://[PROJECT_ID]_cloudbuild/sourceisused orgs://[PROJECT_ID]_[builds/region]_cloudbuild/sourceis usedwhen you set--default-buckets-behaviortoREGIONAL_USER_OWNED_BUCKETandbuilds/regionis notglobal. --git-source-dir=GIT_SOURCE_DIR- Directory, relative to the source root, in which to run the build. This must bea relative path. If a step's
diris specified and is an absolutepath, this value is ignored for that step's execution. --git-source-revision=GIT_SOURCE_REVISION- Revision to fetch from the Git repository such as a branch, a tag, a commit SHA,or any Git ref to run the build.
Cloud Build uses
git fetchto fetch the revision from the Gitrepository; therefore make sure that the string you provide forrevisionis parsable by the command. For information on stringvalues accepted bygit fetch, seehttps://git-scm.com/docs/gitrevisions#_specifying_revisions.For information ongit fetch, seehttps://git-scm.com/docs/git-fetch. --ignore-file=IGNORE_FILE- Override the
.gcloudignorefile and use the specified file instead. --machine-type=MACHINE_TYPE- Machine type used to run the build.
MACHINE_TYPEmust beone of:e2-highcpu-32,e2-highcpu-8,e2-medium,n1-highcpu-32,n1-highcpu-8. --polling-interval=POLLING_INTERVAL; default=1- Amount of time in seconds to wait between polling build status.
--region=REGION- The region of the Cloud Build Service to use. Must be set to a supported regionname (e.g.
us-central1). If unset,builds/region,which is the default region to use when working with Cloud Build resources, isused. If builds/region is unset, region is set toglobal. Note:Region must be specified in 2nd gen repo;globalis not supported. --revision=REVISION- Revision to fetch from the Git repository such as a branch, a tag, a commit SHA,or any Git ref to run the build. This is used when the build source is a 2nd-genCloud Build repository resource, or a Developer Connect GitRepositoryLinkresource.
Cloud Build uses
git fetchto fetch the revision from the Gitrepository; therefore make sure that the string you provide forrevisionis parsable by the command. For information on stringvalues accepted bygit fetch, seehttps://git-scm.com/docs/gitrevisions#_specifying_revisions.For information ongit fetch, seehttps://git-scm.com/docs/git-fetch. --service-account=SERVICE_ACCOUNT- The service account to use with this build. If unset, the default serviceaccount will be used.
--substitutions=[KEY=VALUE,…]- Parameters to be substituted in the build specification.
For example (using some nonsensical substitution keys; all keys must begin withan underscore):
gcloudbuildssubmit.--configconfig.yaml--substitutions_FAVORITE_COLOR=blue,_NUM_CANDIES=10This will result in a build where every occurrence of
${_FAVORITE_COLOR}in certain fields is replaced by "blue", andsimilarly for${_NUM_CANDIES}and "10".Only the following built-in variables can be specified with the
--substitutionsflag: REPO_NAME, BRANCH_NAME, TAG_NAME,REVISION_ID, COMMIT_SHA, SHORT_SHA.For more details, see:https://cloud.google.com/cloud-build/docs/api/build-requests#substitutions
--suppress-logs- If set, build logs not streamed to stdout.
--timeout=TIMEOUT- Maximum time a build is run before it is failed as
TIMEOUT. It isspecified as a duration; for example, "2h15m5s" is two hours, fifteen minutes,and five seconds. If you don't specify a unit, seconds is assumed. For example,"10" is 10 seconds. Overrides the defaultbuilds/timeoutpropertyvalue for this command invocation. - Worker pool only flags.
--worker-pool=WORKER_POOL- Specify a worker pool for the build to run in. Format:projects/{project}/locations/{region}/workerPools/{workerPool}.
- At most one of these can be specified:
--config=CONFIG; default="cloudbuild.yaml"- The YAML or JSON file to use as the build configuration file.
--pack=[builder=BUILDER],[env=ENV],[image=IMAGE]- Uses CNCFbuildpack to create the appimage. The app "image" key/value must be provided. The app image name must be inthe
gcr.ioorpkg.devnamespace. To specify your ownbuilder image use the optional "builder" key/value argument. By defaultgcr.io/buildpacks/builderis used. To pass environment variables tothe builder use the optional "env" key/value argument where value is a list ofkey values usingescapingif necessary. --tag=TAG,-tTAG- The tag to use with a "docker build" image creation. Cloud Build will run aremote "docker build -t $TAG .", where $TAG is the tag provided by this flag.The tag must be in the
gcr.ioorpkg.devnamespace.Specify a tag if you want Cloud Build to build using a Dockerfile instead of abuild config file. If you specify a tag in this command, your source mustinclude a Dockerfile. For instructions on building using a Dockerfile seehttps://cloud.google.com/cloud-build/docs/quickstart-build.
- GCLOUD WIDE FLAGS
- These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$gcloud helpfor details. - NOTES
- This command is currently in beta and might change without notice. Thesevariants are also available:
gcloudbuildssubmitgcloudalphabuildssubmit
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-01-21 UTC.