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

Add filter_enabled and filter_condition properties #157

Merged
merged 3 commits into from
Jun 19, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions buildkite/resource_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,16 @@ func resourcePipeline() *schema.Resource {
Optional: true,
Type: schema.TypeBool,
},
"filter_enabled": {
Computed: true,
Optional: true,
Type: schema.TypeBool,
},
"filter_condition": {
Computed: true,
Optional: true,
Type: schema.TypeString,
},
"publish_commit_status": {
Computed: true,
Optional: true,
Expand Down Expand Up @@ -438,6 +448,8 @@ type PipelineExtraInfo struct {
BuildBranches bool `json:"build_branches"`
BuildTags bool `json:"build_tags"`
CancelDeletedBranchBuilds bool `json:"cancel_deleted_branch_builds"`
FilterEnabled bool `json:"filter_enabled"`
FilterCondition string `json:"filter_condition"`
PublishCommitStatus bool `json:"publish_commit_status"`
PublishBlockedAsPending bool `json:"publish_blocked_as_pending"`
PublishCommitStatusPerStep bool `json:"publish_commit_status_per_step"`
Expand Down Expand Up @@ -679,6 +691,8 @@ func updatePipelineResourceExtraInfo(d *schema.ResourceData, pipeline *PipelineE
"skip_pull_request_builds_for_existing_commits": s.SkipPullRequestBuildsForExistingCommits,
"build_pull_request_ready_for_review": s.BuildPullRequestReadyForReview,
"build_pull_request_forks": s.BuildPullRequestForks,
"filter_enabled": s.FilterEnabled,
"filter_condition": s.FilterCondition,
"prefix_pull_request_fork_branch_names": s.PrefixPullRequestForkBranchNames,
"build_branches": s.BuildBranches,
"build_tags": s.BuildTags,
Expand Down
4 changes: 4 additions & 0 deletions buildkite/resource_pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ func TestAccPipeline_add_remove_complex(t *testing.T) {
resource.TestCheckResourceAttr("buildkite_pipeline.foobar", "provider_settings.0.build_pull_requests", "false"),
resource.TestCheckResourceAttr("buildkite_pipeline.foobar", "provider_settings.0.build_tags", "true"),
resource.TestCheckResourceAttr("buildkite_pipeline.foobar", "provider_settings.0.cancel_deleted_branch_builds", "true"),
resource.TestCheckResourceAttr("buildkite_pipeline.foobar", "provider_settings.0.filter_enabled", "true"),
resource.TestCheckResourceAttr("buildkite_pipeline.foobar", "provider_settings.0.filter_condition", "build.pull_request.id == 123"),
resource.TestCheckResourceAttr("buildkite_pipeline.foobar", "provider_settings.0.prefix_pull_request_fork_branch_names", "true"),
resource.TestCheckResourceAttr("buildkite_pipeline.foobar", "provider_settings.0.publish_blocked_as_pending", "true"),
resource.TestCheckResourceAttr("buildkite_pipeline.foobar", "provider_settings.0.publish_commit_status", "true"),
Expand Down Expand Up @@ -328,6 +330,8 @@ func testAccPipelineConfigComplex(name string, steps string) string {
build_pull_requests = false
build_tags = true
cancel_deleted_branch_builds = true
filter_enabled = true
filter_condition = "build.pull_request.id == 123"
prefix_pull_request_fork_branch_names = true
publish_blocked_as_pending = true
publish_commit_status = true
Expand Down