Skip to content

NO-ISSUE: migrate required status checks to GitHub rulesets#131

Merged
larsks merged 1 commit into
osac-project:mainfrom
rccrdpccl:ci/migrate-status-checks-to-rulesets
Jul 16, 2026
Merged

NO-ISSUE: migrate required status checks to GitHub rulesets#131
larsks merged 1 commit into
osac-project:mainfrom
rccrdpccl:ci/migrate-status-checks-to-rulesets

Conversation

@rccrdpccl

@rccrdpccl rccrdpccl commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Moves required_status_checks from github_branch_protection to a new github_repository_ruleset resource. Rulesets don't block PRs when a required check is skipped (e.g. via paths-ignore), unlike classic branch protection which leaves skipped checks stuck as "Expected."

This enables component repos to add paths-ignore filters so docs-only PRs (OWNERS, LICENSE, *.md, docs/**) can merge without waiting for irrelevant CI runs.

Changes

  • Remove required_status_checks block from github_branch_protection
  • Add github_repository_ruleset.status_checks (only created when required_status_checks is non-empty and branch_protection is enabled)
  • Ruleset targets all branches, enforcement active, org admins can bypass

Affected repos

Repo Required checks
fulfillment-service ci/prow/unit, e2e-vmaas-full-install / e2e
osac-operator ci/prow/temp, e2e-vmaas-full-install / e2e
osac-aap ci/prow/temp, e2e-vmaas-full-install / e2e
osac-installer e2e-vmaas-full-install / e2e
github-config pre-commit

Apply considerations

On first apply there will be a brief window where the old checks are removed from branch protection before the new ruleset is created. For zero-gap enforcement, consider a two-phase apply:

  1. tofu apply -target='module.repo_fulfillment_service.github_repository_ruleset.status_checks[0]' -target='module.repo_cloudkit_operator.github_repository_ruleset.status_checks[0]' ... (create rulesets first)
  2. tofu apply (full apply removes old branch protection checks)

Companion PRs

These PRs add paths-ignore to the CI workflows in each component repo:

Remaining repos (osac-aap, osac-installer, osac-test-infra) will follow.

Assisted-by: Claude Code noreply@anthropic.com

Summary by CodeRabbit

  • New Features
    • Added a repository ruleset to enforce required CI status checks.
    • The ruleset targets the default branch, supports bypass actors, and generates required check entries dynamically when enabled.
  • Bug Fixes
    • Improved branch protection setup ordering to ensure collaborator-related configuration is applied correctly.
    • Migrated away from legacy branch protection status-check configuration.

@rccrdpccl
rccrdpccl force-pushed the ci/migrate-status-checks-to-rulesets branch from ae4aff9 to bb1fdce Compare July 14, 2026 11:13
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 35023630-c85d-4ea2-baee-89b36463692d

📥 Commits

Reviewing files that changed from the base of the PR and between 7bb6360 and 98ca491.

📒 Files selected for processing (1)
  • modules/common_repository/main.tf

Walkthrough

The change removes legacy required status checks from branch protection, adds collaborator ordering, and introduces a conditional repository ruleset targeting the default branch with dynamically generated required checks.

Changes

Repository status checks

Layer / File(s) Summary
Update branch protection wiring
modules/common_repository/main.tf
Removes the legacy required_status_checks block and adds repository collaborators to the branch protection dependency chain.
Add status check ruleset
modules/common_repository/main.tf
Creates github_repository_ruleset.status_checks when applicable, targets ~DEFAULT_BRANCH, configures bypass actors, and generates required checks from var.required_status_checks.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: eliorerz

🚥 Pre-merge checks | ✅ 11
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: moving required status checks from branch protection to GitHub rulesets.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No-Hardcoded-Secrets ✅ Passed No hardcoded secrets, embedded creds, or literal API key/token/password assignments were found in the changed files.
No-Weak-Crypto ✅ Passed The changed Terraform only adjusts GitHub branch protection/ruleset resources; repo scans found no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB or crypto comparisons.
No-Injection-Vectors ✅ Passed Only Terraform resource changes; no SQL/shell/eval/pickle/yaml/os.system/dangerouslySetInnerHTML sinks or user-controlled execution paths were added.
Container-Privileges ✅ Passed PR only touches modules/common_repository/main.tf; no container/K8s manifests or privileged settings are present.
No-Sensitive-Data-In-Logs ✅ Passed The diff only moves branch-protection config to a ruleset; no logs, outputs, or secret/PII-bearing strings were added.
Ai-Attribution ✅ Passed PASS: HEAD commit includes an "Assisted-by: Claude Code" trailer, and I found no AI-related Co-Authored-By attribution.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rccrdpccl

Copy link
Copy Markdown
Contributor Author

should we add tf plan CI job to changes within this repo?

@rccrdpccl
rccrdpccl force-pushed the ci/migrate-status-checks-to-rulesets branch from bb1fdce to 7bb6360 Compare July 14, 2026 15:41
coderabbitai[bot]
coderabbitai Bot previously requested changes Jul 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@modules/common_repository/main.tf`:
- Line 103: Add a GitHub Actions pull-request workflow for the Terraform
configuration containing github_repository_ruleset.status_checks that runs
terraform fmt -check, terraform validate, and terraform plan. Configure the job
to initialize Terraform before validation and planning, and ensure the plan
executes from the correct Terraform working directory.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 3c060cee-e51a-43f0-8338-a91323922289

📥 Commits

Reviewing files that changed from the base of the PR and between bb1fdce and 7bb6360.

📒 Files selected for processing (1)
  • modules/common_repository/main.tf

depends_on = [github_repository.repo, github_repository_collaborators.repo_collaborators]
}

resource "github_repository_ruleset" "status_checks" {

@coderabbitai coderabbitai Bot Jul 14, 2026

Copy link
Copy Markdown

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

Add a Terraform plan CI workflow.

Regarding your question about adding a tf plan CI job: Yes, it is strongly recommended. Running terraform fmt -check, terraform validate, and terraform plan on pull requests validates configuration syntax and previews infrastructure changes, preventing unexpected enforcement gaps or errors upon merge.

Would you like me to generate a GitHub Actions workflow snippet or open a new issue to implement this?

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modules/common_repository/main.tf` at line 103, Add a GitHub Actions
pull-request workflow for the Terraform configuration containing
github_repository_ruleset.status_checks that runs terraform fmt -check,
terraform validate, and terraform plan. Configure the job to initialize
Terraform before validation and planning, and ensure the plan executes from the
correct Terraform working directory.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be a separate PR

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rccrdpccl, that makes sense—keeping infra changes and CI tooling changes separate is good practice. Would you like me to open a follow-up issue to track adding the tf plan/fmt/validate CI workflow?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason there is no tf plan pre-commit job is because that requires credentials to access state storage, so it wouldn't work for pull requests from forked repositories.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason there is no tf plan pre-commit job is because that requires credentials to access state storage, so it wouldn't work for pull requests from forked repositories.

There are ways to work around that: see environment protection, or pull_request_target, etc. if this is of interest I could craft a PR.

In any case, I do not think it should be done in this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example PR #132

@larsks
larsks dismissed coderabbitai[bot]’s stale review July 14, 2026 17:14

I don't see any actionable comments from coderabbit.

@larsks
larsks force-pushed the ci/migrate-status-checks-to-rulesets branch from 7bb6360 to fd23193 Compare July 14, 2026 17:14
…lesets

Move required_status_checks out of github_branch_protection and into a
github_repository_ruleset resource. Rulesets do not block PRs when a
required check is skipped (e.g. via paths-ignore in the workflow), unlike
classic branch protection which leaves skipped checks stuck as "Expected".

This enables component repos to add paths-ignore filters to their CI
workflows so that docs-only and metadata-only PRs (OWNERS, LICENSE, *.md)
can merge without waiting for irrelevant test runs.

The ruleset includes OrganizationAdmin bypass so admins can still merge
in emergencies without waiting for checks.

Affected repos: fulfillment-service, osac-operator, osac-aap,
osac-installer, github-config.

NOTE: On first apply, there will be a brief window where the old status
checks are removed from branch protection and the new ruleset is created.
Consider a two-phase apply (create ruleset first, then remove old checks)
to avoid a gap in enforcement.

Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Riccardo Piccoli <rpiccoli@redhat.com>
@larsks
larsks force-pushed the ci/migrate-status-checks-to-rulesets branch from fd23193 to 98ca491 Compare July 15, 2026 16:52
@larsks
larsks enabled auto-merge (rebase) July 15, 2026 17:22
@larsks
larsks merged commit 77eac09 into osac-project:main Jul 16, 2026
2 checks passed
larsks pushed a commit that referenced this pull request Jul 20, 2026
PR #131 migrated required status checks from branch protection to
rulesets but only granted bypass to OrganizationAdmin. This broke
manual merges for wg-infra members who previously could bypass via
enforce_admins=false on branch protection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants