- NAME
-
- gcloud alpha builds triggers create cloud-source-repositories - create a build trigger from a Cloud Source Repository
- SYNOPSIS
-
-
gcloud alpha builds triggers create cloud-source-repositories
(--trigger-config
=PATH
| [--repo
=REPO
(--branch-pattern
=REGEX
|--tag-pattern
=REGEX
) (--build-config
=PATH
|--inline-config
=PATH
|--dockerfile
=DOCKERFILE
--dockerfile-dir
=DOCKERFILE_DIR
; default="/"--dockerfile-image
=DOCKERFILE_IMAGE
) :--description
=DESCRIPTION
--ignored-files
=[GLOB
,…]--included-files
=[GLOB
,…]--name
=NAME
--substitutions
=[KEY
=VALUE
,…]]) [GCLOUD_WIDE_FLAG …
]
-
- DESCRIPTION
-
(ALPHA)
Create a build trigger from a Cloud Source Repository. - REQUIRED FLAGS
-
-
Exactly one of these must be specified:
--trigger-config
=PATH
- Path to Build Trigger config file (JSON or YAML format). For more details, see https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.triggers#BuildTrigger
-
Flag based trigger configuration
-
Repo resource - Cloud Source Repository. This represents a Cloud resource.
(NOTE) Some attributes are not given arguments in this group but can be set in
other ways. To set the
project
attribute: provide the argument--repo
on the command line with a fully specified name; set the propertycore/project
. This must be specified.--repo
=REPO
-
ID of the repo or fully qualified identifier for the repo. To set the
repo
attribute: provide the argument--repo
on the command line.
--description
=DESCRIPTION
- Build trigger description.
--ignored-files
=[GLOB
,…]- Glob filter. Changes only affecting ignored files won't trigger builds.
--included-files
=[GLOB
,…]- Glob filter. Changes affecting at least one included file will trigger builds.
--name
=NAME
- Build trigger name.
--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 triggers create … --config config.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", 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: https://cloud.google.com/cloud-build/docs/api/build-requests#substitutions
-
Exactly one of these must be specified:
--branch-pattern
=REGEX
-
A regular expression specifying which git branches to match.
This pattern is used as a regex search for any incoming pushes. For example, --branch-pattern=foo will match "foo", "foobar", and "barfoo". Events on a branch that does not match will be ignored.
The syntax of the regular expressions accepted is the syntax accepted by RE2 and described at https://github.com/google/re2/wiki/Syntax.
--tag-pattern
=REGEX
-
A regular expression specifying which git tags to match.
This pattern is used as a regex search for any incoming pushes. For example, --tag-pattern=foo will match "foo", "foobar", and "barfoo". Events on a tag that does not match will be ignored.
The syntax of the regular expressions accepted is the syntax accepted by RE2 and described at https://github.com/google/re2/wiki/Syntax.
-
Exactly one of these must be specified:
-
Build file configuration flags
--build-config
=PATH
-
Path to a YAML or JSON file containing the build configuration in the
repository.
For more details, see: https://cloud.google.com/cloud-build/docs/build-config
-
Build configuration file
--inline-config
=PATH
- Local path to a YAML or JSON file containing a build configuration.
-
Dockerfile build configuration flags
--dockerfile
=DOCKERFILE
-
Path of Dockerfile to use for builds in the repository.
If specified, a build config will be generated to run docker build using the specified file.
The filename is relative to the Dockerfile directory.
--dockerfile-dir
=DOCKERFILE_DIR
; default="/"-
Location of the directory containing the Dockerfile in the repository.
The directory will also be used as the Docker build context.
--dockerfile-image
=DOCKERFILE_IMAGE
-
Docker image name to build.
If not specified, gcr.io/PROJECT/github.com/REPO_OWNER/REPO_NAME:$COMMIT_SHA will be used.
Use a build configuration (cloudbuild.yaml) file for building multiple images in a single trigger.
-
Build file configuration flags
-
Repo resource - Cloud Source Repository. This represents a Cloud resource.
(NOTE) Some attributes are not given arguments in this group but can be set in
other ways. To set the
-
Exactly one of these must be specified:
- GCLOUD WIDE FLAGS
-
These flags are available to all commands:
--account
,--billing-project
,--configuration
,--flags-file
,--flatten
,--format
,--help
,--impersonate-service-account
,--log-http
,--project
,--quiet
,--trace-token
,--user-output-enabled
,--verbosity
.Run
$ gcloud help
for details. - EXAMPLES
-
To create a push trigger for all branches:
gcloud alpha builds triggers create cloud-source-repositories --name="my-trigger" --repo="my-repo" --branch-pattern=".*" --build-config="cloudbuild.yaml"
- NOTES
-
This command is currently in ALPHA and may change without notice. If this
command fails with API permission errors despite specifying the right project,
you may be trying to access an API with an invitation-only early access
allowlist. This variant is also available:
gcloud beta builds triggers create cloud-source-repositories
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-02-16 UTC.