gcloud beta builds triggers create pubsub - create a build trigger with a Pub/Sub trigger event
gcloud beta builds triggers create pubsub (--trigger-config=PATH | [--topic=TOPIC (--build-config=PATH | --inline-config=PATH | [--dockerfile=DOCKERFILE : --dockerfile-dir=DOCKERFILE_DIR; default="/" --dockerfile-image=DOCKERFILE_IMAGE]) : --description=DESCRIPTION --github-enterprise-config=GITHUB_ENTERPRISE_CONFIG --name=NAME --region=REGION --require-approval --service-account=SERVICE_ACCOUNT --subscription-filter=SUBSCRIPTION_FILTER --substitutions=[KEY=VALUE,...] --repo=REPO --repo-type=REPO_TYPE (--branch=BRANCH | --tag=TAG)]) [GCLOUD_WIDE_FLAG ...]
(BETA) Create a build trigger with a Pub/Sub trigger event.
To create a Pub/Sub trigger that listens to topic my-topic and builds off branch my-branch in a GitHub repository named my-repo:
$ gcloud beta builds triggers create pubsub \ --name=my-pubsub-trigger \ --service-account="projects/my-project/serviceAccounts/my-byosa@\ my-project.iam.gserviceaccount.com" \ --topic=projects/my-project/topics/my-topic \ --repo=https://www.github.com/owner/repo --repo-type=GITHUB \ --branch=my-branch
- 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
- --topic=TOPIC
The topic to which this trigger should subscribe.
This flag argument must be specified if any of the other arguments in this group are specified.
- --description=DESCRIPTION
Build trigger description.
- --github-enterprise-config=GITHUB_ENTERPRISE_CONFIG
The resource name of the GitHub Enterprise config that should be applied to this source. Format: projects/{project}/locations/{location}/githubEnterpriseConfigs/{id} or projects/{project}/githubEnterpriseConfigs/{id}
- --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.
- --require-approval
Require manual approval for triggered builds.
- --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}.
- --subscription-filter=SUBSCRIPTION_FILTER
CEL filter expression for the trigger. See https://cloud.google.com/build/docs/filter-build-events-using-cel for more details.
- --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=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: https://cloud.google.com/cloud-build/docs/api/build-requests#substitutions
- 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.
- 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-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.
- Flags for repository information
- --repo=REPO
URI of the repository. Currently only HTTP URIs for GitHub and Cloud Source Repositories are supported.
This flag argument must be specified if any of the other arguments in this group are specified.
- --repo-type=REPO_TYPE
Type of the repository. Currently only GitHub and Cloud Source Repository types are supported.
This flag argument must be specified if any of the other arguments in this group are specified.
- Exactly one of these must be specified:
- --branch=BRANCH
Branch to build.
- --tag=TAG
Tag to build.
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.
This command is currently in beta and might change without notice. These variants are also available:
$ gcloud builds triggers create pubsub
$ gcloud alpha builds triggers create pubsub