Skip to content

Commit 0782637

Browse files
committed
feat: remove merge queue and required deployments from GitHub enterprise ruleset schema
1 parent 49b847c commit 0782637

3 files changed

Lines changed: 3 additions & 162 deletions

File tree

github/data_source_github_enterprise_ruleset.go

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -209,67 +209,6 @@ func dataSourceGithubEnterpriseRuleset() *schema.Resource {
209209
Computed: true,
210210
Description: "Commits pushed to matching branches must have verified signatures.",
211211
},
212-
"merge_queue": {
213-
Type: schema.TypeList,
214-
Computed: true,
215-
Description: "Merges must be performed via a merge queue.",
216-
Elem: &schema.Resource{
217-
Schema: map[string]*schema.Schema{
218-
"check_response_timeout_minutes": {
219-
Type: schema.TypeInt,
220-
Computed: true,
221-
Description: "Maximum time for a required status check to report a conclusion.",
222-
},
223-
"grouping_strategy": {
224-
Type: schema.TypeString,
225-
Computed: true,
226-
Description: "When set to ALLGREEN, the merge commit created by merge queue for each PR in the group must pass all required checks to merge. When set to HEADGREEN, only the commit at the head of the merge group must pass its required checks to merge.",
227-
},
228-
"max_entries_to_build": {
229-
Type: schema.TypeInt,
230-
Computed: true,
231-
Description: "Limit the number of queued pull requests requesting checks and workflow runs at the same time.",
232-
},
233-
"max_entries_to_merge": {
234-
Type: schema.TypeInt,
235-
Computed: true,
236-
Description: "The maximum number of PRs that will be merged together in a group.",
237-
},
238-
"merge_method": {
239-
Type: schema.TypeString,
240-
Computed: true,
241-
Description: "Method to use when merging changes from queued pull requests.",
242-
},
243-
"min_entries_to_merge": {
244-
Type: schema.TypeInt,
245-
Computed: true,
246-
Description: "The minimum number of PRs that will be merged together in a group.",
247-
},
248-
"min_entries_to_merge_wait_minutes": {
249-
Type: schema.TypeInt,
250-
Computed: true,
251-
Description: "The time merge queue should wait after the first PR is added to the queue for the minimum group size to be met.",
252-
},
253-
},
254-
},
255-
},
256-
"required_deployments": {
257-
Type: schema.TypeList,
258-
Computed: true,
259-
Description: "Choose which environments must be successfully deployed to before branches can be merged into a branch that matches this rule.",
260-
Elem: &schema.Resource{
261-
Schema: map[string]*schema.Schema{
262-
"required_deployment_environments": {
263-
Type: schema.TypeList,
264-
Computed: true,
265-
Description: "The environments that must be successfully deployed to before branches can be merged.",
266-
Elem: &schema.Schema{
267-
Type: schema.TypeString,
268-
},
269-
},
270-
},
271-
},
272-
},
273212
"non_fast_forward": {
274213
Type: schema.TypeBool,
275214
Computed: true,

github/resource_github_enterprise_ruleset.go

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -231,72 +231,6 @@ func resourceGithubEnterpriseRuleset() *schema.Resource {
231231
Optional: true,
232232
Description: "Commits pushed to matching branches must have verified signatures.",
233233
},
234-
"merge_queue": {
235-
Type: schema.TypeList,
236-
Optional: true,
237-
MaxItems: 1,
238-
Description: "Merges must be performed via a merge queue.",
239-
Elem: &schema.Resource{
240-
Schema: map[string]*schema.Schema{
241-
"check_response_timeout_minutes": {
242-
Type: schema.TypeInt,
243-
Required: true,
244-
Description: "Maximum time for a required status check to report a conclusion. After this much time has elapsed, checks that have not reported a conclusion will be assumed to have failed.",
245-
},
246-
"grouping_strategy": {
247-
Type: schema.TypeString,
248-
Required: true,
249-
Description: "When set to ALLGREEN, the merge commit created by merge queue for each PR in the group must pass all required checks to merge. When set to HEADGREEN, only the commit at the head of the merge group, i.e. the commit containing changes from all of the PRs in the group, must pass its required checks to merge.",
250-
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"ALLGREEN", "HEADGREEN"}, false), "grouping_strategy"),
251-
},
252-
"max_entries_to_build": {
253-
Type: schema.TypeInt,
254-
Required: true,
255-
Description: "Limit the number of queued pull requests requesting checks and workflow runs at the same time.",
256-
},
257-
"max_entries_to_merge": {
258-
Type: schema.TypeInt,
259-
Required: true,
260-
Description: "The maximum number of PRs that will be merged together in a group.",
261-
},
262-
"merge_method": {
263-
Type: schema.TypeString,
264-
Required: true,
265-
Description: "Method to use when merging changes from queued pull requests. Can be one of `MERGE`, `SQUASH`, or `REBASE`.",
266-
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"MERGE", "SQUASH", "REBASE"}, false), "merge_method"),
267-
},
268-
"min_entries_to_merge": {
269-
Type: schema.TypeInt,
270-
Required: true,
271-
Description: "The minimum number of PRs that will be merged together in a group.",
272-
},
273-
"min_entries_to_merge_wait_minutes": {
274-
Type: schema.TypeInt,
275-
Required: true,
276-
Description: "The time merge queue should wait after the first PR is added to the queue for the minimum group size to be met. After this time has elapsed, the minimum group size will be ignored and a smaller group will be merged.",
277-
},
278-
},
279-
},
280-
},
281-
"required_deployments": {
282-
Type: schema.TypeList,
283-
Optional: true,
284-
MaxItems: 1,
285-
Description: "Choose which environments must be successfully deployed to before branches can be merged into a branch that matches this rule.",
286-
Elem: &schema.Resource{
287-
Schema: map[string]*schema.Schema{
288-
"required_deployment_environments": {
289-
Type: schema.TypeList,
290-
Required: true,
291-
MinItems: 1,
292-
Description: "The environments that must be successfully deployed to before branches can be merged.",
293-
Elem: &schema.Schema{
294-
Type: schema.TypeString,
295-
},
296-
},
297-
},
298-
},
299-
},
300234
"pull_request": {
301235
Type: schema.TypeList,
302236
MaxItems: 1,

github/resource_github_enterprise_ruleset_test.go

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -170,42 +170,10 @@ resource "github_enterprise_ruleset" "test" {
170170

171171
func TestAccGithubEnterpriseRuleset_required_workflows(t *testing.T) {
172172
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
173-
repoName := fmt.Sprintf("%srepo-enterprise-wf-%s", testResourcePrefix, randomID)
174173
rulesetName := fmt.Sprintf("%s-enterprise-wf-ruleset-%s", testResourcePrefix, randomID)
175174
workflowFilePath := ".github/workflows/echo.yaml"
176175

177176
config := fmt.Sprintf(`
178-
resource "github_repository" "test" {
179-
name = "%s"
180-
visibility = "private"
181-
auto_init = true
182-
}
183-
184-
resource "github_repository_file" "workflow_file" {
185-
repository = github_repository.test.name
186-
branch = "main"
187-
file = "%s"
188-
content = <<EOT
189-
name: Echo Workflow
190-
191-
on: [pull_request]
192-
193-
jobs:
194-
echo:
195-
runs-on: linux
196-
steps:
197-
- run: echo "Hello, world!"
198-
EOT
199-
commit_message = "Managed by Terraform"
200-
commit_author = "Terraform User"
201-
commit_email = "[email protected]"
202-
}
203-
204-
resource "github_actions_repository_access_level" "test" {
205-
repository = github_repository.test.name
206-
access_level = "organization"
207-
}
208-
209177
resource "github_enterprise_ruleset" "test" {
210178
enterprise_slug = "%s"
211179
name = "%s"
@@ -233,14 +201,14 @@ resource "github_enterprise_ruleset" "test" {
233201
required_workflows {
234202
do_not_enforce_on_create = true
235203
required_workflow {
236-
path = github_repository_file.workflow_file.file
237-
repository_id = github_repository.test.repo_id
204+
path = "%s"
205+
repository_id = 1234567
238206
ref = "main"
239207
}
240208
}
241209
}
242210
}
243-
`, repoName, workflowFilePath, testAccConf.enterpriseSlug, rulesetName)
211+
`, testAccConf.enterpriseSlug, rulesetName, workflowFilePath)
244212

245213
check := resource.ComposeTestCheckFunc(
246214
resource.TestCheckResourceAttr("github_enterprise_ruleset.test", "name", rulesetName),

0 commit comments

Comments
 (0)