# Cloud Build V1 API - Class Google::Cloud::Build::V1::BuildTrigger (v1.12.0)

1.12.0 (latest) 1.11.0 1.10.0 1.9.1 1.8.0 1.7.0 1.6.1 1.5.1 1.4.0 1.3.0 1.2.0 1.1.0 1.0.1 0.27.1 0.26.2 0.25.0 0.24.0 0.23.0 0.22.0 0.21.0 0.20.0 0.19.0 0.18.0 0.17.0 0.16.0 0.15.0 0.14.0 0.13.0 0.12.0 0.11.3 Reference documentation and code samples for the Cloud Build V1 API class Google::Cloud::Build::V1::BuildTrigger.

Configuration for an automated build in response to source repository
changes.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #autodetect

    def autodetect() -> ::Boolean

**Returns**

- (::Boolean) --- Autodetect build configuration. The following precedence is used (case insensitive):

  1. cloudbuild.yaml
  2. cloudbuild.yml
  3. cloudbuild.json
  4. Dockerfile

  Currently only available for GitHub App Triggers.

  Note: The following fields are mutually exclusive: `autodetect`, `build`, `filename`, `git_file_source`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #autodetect=

    def autodetect=(value) -> ::Boolean

**Parameter**

- **value** (::Boolean) --- Autodetect build configuration. The following precedence is used (case insensitive):


  1. cloudbuild.yaml
  2. cloudbuild.yml
  3. cloudbuild.json
  4. Dockerfile

  Currently only available for GitHub App Triggers.

  Note: The following fields are mutually exclusive: `autodetect`, `build`, `filename`, `git_file_source`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- (::Boolean) --- Autodetect build configuration. The following precedence is used (case insensitive):

  1. cloudbuild.yaml
  2. cloudbuild.yml
  3. cloudbuild.json
  4. Dockerfile

  Currently only available for GitHub App Triggers.

  Note: The following fields are mutually exclusive: `autodetect`, `build`, `filename`, `git_file_source`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #build

    def build() -> ::Google::Cloud::Build::V1::Build

**Returns**

- ([::Google::Cloud::Build::V1::Build](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-Build)) --- Contents of the build template.


  Note: The following fields are mutually exclusive: `build`, `autodetect`, `filename`, `git_file_source`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #build=

    def build=(value) -> ::Google::Cloud::Build::V1::Build

**Parameter**

- **value** ([::Google::Cloud::Build::V1::Build](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-Build)) --- Contents of the build template.


  Note: The following fields are mutually exclusive: `build`, `autodetect`, `filename`, `git_file_source`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::Build::V1::Build](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-Build)) --- Contents of the build template.


  Note: The following fields are mutually exclusive: `build`, `autodetect`, `filename`, `git_file_source`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #create_time

    def create_time() -> ::Google::Protobuf::Timestamp

**Returns**

- ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Protobuf-Timestamp)) --- Output only. Time when the trigger was created.

### #description

    def description() -> ::String

**Returns**

- (::String) --- Human-readable description of this trigger.

### #description=

    def description=(value) -> ::String

**Parameter**

- **value** (::String) --- Human-readable description of this trigger.
**Returns**

- (::String) --- Human-readable description of this trigger.

### #disabled

    def disabled() -> ::Boolean

**Returns**

- (::Boolean) --- If true, the trigger will never automatically execute a build.

### #disabled=

    def disabled=(value) -> ::Boolean

**Parameter**

- **value** (::Boolean) --- If true, the trigger will never automatically execute a build.
**Returns**

- (::Boolean) --- If true, the trigger will never automatically execute a build.

### #filename

    def filename() -> ::String

**Returns**

- (::String) --- Path, from the source root, to the build configuration file (i.e. cloudbuild.yaml).

  Note: The following fields are mutually exclusive: `filename`, `autodetect`, `build`, `git_file_source`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #filename=

    def filename=(value) -> ::String

**Parameter**

- **value** (::String) --- Path, from the source root, to the build configuration file (i.e. cloudbuild.yaml).


  Note: The following fields are mutually exclusive: `filename`, `autodetect`, `build`, `git_file_source`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- (::String) --- Path, from the source root, to the build configuration file (i.e. cloudbuild.yaml).

  Note: The following fields are mutually exclusive: `filename`, `autodetect`, `build`, `git_file_source`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #filter

    def filter() -> ::String

**Returns**

- (::String) --- Optional. A Common Expression Language string.

### #filter=

    def filter=(value) -> ::String

**Parameter**

- **value** (::String) --- Optional. A Common Expression Language string.
**Returns**

- (::String) --- Optional. A Common Expression Language string.

### #git_file_source

    def git_file_source() -> ::Google::Cloud::Build::V1::GitFileSource

**Returns**

- ([::Google::Cloud::Build::V1::GitFileSource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-GitFileSource)) --- The file source describing the local or remote Build template.


  Note: The following fields are mutually exclusive: `git_file_source`, `autodetect`, `build`, `filename`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #git_file_source=

    def git_file_source=(value) -> ::Google::Cloud::Build::V1::GitFileSource

**Parameter**

- **value** ([::Google::Cloud::Build::V1::GitFileSource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-GitFileSource)) --- The file source describing the local or remote Build template.


  Note: The following fields are mutually exclusive: `git_file_source`, `autodetect`, `build`, `filename`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::Build::V1::GitFileSource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-GitFileSource)) --- The file source describing the local or remote Build template.


  Note: The following fields are mutually exclusive: `git_file_source`, `autodetect`, `build`, `filename`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #github

    def github() -> ::Google::Cloud::Build::V1::GitHubEventsConfig

**Returns**

- ([::Google::Cloud::Build::V1::GitHubEventsConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-GitHubEventsConfig)) --- GitHubEventsConfig describes the configuration of a trigger that creates a build whenever a GitHub event is received.


  Mutually exclusive with `trigger_template`.

### #github=

    def github=(value) -> ::Google::Cloud::Build::V1::GitHubEventsConfig

**Parameter**

- **value** ([::Google::Cloud::Build::V1::GitHubEventsConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-GitHubEventsConfig)) --- GitHubEventsConfig describes the configuration of a trigger that creates a build whenever a GitHub event is received.


  Mutually exclusive with `trigger_template`.
**Returns**

- ([::Google::Cloud::Build::V1::GitHubEventsConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-GitHubEventsConfig)) --- GitHubEventsConfig describes the configuration of a trigger that creates a build whenever a GitHub event is received.


  Mutually exclusive with `trigger_template`.

### #id

    def id() -> ::String

**Returns**

- (::String) --- Output only. Unique identifier of the trigger.

### #ignored_files

    def ignored_files() -> ::Array<::String>

**Returns**

- (::Array\<::String\>) --- ignored_files and included_files are file glob matches using https://golang.org/pkg/path/filepath/#Match extended with support for "\*\*".

  If ignored_files and changed files are both empty, then they are
  not used to determine whether or not to trigger a build.

  If ignored_files is not empty, then we ignore any files that match
  any of the ignored_file globs. If the change has no files that are
  outside of the ignored_files globs, then we do not trigger a build.

### #ignored_files=

    def ignored_files=(value) -> ::Array<::String>

**Parameter**

- **value** (::Array\<::String\>) --- ignored_files and included_files are file glob matches using https://golang.org/pkg/path/filepath/#Match extended with support for "\*\*".


  If ignored_files and changed files are both empty, then they are
  not used to determine whether or not to trigger a build.

  If ignored_files is not empty, then we ignore any files that match
  any of the ignored_file globs. If the change has no files that are
  outside of the ignored_files globs, then we do not trigger a build.
**Returns**

- (::Array\<::String\>) --- ignored_files and included_files are file glob matches using https://golang.org/pkg/path/filepath/#Match extended with support for "\*\*".

  If ignored_files and changed files are both empty, then they are
  not used to determine whether or not to trigger a build.

  If ignored_files is not empty, then we ignore any files that match
  any of the ignored_file globs. If the change has no files that are
  outside of the ignored_files globs, then we do not trigger a build.

### #included_files

    def included_files() -> ::Array<::String>

**Returns**

- (::Array\<::String\>) --- If any of the files altered in the commit pass the ignored_files filter and included_files is empty, then as far as this filter is concerned, we should trigger the build.

  If any of the files altered in the commit pass the ignored_files
  filter and included_files is not empty, then we make sure that at
  least one of those files matches a included_files glob. If not,
  then we do not trigger a build.

