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

update repoType to accept bitbucket_server #13027

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/6816.txt
@@ -0,0 +1,3 @@
```release-note:bug
cloudbuild: fixed the failure when BITBUCKET is provided for `repo_type` on `google_cloudbuild_trigger`
```
8 changes: 4 additions & 4 deletions google/resource_cloudbuild_trigger.go
Expand Up @@ -737,9 +737,9 @@ When using Pub/Sub, Webhook or Manual set the file name using git_file_source in
"repo_type": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validateEnum([]string{"UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET"}),
ValidateFunc: validateEnum([]string{"UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET_SERVER"}),
Description: `The type of the repo, since it may not be explicit from the repo field (e.g from a URL).
Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET Possible values: ["UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET"]`,
Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET_SERVER Possible values: ["UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET_SERVER"]`,
},
"revision": {
Type: schema.TypeString,
Expand Down Expand Up @@ -960,9 +960,9 @@ One of 'trigger_template', 'github', 'pubsub_config' 'webhook_config' or 'source
"repo_type": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validateEnum([]string{"UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET"}),
ValidateFunc: validateEnum([]string{"UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET_SERVER"}),
Description: `The type of the repo, since it may not be explicit from the repo field (e.g from a URL).
Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET Possible values: ["UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET"]`,
Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET_SERVER Possible values: ["UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET_SERVER"]`,
},
"uri": {
Type: schema.TypeString,
Expand Down
40 changes: 40 additions & 0 deletions google/resource_cloudbuild_trigger_test.go
Expand Up @@ -209,6 +209,27 @@ func TestAccCloudBuildTrigger_fullStep(t *testing.T) {
})
}

func TestAccCloudBuildTrigger_basic_bitbucket(t *testing.T) {
t.Parallel()
name := fmt.Sprintf("tf-test-%d", randInt(t))

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckCloudBuildTriggerDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccCloudBuildTrigger_basic_bitbucket(name),
},
{
ResourceName: "google_cloudbuild_trigger.build_trigger",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func testAccCloudBuildTrigger_basic(name string) string {
return fmt.Sprintf(`
resource "google_cloudbuild_trigger" "build_trigger" {
Expand Down Expand Up @@ -266,6 +287,25 @@ resource "google_cloudbuild_trigger" "build_trigger" {
`, name)
}

func testAccCloudBuildTrigger_basic_bitbucket(name string) string {
return fmt.Sprintf(`
resource "google_cloudbuild_trigger" "build_trigger" {
name = "%s"
description = "acceptance test build trigger on bitbucket"
trigger_template {
branch_name = "main"
repo_name = "some-repo"
}
git_file_source {
path = "cloudbuild.yaml"
uri = "https://bitbucket.org/myorg/myrepo"
revision = "refs/heads/develop"
repo_type = "BITBUCKET_SERVER"
}
}
`, name)
}

func testAccCloudBuildTrigger_basicDisabled(name string) string {
return fmt.Sprintf(`
resource "google_cloudbuild_trigger" "build_trigger" {
Expand Down
8 changes: 4 additions & 4 deletions website/docs/r/cloudbuild_trigger.html.markdown
Expand Up @@ -501,8 +501,8 @@ The following arguments are supported:
* `repo_type` -
(Required)
The type of the repo, since it may not be explicit from the repo field (e.g from a URL).
Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET
Possible values are `UNKNOWN`, `CLOUD_SOURCE_REPOSITORIES`, `GITHUB`, and `BITBUCKET`.
Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET_SERVER
Possible values are `UNKNOWN`, `CLOUD_SOURCE_REPOSITORIES`, `GITHUB`, and `BITBUCKET_SERVER`.

* `revision` -
(Optional)
Expand All @@ -523,8 +523,8 @@ The following arguments are supported:
* `repo_type` -
(Required)
The type of the repo, since it may not be explicit from the repo field (e.g from a URL).
Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET
Possible values are `UNKNOWN`, `CLOUD_SOURCE_REPOSITORIES`, `GITHUB`, and `BITBUCKET`.
Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET_SERVER
Possible values are `UNKNOWN`, `CLOUD_SOURCE_REPOSITORIES`, `GITHUB`, and `BITBUCKET_SERVER`.

<a name="nested_trigger_template"></a>The `trigger_template` block supports:

Expand Down