You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Users integrating OPA into pipelines or other automation systems use the opa eval subcommand to execute policies. In these situations, it may be useful if the opa eval subcommand exited with a non-zero code to indicate an undefined result or runtime error. E.g., the subcommand could exit with:
The changes to add support for this can be added to cmd/eval.go. If len(result.Result) == 0 at the end of the eval function, then the result is undefined. The eval function can modified to check for this case and return an error accordingly.
The text was updated successfully, but these errors were encountered:
Adds support for non-zero exit code when providing the --fail flag to
the eval command. 0 means no error, 1 means undefined result and 2 means
an error.
Fixesopen-policy-agent#981
Signed-off-by: Kim Christensen <kimworking@gmail.com>
* Add support for non-zero exit code
Adds support for non-zero exit code when providing the --fail flag to
the eval command. 0 means no error, 1 means undefined result and 2 means
an error.
Fixes#981
Signed-off-by: Kim Christensen <kimworking@gmail.com>
Users integrating OPA into pipelines or other automation systems use the
opa eval
subcommand to execute policies. In these situations, it may be useful if theopa eval
subcommand exited with a non-zero code to indicate an undefined result or runtime error. E.g., the subcommand could exit with:Example interaction:
The flag name
--fail
is copied from curl.The changes to add support for this can be added to cmd/eval.go. If
len(result.Result) == 0
at the end of theeval
function, then the result is undefined. Theeval
function can modified to check for this case and return an error accordingly.The text was updated successfully, but these errors were encountered: