Skip to content

Commit

Permalink
update repoType to accept bitbucket_server (GoogleCloudPlatform#6816)
Browse files Browse the repository at this point in the history
Co-authored-by: Edward Sun <[email protected]>
  • Loading branch information
2 people authored and googlerjk committed Nov 21, 2022
1 parent 7d47c7e commit 92782e0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mmv1/products/cloudbuild/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ objects:
required: true
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
Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET_SERVER
values:
- :UNKNOWN
- :CLOUD_SOURCE_REPOSITORIES
- :GITHUB
- :BITBUCKET
- :BITBUCKET_SERVER
- !ruby/object:Api::Type::String
name: 'revision'
description: |
Expand Down Expand Up @@ -175,12 +175,12 @@ objects:
required: true
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
Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET_SERVER
values:
- :UNKNOWN
- :CLOUD_SOURCE_REPOSITORIES
- :GITHUB
- :BITBUCKET
- :BITBUCKET_SERVER
- !ruby/object:Api::Type::Array
name: 'ignoredFiles'
item_type: Api::Type::String
Expand Down
Original file line number Diff line number Diff line change
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

0 comments on commit 92782e0

Please sign in to comment.