Skip to content

Commit

Permalink
fix(build): use NGX_WASM_MODULE_BRANCH environment variable (#12241)
Browse files Browse the repository at this point in the history
* fix(build): use NGX_WASM_MODULE_BRANCH env var

* chore(changelog): update changelog

* fix(build): force invalidation of wasm related env vars
  • Loading branch information
locao authored Jan 23, 2024
1 parent 36c3836 commit d2cf328
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
3 changes: 0 additions & 3 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ time to control how the ngx_wasm_module repository is sourced:
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 @@ -64,6 +64,9 @@ def _load_vars(ctx):
ngx_wasm_module_remote = ctx.os.environ.get("NGX_WASM_MODULE_REMOTE", "https://github.com/Kong/ngx_wasm_module.git")
content += '"NGX_WASM_MODULE_REMOTE": "%s",' % ngx_wasm_module_remote

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

ctx.file("BUILD.bazel", "")
ctx.file("variables.bzl", "KONG_VAR = {\n" + content + "\n}")

Expand Down Expand Up @@ -107,6 +110,7 @@ load_bindings = repository_rule(
"INSTALL_DESTDIR",
"RPM_SIGNING_KEY_FILE",
"NFPM_RPM_PASSPHRASE",
"NGX_WASM_MODULE_BRANCH",
"NGX_WASM_MODULE_REMOTE",
],
)
6 changes: 5 additions & 1 deletion build/openresty/wasmx/wasmx_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ wasm_runtimes = {
}

def wasmx_repositories():
wasm_module_branch = KONG_VAR["NGX_WASM_MODULE_BRANCH"]
if wasm_module_branch == "":
wasm_module_branch = KONG_VAR["NGX_WASM_MODULE"]

new_git_repository(
name = "ngx_wasm_module",
branch = KONG_VAR["NGX_WASM_MODULE"],
branch = wasm_module_branch,
remote = KONG_VAR["NGX_WASM_MODULE_REMOTE"],
build_file_content = """
filegroup(
Expand Down
3 changes: 3 additions & 0 deletions changelog/unreleased/kong/fix-wasm-module-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: use NGX_WASM_MODULE_BRANCH environment variable to set ngx_wasm_module repository branch when building Kong.
type: bugfix
scope: Core

0 comments on commit d2cf328

Please sign in to comment.