Skip to content

Commit

Permalink
chore(deps): pin ngx_wasm_module (#11323)
Browse files Browse the repository at this point in the history
* chore(build): support building ngx_wasm_module from tag

* style(build): adjust wasm runtime version declarations

* chore(deps): pin ngx_wasm_module

* docs(changelog): add wasm entry
  • Loading branch information
flrgh committed Jul 31, 2023
1 parent 3e9f64e commit 9fe0e40
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .requirements
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LUA_RESTY_WEBSOCKET=60eafc3d7153bceb16e6327074e0afc3d94b1316 # 0.4.0
ATC_ROUTER=b0d5e7e2a2ca59bb051959385d3e42d96c93bb98 # 1.2.0

KONG_MANAGER=v3.4.0.0
NGX_WASM_MODULE_BRANCH=main
WASMER_VERSION=3.1.1
WASMTIME_VERSION=8.0.1
V8_VERSION=10.5.18
NGX_WASM_MODULE=prerelease-0.1.0
WASMER=3.1.1
WASMTIME=8.0.1
V8=10.5.18
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
[#11071](https://github.com/Kong/kong/pull/11071)
- Make upstream `host_header` and router `preserve_host` config work in stream tls proxy.
[#11244](https://github.com/Kong/kong/pull/11244)
- Add beta support for WebAssembly/proxy-wasm
[#11218](https://github.com/Kong/kong/pull/11218)

#### Admin API

Expand Down
23 changes: 23 additions & 0 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,29 @@ bazel build //:kong_el8 --action_env=RPM_SIGNING_KEY_FILE --action_env=NFPM_RPM_
- `RPM_SIGNING_KEY_FILE`: the path to the GPG private key file.
- `NFPM_RPM_PASSPHRASE`: the passphrase of the GPG private key.

#### ngx_wasm_module options

Building of [ngx_wasm_module](https://github.com/Kong/ngx_wasm_module) can be
controlled with a few CLI flags:

* `--//:wasmx=(true|false)` (default: `true`) - enable/disable wasmx
* `--//:wasmx_module_flag=(dynamic|static)` (default: `dynamic`) - switch
between static or dynamic nginx module build configuration
* `--//:wasm_runtime=(wasmtime|wasmer|v8)` (default: `wasmtime`) select the wasm
runtime to build

Additionally, there are a couple environment variables that can be set at build
time to control how the ngx_wasm_module repository is sourced:

* `NGX_WASM_MODULE_REMOTE` (default: `https://github.com/Kong/ngx_wasm_module.git`) -
this can be set to a local filesystem path to avoid pulling the repo from github
* `NGX_WASM_MODULE_BRANCH` (default: none) - Setting this environment variable
tells bazel to build from a branch rather than using the tag found in our
`.requirements` file

**NOTE:** these environment variables currently do not integrate very well with
bazel's cache mechanism, so you may need to clear cache after changing their value.
## Cross compiling
Cross compiling is currently only tested on Ubuntu 22.04 x86_64 with following targeting platforms:
Expand Down
4 changes: 4 additions & 0 deletions build/kong_bindings.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ def _load_vars(ctx):
if ngx_wasm_module_remote:
content += '"NGX_WASM_MODULE_REMOTE": "%s",' % ngx_wasm_module_remote

ngx_wasm_module_branch = ctx.os.environ.get("NGX_WASM_MODULE_BRANCH")
if ngx_wasm_module_branch:
content += '"NGX_WASM_MODULE_BRANCH": "%s",' % ngx_wasm_module_branch

# wasm runtime options
if ctx.os.name == "mac os x":
content += '"V8_OS": "darwin",'
Expand Down
13 changes: 9 additions & 4 deletions build/openresty/wasmx/wasmx_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,23 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@kong_bindings//:variables.bzl", "KONG_VAR")

def wasmx_repositories():
ngx_wasm_module_branch = KONG_VAR["NGX_WASM_MODULE_BRANCH"]
wasmtime_version = KONG_VAR["WASMTIME_VERSION"]
wasmer_version = KONG_VAR["WASMER_VERSION"]
v8_version = KONG_VAR["V8_VERSION"]
wasmtime_version = KONG_VAR["WASMTIME"]
wasmer_version = KONG_VAR["WASMER"]
v8_version = KONG_VAR["V8"]
wasmtime_os = KONG_VAR["WASMTIME_OS"]
wasmer_os = KONG_VAR["WASMER_OS"]
v8_os = KONG_VAR["V8_OS"]

ngx_wasm_module_tag = KONG_VAR["NGX_WASM_MODULE"]
ngx_wasm_module_branch = KONG_VAR.get("NGX_WASM_MODULE_BRANCH")
if ngx_wasm_module_branch:
ngx_wasm_module_tag = None

maybe(
new_git_repository,
name = "ngx_wasm_module",
branch = ngx_wasm_module_branch,
tag = ngx_wasm_module_tag,
remote = KONG_VAR.get("NGX_WASM_MODULE_REMOTE", "https://github.com/Kong/ngx_wasm_module.git"),
build_file_content = """
filegroup(
Expand Down

0 comments on commit 9fe0e40

Please sign in to comment.