1
0
Fork 0
mirror of https://github.com/imjasonh/gcloud-help synced 2026-07-11 15:39:42 +00:00
gcloud-help/gcloud/beta/builds/triggers/create/developer-connect
2026-02-11 11:28:25 +00:00

227 lines
9.5 KiB
Text

NAME
gcloud beta builds triggers create developer-connect - create a build
trigger for a Developer Connect repository
SYNOPSIS
gcloud beta builds triggers create developer-connect
(--trigger-config=PATH | [(--branch-pattern=REGEX | --tag-pattern=REGEX
| [--pull-request-pattern=REGEX : --comment-control=COMMENT_CONTROL;
default="COMMENTS_ENABLED"]) (--build-config=PATH
| --inline-config=PATH
| [--dockerfile=DOCKERFILE --dockerfile-image=DOCKERFILE_IMAGE
: --dockerfile-dir=DOCKERFILE_DIR; default="/"])
: --description=DESCRIPTION --git-repository-link=GIT_REPOSITORY_LINK
--ignored-files=[GLOB,...] --included-files=[GLOB,...] --name=NAME
--region=REGION --[no-]require-approval
--service-account=SERVICE_ACCOUNT --substitutions=[KEY=VALUE,...]])
[GCLOUD_WIDE_FLAG ...]
DESCRIPTION
(BETA) Create a build trigger for a Developer Connect repository.
EXAMPLES
To create a push trigger with a DC repository for all branches:
$ gcloud beta builds triggers create developer-connect \
--name="my-trigger" \
--service-account="projects/my-project/serviceAccounts/my-byosa@\
my-project.iam.gserviceaccount.com" \
--git-repository-link="projects/1234/locations/us-central1/conne\
ctions/myconn/gitRepositoryLinks/mylink" --branch-pattern=".*" \
--build-config="cloudbuild.yaml" --region=us-central1
To create a pull request trigger with a DC repository for main:
$ gcloud beta builds triggers create developer-connect \
--name="my-trigger" \
--service-account="projects/my-project/serviceAccounts/my-byosa@\
my-project.iam.gserviceaccount.com" \
--repository="projects/1234/locations/us-central1/connections/my\
conn/gitRepositoryLinks/mylink" --build-config="cloudbuild.yaml" \
--pull-request-pattern="^main$" --region=us-central1
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
Or at least one of these can be specified:
Flag based trigger configuration
--description=DESCRIPTION
Build trigger description.
--git-repository-link=GIT_REPOSITORY_LINK
Developer Connect resource to use, in the format
"projects/*/locations/*/connections/*/gitRepositoryLinks/".
--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.
--region=REGION
The region of the Cloud Build Service to use. Must be set to a
supported region name (e.g. us-central1). If unset, builds/region,
which is the default region to use when working with Cloud Build
resources, is used. If builds/region is unset, region is set to
global. Note: Region must be specified in 2nd gen repo; global is
not supported.
--[no-]require-approval
Require manual approval for triggered builds. Use
--require-approval to enable and --no-require-approval to disable.
--service-account=SERVICE_ACCOUNT
The service account used for all user-controlled operations
including UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and
CancelBuild. If no service account is set, then the standard Cloud
Build service account ([PROJECT_NUM]@system.gserviceaccount.com) is
used instead. Format:
projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}.
--substitutions=[KEY=VALUE,...]
Parameters to be substituted in the build specification. For
example:
$ gcloud beta builds triggers create developer-connect ... \
--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".
Substitutions can be applied to user-defined variables (starting
with an underscore) and to the following built-in variables:
REPO_NAME, BRANCH_NAME, TAG_NAME, REVISION_ID, COMMIT_SHA,
SHORT_SHA.
For more details, see:
https://cloud.google.com/build/docs/configuring-builds/substitute-variable-values
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 regular expression 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 regular expression 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.
Or at least one of these can be specified:
Pull Request settings
--pull-request-pattern=REGEX
Regular expression specifying which base git branch to match
for pull request events.
This pattern is used as a regex search for the base branch (the
branch you are trying to merge into) for pull request updates.
For example, --pull-request-pattern=foo will match "foo",
"foobar", and "barfoo".
The syntax of the regular expressions accepted is the syntax
accepted by RE2 and described at
https://github.com/google/re2/wiki/Syntax.
This flag argument must be specified if any of the other
arguments in this group are specified.
--comment-control=COMMENT_CONTROL; default="COMMENTS_ENABLED"
Require a repository collaborator or owner to comment '/gcbrun'
on a pull request before running the build. COMMENT_CONTROL
must be one of:
COMMENTS_DISABLED
Do not require comments on Pull Requests before builds are
triggered.
COMMENTS_ENABLED
Enforce that repository owners or collaborators must
comment on Pull Requests before builds are triggered.
COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY
Enforce that repository owners or collaborators must
comment on external contributors' Pull Requests before
builds are triggered.
Exactly one of these must be specified:
--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
--inline-config=PATH
Local path to a YAML or JSON file containing a build
configuration.
Or at least one of these can be specified:
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.
This flag argument must be specified if any of the other
arguments in this group are specified.
--dockerfile-image=DOCKERFILE_IMAGE
Docker image name to build.
This flag argument must be specified if any of the other
arguments in this group are specified.
--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.
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 help for details.
NOTES
This command is currently in beta and might change without notice. This
variant is also available:
$ gcloud alpha builds triggers create developer-connect