gcloud_builds_submit (1)
NAME
- gcloud builds submit - submit a build using Google Cloud Build
SYNOPSIS
-
gcloud builds submit [[SOURCE] --no-source] [--async] [--no-cache] [--disk-size=DISK_SIZE] [--gcs-log-dir=GCS_LOG_DIR] [--gcs-source-staging-dir=GCS_SOURCE_STAGING_DIR] [--machine-type=MACHINE_TYPE] [--substitutions=[KEY=VALUE,...]] [--timeout=TIMEOUT] [--config=CONFIG; default="cloudbuild.yaml" | --tag=TAG, -t TAG] [GCLOUD_WIDE_FLAG ...]
DESCRIPTION
When the builds/use_kaniko property is True, builds submitted with --tag will use Kaniko (github.com/GoogleContainerTools/kaniko to execute builds. Kaniko executes directives in a Dockerfile, with remote layer caching for faster builds. By default, Kaniko will cache layers for 6 hours. To override this, set the builds/kaniko_cache_ttl property.
POSITIONAL ARGUMENTS
-
-
At most one of these may be specified:
-
- [SOURCE]
-
The location of the source to build. The location can be a directory on a local
disk or a gzipped archive file (.tar.gz) in Google Cloud Storage. If the source
is a local directory, this command skips the files specified in the
.gcloudignore file. If a .gitignore file is present in the local
source directory, gcloud will use a Git-compatible .gcloudignore file
that respects your .gitignored files. The global .gitignore is not
respected. For more information on .gcloudignore, see gcloud topic
gcloudignore.
- --no-source
-
Specify that no source should be uploaded with this build.
-
-
At most one of these may be specified:
FLAGS
-
- --async
-
Display information about the operation in progress, without waiting for the
operation 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 0 for this build. This can be useful in cases where Dockerfile builds are non-deterministic and a non-deterministic result should not be cached.
- --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 not
set, gs://[PROJECT_NUMBER].cloudbuild-logs.googleusercontent.com/ will be
created and used.
- --gcs-source-staging-dir=GCS_SOURCE_STAGING_DIR
-
A directory in Google Cloud Storage to copy the source used for staging the
build. If the specified bucket does not exist, Cloud Build will create one. If
you don't set this field, gs://[PROJECT_ID]_cloudbuild/source is used.
- --machine-type=MACHINE_TYPE
-
Machine type used to run the build. MACHINE_TYPE must be one of:
n1-highcpu-32, n1-highcpu-8.
- --substitutions=[KEY=VALUE,...]
-
Parameters to be substituted in the build specification.
For example (using some nonsensical substitution keys; all keys must begin with an underscore):
-
$ gcloud builds submit . --config config.yaml \
--substitutions _FAVORITE_COLOR=blue,_NUM_CANDIES=10
This will result in a build where every occurrence of ${_FAVORITE_COLOR} in certain fields is replaced by "blue", and similarly for ${_NUM_CANDIES} and "10".
Only the following built-in variables can be specified with the --substitutions flag: REPO_NAME, BRANCH_NAME, TAG_NAME, REVISION_ID, COMMIT_SHA, SHORT_SHA.
For more details, see: cloud.google.com/cloud-build/docs/api/build-requests#substitutions
-
$ gcloud builds submit . --config config.yaml \
- --timeout=TIMEOUT
-
Maximum time a build is run before it is failed as TIMEOUT. It is
specified 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 default builds/timeout property value
for this command invocation.
-
At most one of these may be specified:
-
- --config=CONFIG; default="cloudbuild.yaml"
-
The YAML or JSON file to use as the build configuration file.
- --tag=TAG, -t TAG
-
The tag to use with a "docker build" image creation. Cloud Build will run a
remote "docker build -t $TAG .", where $TAG is the tag provided by this flag.
The tag must be in the gcr.io/* or *.gcr.io/* namespaces. Specify a tag if you
want Cloud Build to build using a Dockerfile instead of a build config file. If
you specify a tag in this command, your source must include a Dockerfile. For
instructions on building using a Dockerfile see
cloud.google.com/cloud-build/docs/quickstart-docker
-
GCLOUD WIDE FLAGS
These flags are available to all commands: --account, --configuration, --flags-file, --flatten, --format, --help, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity. Run $ gcloud help for details.
NOTES
You can also run a build locally using the separate component: gcloud components install cloud-build-local.
These variants are also available:
- $ gcloud alpha builds submit $ gcloud beta builds submit