Skip to content

rego: Upgrade to OPA v1 - #2815

Merged
Maksim An (anmaxvl) merged 7 commits into
microsoft:mainfrom
micromaomao:tingmao_github/opa
Aug 11, 2026
Merged

rego: Upgrade to OPA v1#2815
Maksim An (anmaxvl) merged 7 commits into
microsoft:mainfrom
micromaomao:tingmao_github/opa

Conversation

@micromaomao

@micromaomao Tingmao Wang (micromaomao) commented Jul 10, 2026

Copy link
Copy Markdown
Member
  • Change imports to use v1
  • Fix framework.rego
  • Fix tests

Depends-on: Takuro's PR

@jterry75

Copy link
Copy Markdown
Contributor

Tingmao Wang (@micromaomao) - I didn't realize you were working on this. Could we first merge my change and then we can take your updates to move to v1?

@helsaawy

Copy link
Copy Markdown
Contributor

i think you also need to update internal\regopolicyinterpreter\(test|module).rego to get tests passing

@anmaxvl

Copy link
Copy Markdown
Contributor

note that this PR seems to also have commits from #2763, which presumably should be merged first, and this PR needs rebasing afterwards.

@micromaomao

Copy link
Copy Markdown
Member Author

note that this PR seems to also have commits from #2763, which presumably should be merged first, and this PR needs rebasing afterwards.

yes, that's deliberate, since I can't make stacked PRs. The lack of Sign-oif-by should prevent this from being accidentally merged

@anmaxvl
Maksim An (anmaxvl) force-pushed the tingmao_github/opa branch 2 times, most recently from 7f55a7a to b80cdb6 Compare August 11, 2026 12:12
Revert some "rego.SetRegoVersion(ast.RegoV0)"

Signed-off-by: Maksim An <maksiman@microsoft.com>
Replacing
(^\w+(\(.+\)|\[(\w+|".+")\])?( := (\w+?|\{(.|\n)+?\}|\w+\[\w+\]))?) \{
with
$1 if {

Signed-off-by: Maksim An <maksiman@microsoft.com>
Signed-off-by: Maksim An <maksiman@microsoft.com>
Signed-off-by: Tingmao Wang <tingmaowang@microsoft.com>
…working in Rego v1, don't do it

Signed-off-by: Tingmao Wang <tingmaowang@microsoft.com>
…ntains "..."'

perl -pi -e 's/^errors\[(.+)\] if \{$/errors contains $1 if {/' pkg/securitypolicy/framework.rego

See: https://www.openpolicyagent.org/docs/v0-upgrade#enforce-use-of-if-and-contains-keywords-in-rule-head-declarations

Assisted-by: GitHub-Copilot copilot-review
Signed-off-by: Tingmao Wang <tingmaowang@microsoft.com>
Signed-off-by: Maksim An <maksiman@microsoft.com>

@anmaxvl Maksim An (anmaxvl) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm.

@anmaxvl
Maksim An (anmaxvl) merged commit 21c9356 into microsoft:main Aug 11, 2026
20 checks passed
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.

4 participants