Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud Build Trigger's trigger template should be required. #4538

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 35 additions & 35 deletions google/resource_cloud_build_trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,41 @@ func resourceCloudBuildTrigger() *schema.Resource {
SchemaVersion: 1,

Schema: map[string]*schema.Schema{
"trigger_template": {
Type: schema.TypeList,
Required: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"branch_name": {
Type: schema.TypeString,
Optional: true,
},
"commit_sha": {
Type: schema.TypeString,
Optional: true,
},
"dir": {
Type: schema.TypeString,
Optional: true,
},
"project_id": {
Type: schema.TypeString,
Computed: true,
Optional: true,
},
"repo_name": {
Type: schema.TypeString,
Optional: true,
Default: "default",
},
"tag_name": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
"build": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -175,41 +210,6 @@ func resourceCloudBuildTrigger() *schema.Resource {
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"trigger_template": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"branch_name": {
Type: schema.TypeString,
Optional: true,
},
"commit_sha": {
Type: schema.TypeString,
Optional: true,
},
"dir": {
Type: schema.TypeString,
Optional: true,
},
"project_id": {
Type: schema.TypeString,
Computed: true,
Optional: true,
},
"repo_name": {
Type: schema.TypeString,
Optional: true,
Default: "default",
},
"tag_name": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
"create_time": {
Type: schema.TypeString,
Computed: true,
Expand Down
75 changes: 37 additions & 38 deletions website/docs/r/cloudbuild_trigger.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,43 @@ 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.

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

* `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 @@ -101,14 +138,6 @@ The following arguments are supported:
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.
This field is required, and will be validated as such in 3.0.0. 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 @@ -117,36 +146,6 @@ The following arguments are supported:
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.

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

* `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