From 5dd343f5588a3052d2ba34e129556448af068232 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Thu, 17 Nov 2022 21:47:11 +0100 Subject: [PATCH 1/4] ci: release only the default packages --- .github/workflows/build_packages.yaml | 8 +------ pkg-vsn.sh | 31 +++++---------------------- 2 files changed, 6 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build_packages.yaml b/.github/workflows/build_packages.yaml index 94eb64caa..b738ab999 100644 --- a/.github/workflows/build_packages.yaml +++ b/.github/workflows/build_packages.yaml @@ -320,15 +320,9 @@ jobs: run: sudo apt-get update && sudo apt install -y dos2unix - name: get packages run: | - DEFAULT_BEAM_PLATFORM='otp24.3.4.2-1' set -e -u cd packages/${{ matrix.profile }} - # Make a copy of the default OTP version package to a file without OTP version infix - while read -r fname; do - default_fname=$(echo "$fname" | sed "s/-${DEFAULT_BEAM_PLATFORM}//g") - echo "$fname -> $default_fname" - cp "$fname" "$default_fname" - done < <(find . -maxdepth 1 -type f | grep -E "emqx(-enterprise)?-5\.[0-9]+\.[0-9]+.*-${DEFAULT_BEAM_PLATFORM}" | grep -v elixir) + # fix the .sha256 file format for var in $(ls | grep emqx | grep -v sha256); do dos2unix $var.sha256 echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1 diff --git a/pkg-vsn.sh b/pkg-vsn.sh index 281160de8..51020b592 100755 --- a/pkg-vsn.sh +++ b/pkg-vsn.sh @@ -11,11 +11,10 @@ help() { echo "$0 PROFILE [options]" echo echo "-h|--help: To display this usage information" - echo "--default: Print default vsn number. e.g. e.g. 5.0.0-ubuntu20.04-amd64" - echo "--long: Print long vsn number. e.g. 5.0.0-otp24.2.1-1-ubuntu20.04-amd64" + echo "--long: Print long vsn number. e.g. 5.0.0-ubuntu20.04-amd64" echo " Otherwise short e.g. 5.0.0" echo "--elixir: Include elixir version in the long version string" - echo " e.g. 5.0.0-elixir1.13.4-otp24.2.1-1-ubuntu20.04-amd64" + echo " e.g. 5.0.0-elixir-ubuntu20.04-amd64" echo "--vsn_matcher: For --long option, replace the EMQX version with '*'" echo " so it can be used in find commands" } @@ -34,10 +33,6 @@ while [ "$#" -gt 0 ]; do help exit 0 ;; - --default) - IS_DEFAULT_RELEASE='yes' - shift 1 - ;; --long) LONG_VERSION='yes' shift 1 @@ -123,19 +118,8 @@ if [ "${IS_MATCHER:-}" = 'yes' ]; then PKG_VSN='*' fi -OTP_VSN="${OTP_VSN:-$(./scripts/get-otp-vsn.sh)}" SYSTEM="$(./scripts/get-distro.sh)" -case "$SYSTEM" in - windows*) - # directly build the default package for windows - IS_DEFAULT_RELEASE='yes' - ;; - *) - true - ;; -esac - UNAME_M="$(uname -m)" case "$UNAME_M" in x86_64) @@ -149,15 +133,10 @@ case "$UNAME_M" in ;; esac -if [ "${IS_DEFAULT_RELEASE:-not-default-release}" = 'yes' ]; then - # when it's the default release, we do not add elixir or otp version - infix='' +if [ "${IS_ELIXIR:-}" = "yes" ]; then + infix='-elixir' else - infix="-otp${OTP_VSN}" - if [ "${IS_ELIXIR:-}" = "yes" ]; then - ELIXIR_VSN="${ELIXIR_VSN:-$(./scripts/get-elixir-vsn.sh)}" - infix="-elixir${ELIXIR_VSN}${infix}" - fi + infix='' fi echo "${PKG_VSN}${infix}-${SYSTEM}-${ARCH}" From 2e72256690d5f4aa9fa6a863c98c5bb49d3854f6 Mon Sep 17 00:00:00 2001 From: firest Date: Fri, 18 Nov 2022 11:52:18 +0800 Subject: [PATCH 2/4] chore: update changes --- changes/v5.0.11-en.md | 2 ++ changes/v5.0.11-zh.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/changes/v5.0.11-en.md b/changes/v5.0.11-en.md index 15188d97e..3178e4ee0 100644 --- a/changes/v5.0.11-en.md +++ b/changes/v5.0.11-en.md @@ -15,6 +15,8 @@ automatically if needed. Use `PUT /gateways/{name}/enable/{true|false}` to enable or disable gateway. No more `DELETE /gateways/{name}`. +- Improve node name generation rules to avoid potential atom table overflow risk [#9387](https://github.com/emqx/emqx/pull/9387). + ## Bug fixes - Return 404 for status of unknown authenticator in `/authenticator/{id}/status` [#9328](https://github.com/emqx/emqx/pull/9328). diff --git a/changes/v5.0.11-zh.md b/changes/v5.0.11-zh.md index 4c74a7081..10fc7cd1d 100644 --- a/changes/v5.0.11-zh.md +++ b/changes/v5.0.11-zh.md @@ -13,6 +13,8 @@ - 重新设计了 /gateways API [9364](https://github.com/emqx/emqx/pull/9364)。 使用 PUT /gateways/{name} 代替了 POST /gateways,现在网关将在需要时自动加载,然后删除了 DELETE /gateways/{name},之后可以使用 PUT /gateways/{name}/enable/{true|false} 来开启或禁用网关。 +- 改进了节点名称生成规则,以避免潜在的原子表溢出风险 [#9387](https://github.com/emqx/emqx/pull/9387)。 + ## 修复 - 通过 `/authenticator/{id}/status` 请求未知认证器的状态时,将会返回 404。 From 65820eb943a04b3e63edc7817d746f10a89c2087 Mon Sep 17 00:00:00 2001 From: Zhongwen Deng Date: Fri, 18 Nov 2022 15:07:23 +0800 Subject: [PATCH 3/4] fix: can't get default raw config --- apps/emqx_management/src/emqx_mgmt_api_configs.erl | 4 ++-- .../test/emqx_mgmt_api_configs_SUITE.erl | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/emqx_management/src/emqx_mgmt_api_configs.erl b/apps/emqx_management/src/emqx_mgmt_api_configs.erl index db582c612..648ab9568 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_configs.erl +++ b/apps/emqx_management/src/emqx_mgmt_api_configs.erl @@ -268,7 +268,7 @@ config(put, #{body := Body}, Req) -> global_zone_configs(get, _Params, _Req) -> Paths = global_zone_roots(), Zones = lists:foldl( - fun(Path, Acc) -> Acc#{Path => get_config_with_default([Path])} end, + fun(Path, Acc) -> maps:merge(Acc, get_config_with_default(Path)) end, #{}, Paths ), @@ -343,7 +343,7 @@ get_full_config() -> ). get_config_with_default(Path) -> - emqx_config:fill_defaults(emqx:get_raw_config(Path)). + emqx_config:fill_defaults(#{Path => emqx:get_raw_config([Path])}). conf_path_from_querystr(Req) -> case proplists:get_value(<<"conf_path">>, cowboy_req:parse_qs(Req)) of diff --git a/apps/emqx_management/test/emqx_mgmt_api_configs_SUITE.erl b/apps/emqx_management/test/emqx_mgmt_api_configs_SUITE.erl index 83f68c5fe..adea70af6 100644 --- a/apps/emqx_management/test/emqx_mgmt_api_configs_SUITE.erl +++ b/apps/emqx_management/test/emqx_mgmt_api_configs_SUITE.erl @@ -133,6 +133,18 @@ t_global_zone(_Config) -> BadZones = emqx_map_lib:deep_put([<<"mqtt">>, <<"max_qos_allowed">>], Zones, 3), ?assertMatch({error, {"HTTP/1.1", 400, _}}, update_global_zone(BadZones)), + + %% Remove max_qos_allowed from raw config, but we still get default value(2). + Mqtt0 = emqx_conf:get_raw([<<"mqtt">>]), + ?assertEqual(1, emqx_map_lib:deep_get([<<"max_qos_allowed">>], Mqtt0)), + Mqtt1 = maps:remove(<<"max_qos_allowed">>, Mqtt0), + ok = emqx_config:put_raw([<<"mqtt">>], Mqtt1), + Mqtt2 = emqx_conf:get_raw([<<"mqtt">>]), + ?assertNot(maps:is_key(<<"max_qos_allowed">>, Mqtt2), Mqtt2), + {ok, #{<<"mqtt">> := Mqtt3}} = get_global_zone(), + %% the default value is 2 + ?assertEqual(2, emqx_map_lib:deep_get([<<"max_qos_allowed">>], Mqtt3)), + ok = emqx_config:put_raw([<<"mqtt">>], Mqtt0), ok. get_global_zone() -> From b2db34708e07e9b57677aaa831720a397b56b9f6 Mon Sep 17 00:00:00 2001 From: Zhongwen Deng Date: Fri, 18 Nov 2022 15:24:10 +0800 Subject: [PATCH 4/4] chore: add changelog for fix global_zone api --- changes/v5.0.11-en.md | 2 ++ changes/v5.0.11-zh.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/changes/v5.0.11-en.md b/changes/v5.0.11-en.md index 15188d97e..6ce0091f8 100644 --- a/changes/v5.0.11-en.md +++ b/changes/v5.0.11-en.md @@ -20,3 +20,5 @@ - Return 404 for status of unknown authenticator in `/authenticator/{id}/status` [#9328](https://github.com/emqx/emqx/pull/9328). - Fix that JWT ACL rules are only applied if an `exp` claim is set [#9368](https://github.com/emqx/emqx/pull/9368). + +- Fix that `/configs/global_zone` API cannot get the default value of the configuration [#9392](https://github.com/emqx/emqx/pull/9392). diff --git a/changes/v5.0.11-zh.md b/changes/v5.0.11-zh.md index 4c74a7081..8072179e3 100644 --- a/changes/v5.0.11-zh.md +++ b/changes/v5.0.11-zh.md @@ -18,3 +18,5 @@ - 通过 `/authenticator/{id}/status` 请求未知认证器的状态时,将会返回 404。 - 修复 JWT ACL 规则只在设置了超期时间时才生效的问题 [#9368](https://github.com/emqx/emqx/pull/9368)。 + +- 修复 `/configs/global_zone` API 无法正确获取配置的默认值问题 [#9392](https://github.com/emqx/emqx/pull/9392)。