Google Cloud Build V1 Client - Class BuildTrigger (0.15.0)

Reference documentation and code samples for the Google Cloud Build V1 Client class BuildTrigger.

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

Generated from protobuf message google.devtools.cloudbuild.v1.BuildTrigger

Namespace

Google \ Cloud \ Build \ V1

Methods

__construct

Constructor.

Parameters
NameDescription
data array

Optional. Data for populating the Message object.

↳ resource_name string

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

↳ id string

Output only. Unique identifier of the trigger.

↳ description string

Human-readable description of this trigger.

↳ name 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.

↳ tags array

Tags for annotation of a BuildTrigger

↳ trigger_template 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.

↳ github 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.

↳ pubsub_config Google\Cloud\Build\V1\PubsubConfig

PubsubConfig describes the configuration of a trigger that creates a build whenever a Pub/Sub message is published.

↳ webhook_config 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.

↳ autodetect bool

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.

↳ build Google\Cloud\Build\V1\Build

Contents of the build template.

↳ filename string

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

↳ git_file_source Google\Cloud\Build\V1\GitFileSource

The file source describing the local or remote Build template.

↳ create_time Google\Protobuf\Timestamp

Output only. Time when the trigger was created.

↳ disabled bool

If true, the trigger will never automatically execute a build.

↳ substitutions array|Google\Protobuf\Internal\MapField

Substitutions for Build resource. The keys must match the following regular expression: ^_[A-Z0-9_]+$.

↳ ignored_files array

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 array

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.

↳ filter string

Optional. A Common Expression Language string.

↳ source_to_build 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.

↳ service_account string

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) will be used instead. Format: projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}

↳ repository_event_config Google\Cloud\Build\V1\RepositoryEventConfig

The configuration of a trigger that creates a build whenever an event from Repo API is received.

getResourceName

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

Returns
TypeDescription
string

setResourceName

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

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getId

Output only. Unique identifier of the trigger.

Returns
TypeDescription
string

setId

Output only. Unique identifier of the trigger.

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getDescription

Human-readable description of this trigger.

Returns
TypeDescription
string

setDescription

Human-readable description of this trigger.

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getName

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
TypeDescription
string

setName

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.
Parameter
NameDescription
var string
Returns
TypeDescription
$this

getTags

Tags for annotation of a BuildTrigger

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setTags

Tags for annotation of a BuildTrigger

Parameter
NameDescription
var string[]
Returns
TypeDescription
$this

getTriggerTemplate

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
TypeDescription
Google\Cloud\Build\V1\RepoSource|null

hasTriggerTemplate

clearTriggerTemplate

setTriggerTemplate

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.

Parameter
NameDescription
var Google\Cloud\Build\V1\RepoSource
Returns
TypeDescription
$this

getGithub

GitHubEventsConfig describes the configuration of a trigger that creates a build whenever a GitHub event is received.

Mutually exclusive with trigger_template.

Returns
TypeDescription
Google\Cloud\Build\V1\GitHubEventsConfig|null

hasGithub

clearGithub

setGithub

GitHubEventsConfig describes the configuration of a trigger that creates a build whenever a GitHub event is received.

Mutually exclusive with trigger_template.

Parameter
NameDescription
var Google\Cloud\Build\V1\GitHubEventsConfig
Returns
TypeDescription
$this

getPubsubConfig

PubsubConfig describes the configuration of a trigger that creates a build whenever a Pub/Sub message is published.

Returns
TypeDescription
Google\Cloud\Build\V1\PubsubConfig|null

hasPubsubConfig

clearPubsubConfig

setPubsubConfig

PubsubConfig describes the configuration of a trigger that creates a build whenever a Pub/Sub message is published.

Parameter
NameDescription
var Google\Cloud\Build\V1\PubsubConfig
Returns
TypeDescription
$this

getWebhookConfig

