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(*): expose Bazel INSTALL_DESTDIR to Lua code and fix admin_gui in dev [KM-117] #12774

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion build/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ kong_directory_genrule(
fi
done
LN ${BUILD_DESTDIR}/openresty/nginx/sbin/nginx ${BUILD_DESTDIR}/openresty/bin/openresty
""",
""" + """
# Make INSTALL_DESTDIR available to Kong Lua code
echo 'return "%s/kong"' > ${BUILD_DESTDIR}/share/lua/5.1/kong/kong_usr_path.lua
""" % KONG_VAR["INSTALL_DESTDIR"],
# XXX: bazel forces 0555 as artifact permission, which is not correct for packagin
# here we deliberately use a different directory so file permission is preserved
# see also https://github.com/bazelbuild/bazel/issues/5588
Expand Down
6 changes: 5 additions & 1 deletion kong/cmd/utils/prefix_handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,11 @@ local function prepare_prefix(kong_config, nginx_custom_template_path, skip_writ
end

if kong_config.admin_gui_listeners then
prepare_prefixed_interface_dir("/usr/local/kong", "gui", kong_config)
-- kong.kong_usr_path is an AUTO GENERATED Lua module generated by BUILD.bazel
-- It's only used for locating the GUI directory under Kong's USR path
-- The module itself DOES NOT exist under <PROJECT_ROOT>/kong
local kong_usr_path_ok, kong_usr_path = pcall(require, "kong.kong_usr_path")
prepare_prefixed_interface_dir(kong_usr_path_ok and kong_usr_path or "/usr/local/kong", "gui", kong_config)
end

if secrets then
Expand Down
Loading