Skip to content

Commit

Permalink
Don't require 'trigger_template' since it conflicts with 'github' in …
Browse files Browse the repository at this point in the history
…beta.

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
nat-henderson authored and modular-magician committed Nov 19, 2019
1 parent 4bfacd2 commit ebc0118
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 95 deletions.
114 changes: 58 additions & 56 deletions google/resource_cloud_build_trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,62 +43,6 @@ func resourceCloudBuildTrigger() *schema.Resource {
SchemaVersion: 1,

Schema: map[string]*schema.Schema{
"trigger_template": {
Type: schema.TypeList,
Required: true,
Description: `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.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"branch_name": {
Type: schema.TypeString,
Optional: true,
Description: `Name of the branch to build. Exactly one a of branch name, tag, or commit SHA must be provided.
This field is a regular expression.`,
ExactlyOneOf: []string{"trigger_template.0.branch_name", "trigger_template.0.tag_name", "trigger_template.0.commit_sha"},
},
"commit_sha": {
Type: schema.TypeString,
Optional: true,
Description: `Explicit commit SHA to build. Exactly one of a branch name, tag, or commit SHA must be provided.`,
ExactlyOneOf: []string{"trigger_template.0.branch_name", "trigger_template.0.tag_name", "trigger_template.0.commit_sha"},
},
"dir": {
Type: schema.TypeString,
Optional: true,
Description: `Directory, relative to the source root, in which to run the build.
This must be a relative path. If a step's dir is specified and
is an absolute path, this value is ignored for that step's
execution.`,
},
"project_id": {
Type: schema.TypeString,
Computed: true,
Optional: true,
Description: `ID of the project that owns the Cloud Source Repository. If
omitted, the project ID requesting the build is assumed.`,
},
"repo_name": {
Type: schema.TypeString,
Optional: true,
Description: `Name of the Cloud Source Repository. If omitted, the name "default" is assumed.`,
Default: "default",
},
"tag_name": {
Type: schema.TypeString,
Optional: true,
Description: `Name of the tag to build. Exactly one of a branch name, tag, or commit SHA must be provided.
This field is a regular expression.`,
ExactlyOneOf: []string{"trigger_template.0.branch_name", "trigger_template.0.tag_name", "trigger_template.0.commit_sha"},
},
},
},
},
"build": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -342,6 +286,64 @@ a build.`,
Description: `Substitutions data for Build resource.`,
Elem: &schema.Schema{Type: schema.TypeString},
},
"trigger_template": {
Type: schema.TypeList,
Optional: true,
Description: `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.
One of 'trigger_template' or 'github' must be provided.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"branch_name": {
Type: schema.TypeString,
Optional: true,
Description: `Name of the branch to build. Exactly one a of branch name, tag, or commit SHA must be provided.
This field is a regular expression.`,
ExactlyOneOf: []string{"trigger_template.0.branch_name", "trigger_template.0.tag_name", "trigger_template.0.commit_sha"},
},
"commit_sha": {
Type: schema.TypeString,
Optional: true,
Description: `Explicit commit SHA to build. Exactly one of a branch name, tag, or commit SHA must be provided.`,
ExactlyOneOf: []string{"trigger_template.0.branch_name", "trigger_template.0.tag_name", "trigger_template.0.commit_sha"},
},
"dir": {
Type: schema.TypeString,
Optional: true,
Description: `Directory, relative to the source root, in which to run the build.
This must be a relative path. If a step's dir is specified and
is an absolute path, this value is ignored for that step's
execution.`,
},
"project_id": {
Type: schema.TypeString,
Computed: true,
Optional: true,
Description: `ID of the project that owns the Cloud Source Repository. If
omitted, the project ID requesting the build is assumed.`,
},
"repo_name": {
Type: schema.TypeString,
Optional: true,
Description: `Name of the Cloud Source Repository. If omitted, the name "default" is assumed.`,
Default: "default",
},
"tag_name": {
Type: schema.TypeString,
Optional: true,
Description: `Name of the tag to build. Exactly one of a branch name, tag, or commit SHA must be provided.
This field is a regular expression.`,
ExactlyOneOf: []string{"trigger_template.0.branch_name", "trigger_template.0.tag_name", "trigger_template.0.commit_sha"},
},
},
},
},
"create_time": {
Type: schema.TypeString,
Computed: true,
Expand Down
79 changes: 40 additions & 39 deletions website/docs/r/cloudbuild_trigger.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -60,45 +60,6 @@ resource "google_cloudbuild_trigger" "filename-trigger" {
The following arguments are supported:


* `trigger_template` -
(Required)
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. Structure is documented below.


The `trigger_template` block supports:

* `project_id` -
(Optional)
ID of the project that owns the Cloud Source Repository. If
omitted, the project ID requesting the build is assumed.

* `repo_name` -
(Optional)
Name of the Cloud Source Repository. If omitted, the name "default" is assumed.

* `dir` -
(Optional)
Directory, relative to the source root, in which to run the build.
This must be a relative path. If a step's dir is specified and
is an absolute path, this value is ignored for that step's
execution.

* `branch_name` -
(Optional)
Name of the branch to build. Exactly one a of branch name, tag, or commit SHA must be provided.
This field is a regular expression.

* `tag_name` -
(Optional)
Name of the tag to build. Exactly one of a branch name, tag, or commit SHA must be provided.
This field is a regular expression.

* `commit_sha` -
(Optional)
Explicit commit SHA to build. Exactly one of a branch name, tag, or commit SHA must be provided.

- - -

Expand Down Expand Up @@ -145,6 +106,14 @@ The `trigger_template` block supports:
those files matches a includedFiles glob. If not, then we do not trigger
a build.

* `trigger_template` -
(Optional)
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.
One of `trigger_template` or `github` must be provided. Structure is documented below.

* `build` -
(Optional)
Contents of the build template. Either a filename or build template must be provided. Structure is documented below.
Expand All @@ -153,6 +122,38 @@ The `trigger_template` block supports:
If it is not provided, the provider project is used.


The `trigger_template` block supports:

* `project_id` -
(Optional)
ID of the project that owns the Cloud Source Repository. If
omitted, the project ID requesting the build is assumed.

* `repo_name` -
(Optional)
Name of the Cloud Source Repository. If omitted, the name "default" is assumed.

* `dir` -
(Optional)
Directory, relative to the source root, in which to run the build.
This must be a relative path. If a step's dir is specified and
is an absolute path, this value is ignored for that step's
execution.

* `branch_name` -
(Optional)
Name of the branch to build. Exactly one a of branch name, tag, or commit SHA must be provided.
This field is a regular expression.

* `tag_name` -
(Optional)
Name of the tag to build. Exactly one of a branch name, tag, or commit SHA must be provided.
This field is a regular expression.

* `commit_sha` -
(Optional)
Explicit commit SHA to build. Exactly one of a branch name, tag, or commit SHA must be provided.

The `build` block supports:

* `tags` -
Expand Down

0 comments on commit ebc0118

Please sign in to comment.