ci: test and type-check Rego policy on PRs#107
Merged
Conversation
tools/policy/ contains the Rego that drives this workflow's own change filter, but nothing tested it. Add a rego-policy job that runs 'opa check --strict' and 'opa test' so a parse/type error or broken rule can't silently break CI gating. Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
# Conflicts: # .github/workflows/pull-request.yml
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Adds a
rego-policyjob to the PR check that type-checks and tests the Rego undertools/policy/, wired into thepr-check-summarygate:opa check --strict tools/policy/— catches parse/type errors.opa test tools/policy/ -v— runs the existingpr_check_test.regosuite (9 tests).Why
tools/policy/pr-check/pr_check.regois the policy that drives this workflow's own change filter (deciding which module test jobs run). It had a test file but nothing in CI executed it, so a broken rule or a syntax/type error there could silently break CI gating and merge unnoticed.Notes
tools/policy/only. The other.regofiles in the repo are Java test fixtures/examples and are intentionally left out of these checks.setup-opaaction already used elsewhere in this workflow (same hash pin).opa fmtwas intentionally not added as a gate: formatting rules drift across OPA releases and the workflow pullsversion: latest, which would make a fmt check flaky.check+testare deterministic.opa test9/9 pass,opa check --strictclean.