Continue with compilation errors #417
Replies: 3 comments 2 replies
-
The reason I wonder if there's support for this is because I see there's a constant for error limit https://github.com/open-policy-agent/opa/blob/main/ast/compile.go#L22-L24 - I was hoping to use this to see if the number of errors is under a certain limit (e.g. the default, 10) then remove the error'ed out modules and continue with the rest of the evaluation phase. |
Beta Was this translation helpful? Give feedback.
-
One way to tackle this would be to just manually remove the policies that error'd out and retry the compilation. But I was wondering if something of such sorts already exists within the compiler itself. |
Beta Was this translation helpful? Give feedback.
-
This is not a feature supported by the OPA compiler today. |
Beta Was this translation helpful? Give feedback.
-
Does OPA support a way to "offload" or "unload" failed modules when a compilation process fails.
The idea is something along the lines:
compiler.Compile(policies)
wherecompiler.Failed()
, iftrue
, check if the number of errors is above theast.CompileErrorLimitDefault
limit.The use case for this is that today if we load a number of policies at once, even if one of them fails (user error, typo, etc.) the entire evaluation fails. The idea is to be able to run the good set of policies and maybe keep all the errors on a log to be processed later so that a single bad/busted policy doesn't fail the entire compilation/evaluation process.
I've seen the implementation/comments around the ast codebase here https://github.com/open-policy-agent/opa/blob/main/ast/compile.go#L36-L39 – and today it seems that if compilation fails, there are no guarantees on the state of the modules.
Beta Was this translation helpful? Give feedback.
All reactions