### #included_files=

    def included_files=(value) -> ::Array<::String>

**Parameter**

- **value** (::Array\<::String\>) --- If any of the files altered in the commit pass the ignored_files filter and included_files is empty, then as far as this filter is concerned, we should trigger the build.


  If any of the files altered in the commit pass the ignored_files
  filter and included_files is not empty, then we make sure that at
  least one of those files matches a included_files glob. If not,
  then we do not trigger a build.
**Returns**

- (::Array\<::String\>) --- If any of the files altered in the commit pass the ignored_files filter and included_files is empty, then as far as this filter is concerned, we should trigger the build.

  If any of the files altered in the commit pass the ignored_files
  filter and included_files is not empty, then we make sure that at
  least one of those files matches a included_files glob. If not,
  then we do not trigger a build.

### #name

    def name() -> ::String

**Returns**

- (::String) --- User-assigned name of the trigger. Must be unique within the project.
  Trigger names must meet the following requirements:

  - They must contain only alphanumeric characters and dashes.
  - They can be 1-64 characters long.
  - They must begin and end with an alphanumeric character.

### #name=

    def name=(value) -> ::String

**Parameter**

- **value** (::String) ---

  User-assigned name of the trigger. Must be unique within the project.
  Trigger names must meet the following requirements:
  - They must contain only alphanumeric characters and dashes.
  - They can be 1-64 characters long.
  - They must begin and end with an alphanumeric character.
**Returns**

- (::String) --- User-assigned name of the trigger. Must be unique within the project.
  Trigger names must meet the following requirements:

  - They must contain only alphanumeric characters and dashes.
  - They can be 1-64 characters long.
  - They must begin and end with an alphanumeric character.

### #pubsub_config

    def pubsub_config() -> ::Google::Cloud::Build::V1::PubsubConfig

**Returns**

- ([::Google::Cloud::Build::V1::PubsubConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-PubsubConfig)) --- PubsubConfig describes the configuration of a trigger that creates a build whenever a Pub/Sub message is published.

### #pubsub_config=

    def pubsub_config=(value) -> ::Google::Cloud::Build::V1::PubsubConfig

**Parameter**

- **value** ([::Google::Cloud::Build::V1::PubsubConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-PubsubConfig)) --- PubsubConfig describes the configuration of a trigger that creates a build whenever a Pub/Sub message is published.
**Returns**

- ([::Google::Cloud::Build::V1::PubsubConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-PubsubConfig)) --- PubsubConfig describes the configuration of a trigger that creates a build whenever a Pub/Sub message is published.

### #repository_event_config

    def repository_event_config() -> ::Google::Cloud::Build::V1::RepositoryEventConfig

**Returns**

- ([::Google::Cloud::Build::V1::RepositoryEventConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-RepositoryEventConfig)) --- The configuration of a trigger that creates a build whenever an event from Repo API is received.

### #repository_event_config=

    def repository_event_config=(value) -> ::Google::Cloud::Build::V1::RepositoryEventConfig

**Parameter**

- **value** ([::Google::Cloud::Build::V1::RepositoryEventConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-RepositoryEventConfig)) --- The configuration of a trigger that creates a build whenever an event from Repo API is received.
**Returns**

- ([::Google::Cloud::Build::V1::RepositoryEventConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-RepositoryEventConfig)) --- The configuration of a trigger that creates a build whenever an event from Repo API is received.

### #resource_name

    def resource_name() -> ::String

**Returns**

- (::String) --- The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service.

### #resource_name=

    def resource_name=(value) -> ::String

**Parameter**

- **value** (::String) --- The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service.
**Returns**

- (::String) --- The `Trigger` name with format: `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger} is a unique identifier generated by the service.

### #service_account

    def service_account() -> ::String

**Returns**

- (::String) --- The service account used for all user-controlled operations including UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild. If no service account is set and the legacy Cloud Build service account (`[PROJECT_NUM]@cloudbuild.gserviceaccount.com`) is the default for the project then it will be used instead. Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`

### #service_account=

    def service_account=(value) -> ::String

**Parameter**

- **value** (::String) --- The service account used for all user-controlled operations including UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild. If no service account is set and the legacy Cloud Build service account (`[PROJECT_NUM]@cloudbuild.gserviceaccount.com`) is the default for the project then it will be used instead. Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
**Returns**

- (::String) --- The service account used for all user-controlled operations including UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild. If no service account is set and the legacy Cloud Build service account (`[PROJECT_NUM]@cloudbuild.gserviceaccount.com`) is the default for the project then it will be used instead. Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`

### #source_to_build

    def source_to_build() -> ::Google::Cloud::Build::V1::GitRepoSource

**Returns**

- ([::Google::Cloud::Build::V1::GitRepoSource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-GitRepoSource)) --- The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers.

### #source_to_build=

    def source_to_build=(value) -> ::Google::Cloud::Build::V1::GitRepoSource

**Parameter**

- **value** ([::Google::Cloud::Build::V1::GitRepoSource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-GitRepoSource)) --- The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers.
**Returns**

- ([::Google::Cloud::Build::V1::GitRepoSource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-GitRepoSource)) --- The repo and ref of the repository from which to build. This field is used only for those triggers that do not respond to SCM events. Triggers that respond to such events build source at whatever commit caused the event. This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers.

### #substitutions

    def substitutions() -> ::Google::Protobuf::Map{::String => ::String}

**Returns**

- (::Google::Protobuf::Map{::String =\> ::String}) --- Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`.

### #substitutions=

    def substitutions=(value) -> ::Google::Protobuf::Map{::String => ::String}

**Parameter**

- **value** (::Google::Protobuf::Map{::String =\> ::String}) --- Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`.
**Returns**

- (::Google::Protobuf::Map{::String =\> ::String}) --- Substitutions for Build resource. The keys must match the following regular expression: `^_[A-Z0-9_]+$`.

### #tags

    def tags() -> ::Array<::String>

**Returns**

- (::Array\<::String\>) --- Tags for annotation of a `BuildTrigger`

### #tags=

    def tags=(value) -> ::Array<::String>

**Parameter**

- **value** (::Array\<::String\>) --- Tags for annotation of a `BuildTrigger`
**Returns**

- (::Array\<::String\>) --- Tags for annotation of a `BuildTrigger`

### #trigger_template

    def trigger_template() -> ::Google::Cloud::Build::V1::RepoSource

**Returns**

- ([::Google::Cloud::Build::V1::RepoSource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-RepoSource)) --- Template describing the types of source changes to trigger a build.


  Branch and tag names in trigger templates are interpreted as regular
  expressions. Any branch or tag change that matches that regular expression
  will trigger a build.

  Mutually exclusive with `github`.

### #trigger_template=

    def trigger_template=(value) -> ::Google::Cloud::Build::V1::RepoSource

**Parameter**

- **value** ([::Google::Cloud::Build::V1::RepoSource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-RepoSource)) --- Template describing the types of source changes to trigger a build.


  Branch and tag names in trigger templates are interpreted as regular
  expressions. Any branch or tag change that matches that regular expression
  will trigger a build.

  Mutually exclusive with `github`.
**Returns**

- ([::Google::Cloud::Build::V1::RepoSource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-RepoSource)) --- Template describing the types of source changes to trigger a build.


  Branch and tag names in trigger templates are interpreted as regular
  expressions. Any branch or tag change that matches that regular expression
  will trigger a build.

  Mutually exclusive with `github`.

### #webhook_config

    def webhook_config() -> ::Google::Cloud::Build::V1::WebhookConfig

**Returns**

- ([::Google::Cloud::Build::V1::WebhookConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-WebhookConfig)) --- WebhookConfig describes the configuration of a trigger that creates a build whenever a webhook is sent to a trigger's webhook URL.

### #webhook_config=

    def webhook_config=(value) -> ::Google::Cloud::Build::V1::WebhookConfig

**Parameter**

- **value** ([::Google::Cloud::Build::V1::WebhookConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-WebhookConfig)) --- WebhookConfig describes the configuration of a trigger that creates a build whenever a webhook is sent to a trigger's webhook URL.
**Returns**

- ([::Google::Cloud::Build::V1::WebhookConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-build-v1/latest/Google-Cloud-Build-V1-WebhookConfig)) --- WebhookConfig describes the configuration of a trigger that creates a build whenever a webhook is sent to a trigger's webhook URL.