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

fix(build): use NGX_WASM_MODULE_BRANCH environment variable #12241

Merged
merged 3 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"chore"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it would be a better option, but it is not one of the types available in the new changelog format.

Loading