-
Notifications
You must be signed in to change notification settings - Fork 64
OSAC-2333: Enable merge queues on core repos #134
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
Open
omer-vishlitzky
wants to merge
4
commits into
osac-project:main
Choose a base branch
from
omer-vishlitzky:OSAC-2333-enable-merge-queues
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e23d96b
OSAC-2333: Enable merge queues on 5 core repos
omer-vishlitzky 3055467
Disable strict status checks on repos with merge queues
omer-vishlitzky 78429c5
Add merge_queue validations and regenerate module README
omer-vishlitzky daea683
Remove dead Prow required-checks, add merge-queue bypass for org-admi…
omer-vishlitzky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -98,13 +98,54 @@ resource "github_branch_protection" "repo_protection" { | |||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| required_status_checks { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| strict = true | ||||||||||||||||||||||||||||||||||||||||||||||||||
| strict = var.strict_status_checks | ||||||||||||||||||||||||||||||||||||||||||||||||||
| contexts = var.required_status_checks | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| depends_on = [github_repository.repo, github_repository_collaborators.repo_collaborators] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| data "github_team" "merge_queue_bypass" { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for_each = var.merge_queue != null ? toset(["wg-infra", "org-admins"]) : [] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| slug = each.value | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| resource "github_repository_ruleset" "merge_queue" { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| count = var.merge_queue != null ? 1 : 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| name = "merge-queue" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| repository = github_repository.repo.name | ||||||||||||||||||||||||||||||||||||||||||||||||||
| target = "branch" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| enforcement = "active" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| conditions { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ref_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| include = ["~DEFAULT_BRANCH"] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| exclude = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| dynamic "bypass_actors" { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for_each = data.github_team.merge_queue_bypass | ||||||||||||||||||||||||||||||||||||||||||||||||||
| content { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| actor_id = bypass_actors.value.id | ||||||||||||||||||||||||||||||||||||||||||||||||||
| actor_type = "Team" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| bypass_mode = "pull_request" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| rules { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| merge_queue { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| merge_method = var.merge_queue.merge_method | ||||||||||||||||||||||||||||||||||||||||||||||||||
| min_entries_to_merge = var.merge_queue.min_entries_to_merge | ||||||||||||||||||||||||||||||||||||||||||||||||||
| max_entries_to_merge = var.merge_queue.max_entries_to_merge | ||||||||||||||||||||||||||||||||||||||||||||||||||
| check_response_timeout_minutes = var.merge_queue.check_response_timeout_minutes | ||||||||||||||||||||||||||||||||||||||||||||||||||
| grouping_strategy = var.merge_queue.grouping_strategy | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+136
to
+144
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know that if var.merge_queue == null the count will be zero. But, will TF also skip trying to make these assignments?
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| depends_on = [github_repository.repo] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| resource "github_repository_environment" "env" { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for_each = { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for env in var.environments : | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Automatically disable strict status checks when a merge queue is configured.
GitHub does not allow requiring branches to be up to date before merging when a merge queue is active. To prevent API errors and reduce the configuration burden on module consumers, consider automatically enforcing
strict = falsewhenvar.merge_queueis provided.♻️ Proposed refactor
required_status_checks { - strict = var.strict_status_checks + strict = var.merge_queue != null ? false : var.strict_status_checks contexts = var.required_status_checks }📝 Committable suggestion
🤖 Prompt for AI Agents