mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
30a06544f2
* wasm: emit ABI version as global This takes inspiration from the proxy-spec (Envoy's Wasm support). There, it's recorded in an exported function's name. However, it's been included like that in the spec because it's the least common denominator among the different languages (potentially) used to implement proxy-spec. We've got a pretty good grip on our generated Wasm code, so we do what's noted in proxy-spec as "ideally, we'd do xyz instead". However, our ABI version is a simple integer, no semver. Ref: https://github.com/proxy-wasm/spec/tree/master/abi-versions/vNEXT#proxy_abi_version_x_y_z * ast.CapabilitiesForThisVersion: include WasmABIVersions Extending the ast.Capabilities like this is somewhat unsatisfying -- the Wasm ABI has little to do with the ast package. However, moving Capabilities outside of ast in a way that's not introducing import cycles and is backwards-compatible proved to be quite an effort; so let's go with "simple" here. * capatibilities.json: ensure it is generated with ABI versions The build tag `generate` is what `go generate` would set, too. We're losing that in the main.go -> gen-run-go.sh indirection, so we've got to set it ourselves. * ci: fix npm-opa-wasm e2e test The CI build uses a version of OPA built in a previous step -- with the Wasm SDK _disabled_. To still build Wasm modules, we thus fix the call to use the capabilities.json file from master, which corresponds to the capabilities of a build of OPA with Wasm SDK enabled. * docs/content/wasm.md: mention abi version, change headers There is only one `#` header in a markdown document, so this fixes that by adding a few `#`. I haven't added it everywhere below `# Compiling`, but I think the structure is OK now. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>