WebhookConfig describes the configuration of a trigger that creates a build whenever a webhook is sent to a trigger's webhook URL.

Returns
TypeDescription
Google\Cloud\Build\V1\WebhookConfig|null

hasWebhookConfig

clearWebhookConfig

setWebhookConfig

WebhookConfig describes the configuration of a trigger that creates a build whenever a webhook is sent to a trigger's webhook URL.

Parameter
NameDescription
var Google\Cloud\Build\V1\WebhookConfig
Returns
TypeDescription
$this

getAutodetect

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.
Returns
TypeDescription
bool

hasAutodetect

setAutodetect

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.
Parameter
NameDescription
var bool
Returns
TypeDescription
$this

getBuild

Contents of the build template.

Returns
TypeDescription
Google\Cloud\Build\V1\Build|null

hasBuild

setBuild

Contents of the build template.

Parameter
NameDescription
var Google\Cloud\Build\V1\Build
Returns
TypeDescription
$this

getFilename

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

Returns
TypeDescription
string

hasFilename

setFilename

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

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getGitFileSource

The file source describing the local or remote Build template.

Returns
TypeDescription
Google\Cloud\Build\V1\GitFileSource|null

hasGitFileSource

setGitFileSource

The file source describing the local or remote Build template.

Parameter
NameDescription
var Google\Cloud\Build\V1\GitFileSource
Returns
TypeDescription
$this

getCreateTime

Output only. Time when the trigger was created.

Returns
TypeDescription
Google\Protobuf\Timestamp|null

hasCreateTime

clearCreateTime

setCreateTime

Output only. Time when the trigger was created.

Parameter
NameDescription
var Google\Protobuf\Timestamp
Returns
TypeDescription
$this

getDisabled

If true, the trigger will never automatically execute a build.

Returns
TypeDescription
bool

setDisabled

If true, the trigger will never automatically execute a build.

Parameter
NameDescription
var bool
Returns
TypeDescription
$this

getSubstitutions

Substitutions for Build resource. The keys must match the following regular expression: ^_[A-Z0-9_]+$.

Returns
TypeDescription
Google\Protobuf\Internal\MapField

setSubstitutions

Substitutions for Build resource. The keys must match the following regular expression: ^_[A-Z0-9_]+$.

Parameter
NameDescription
var array|Google\Protobuf\Internal\MapField
Returns
TypeDescription
$this

getIgnoredFiles

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
TypeDescription
Google\Protobuf\Internal\RepeatedField

setIgnoredFiles

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.

Parameter
NameDescription
var string[]
Returns
TypeDescription
$this

getIncludedFiles

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
TypeDescription
Google\Protobuf\Internal\RepeatedField

setIncludedFiles

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.

Parameter
NameDescription
var string[]
Returns
TypeDescription
$this

getFilter

Optional. A Common Expression Language string.

Returns
TypeDescription
string

setFilter

Optional. A Common Expression Language string.

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getSourceToBuild

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
TypeDescription
Google\Cloud\Build\V1\GitRepoSource|null

hasSourceToBuild

clearSourceToBuild

setSourceToBuild

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.

Parameter
NameDescription
var Google\Cloud\Build\V1\GitRepoSource
Returns
TypeDescription
$this

getServiceAccount

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) will be used instead. Format: projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}

Returns
TypeDescription
string

setServiceAccount

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) will be used instead. Format: projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getRepositoryEventConfig

The configuration of a trigger that creates a build whenever an event from Repo API is received.

Returns
TypeDescription
Google\Cloud\Build\V1\RepositoryEventConfig|null

hasRepositoryEventConfig

clearRepositoryEventConfig

setRepositoryEventConfig

The configuration of a trigger that creates a build whenever an event from Repo API is received.

Parameter
NameDescription
var Google\Cloud\Build\V1\RepositoryEventConfig
Returns
TypeDescription
$this

getBuildTemplate

Returns
TypeDescription
string