Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -t/--target flags to the other subcommands #2878

Closed
tsandall opened this issue Nov 9, 2020 · 1 comment · Fixed by #3090
Closed

Add -t/--target flags to the other subcommands #2878

tsandall opened this issue Nov 9, 2020 · 1 comment · Fixed by #3090
Assignees

Comments

@tsandall
Copy link
Member

tsandall commented Nov 9, 2020

It would be nice to be able to exercise the new wasm runtime through subcommands like opa test and opa eval without having to opa build beforehand. I could imagine adding -t/--target flags to bench, eval, and test. For opa run, I could imagine either adding the same flag or allowing users to toggle the execution target in the REPL and via the HTTP API.

In terms of implementation, if we extend the rego package with an option to compile to wasm, the changes required in the subcommands would be minimal (i.e., they would just have to pipe the target flag down to the rego.New() call.)

Since we don't yet support linking between policy.wasm files, we would need to disallow -t when loading bundles containing wasm compiled policies.

@tsandall
Copy link
Member Author

We might need the logic from the compile package that is used by opa build to compile rego into wasm: https://github.com/open-policy-agent/opa/blob/master/compile/compile.go#L361

I don't think we can depend on the compile package inside the rego package because that would create a circular dependency.

@ashutosh-narkar ashutosh-narkar self-assigned this Jan 15, 2021
ashutosh-narkar added a commit to ashutosh-narkar/opa that referenced this issue Feb 4, 2021
This commit adds a target flag to the
bench, eval, test and run (repl) commands
which allows users to exercise the wasm
rumtime.

Fixes open-policy-agent#2878

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
ashutosh-narkar added a commit that referenced this issue Feb 5, 2021
This commit adds a target flag to the
bench, eval, test and run (repl) commands
which allows users to exercise the wasm
rumtime.

Fixes #2878

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants