-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
opa build -t wasm
doesn't generate bundle.tar.gz
#3270
Comments
You'll have to provide a capabilities json of the target version. Your cli executable doesn't have wasm enabled so it won't build what it cannot run. |
@srenatus Thank you so much for your advice! You saved my day. I downloaded the following file to the same directory. opa build -t wasm -e hello/hello hello.rego --capabilities v0.27.1.json Finally, I got bundle.tar.gz correctly. I appreciate that. I guess a description about necessity of capacilities json can be added in the following document. What do you think about it?
|
Yup there's definitely a documentation need here. Would you want to contribute a note there or would you prefer if I did that? 😃 |
Nevermind the docs, we'll fix this in code 😅 |
@srenatus Thank you for your comment! I am sorry for late response. If I have a chance, I would like to contribute. I am not familiar with document structure, but I found a likely document in the following document. Is this correct? If so, I will try PR in a few days. |
Thank you! As hinted on above, I'll put a PR out for changing the default behaviour here. (Next thing, tomorrow at the latest.) |
Oh, I see. Great! Default behavior change is much better. There will be no need to amend document. No need to hurry. Thank you for all! |
We now discern: 1. If there's no Wasm ABI version array at all in the capabilities of the `opa` binary used to build a Wasm bundle. 2. If the provided capabilities.json contains EMPTY Wasm ABI versions array. (1.) would happen if the binary itself has no support for running the Wasm module, i.e. it was built without the `opa_wasm` go tag. Anyways, such a binary is perfactly capable of emitting wasm code, so that's what we'll allow it to do (with this change). (2.) still gives you the option to disable building wasm bundles via capabilities.json, but it's an edge case: usually, you'd use it to control the ABI versions you're building for. If you want, however, you can still say "none" by providing an empty array. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
We now discern: 1. If there's no Wasm ABI version array at all in the capabilities of the `opa` binary used to build a Wasm bundle. 2. If the provided capabilities.json contains EMPTY Wasm ABI versions array. (1.) would happen if the binary itself has no support for running the Wasm module, i.e. it was built without the `opa_wasm` go tag. Anyways, such a binary is perfactly capable of emitting wasm code, so that's what we'll allow it to do (with this change). (2.) still gives you the option to disable building wasm bundles via capabilities.json, but it's an edge case: usually, you'd use it to control the ABI versions you're building for. If you want, however, you can still say "none" by providing an empty array. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
opa build
doesn't seem to be able to generatebundle.tar.gz
after 0.27.0. Before 0.26.0, it works well.Expected Behavior
Actual Behavior
Using v0.27.0 or later
bin/opa0.27.0 build -t wasm -e hello/hello hello.rego error: compiler ABI version not in capabilities (have [], want {1 1})
Using v0.26.0, this command works.
Steps to Reproduce the Problem
hello.rego
https://www.openpolicyagent.org/docs/latest/wasm/#compiling-policies
Environment
Thank you, all the community!!
Additional Info
I am not sure if this is related to #3264 or not..
The text was updated successfully, but these errors were encountered: