From 7b5340ce094d08981b8170f20a1474d7634d75f2 Mon Sep 17 00:00:00 2001 From: JimMoen Date: Mon, 14 Nov 2022 17:55:17 +0800 Subject: [PATCH 1/3] fix(api): uppercase api request method --- apps/emqx_management/src/emqx_mgmt_http.erl | 5 ++++- lib-ce/emqx_dashboard/src/emqx_dashboard.erl | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/emqx_management/src/emqx_mgmt_http.erl b/apps/emqx_management/src/emqx_mgmt_http.erl index 57c54ed3f..99263fbfd 100644 --- a/apps/emqx_management/src/emqx_mgmt_http.erl +++ b/apps/emqx_management/src/emqx_mgmt_http.erl @@ -124,7 +124,10 @@ handle_request(_Method, _Path, Req) -> cowboy_req:reply(400, #{<<"content-type">> => <<"text/plain">>}, <<"Not found.">>, Req). authorize_appid(Req) -> - authorize_appid(cowboy_req:method(Req), cowboy_req:path(Req), Req). + authorize_appid( + iolist_to_binary(string:uppercase(cowboy_req:method(Req))), + iolist_to_binary(cowboy_req:path(Req)), + Req). authorize_appid(<<"GET">>, <<"/api/v4/emqx_prometheus">>, _Req) -> true; diff --git a/lib-ce/emqx_dashboard/src/emqx_dashboard.erl b/lib-ce/emqx_dashboard/src/emqx_dashboard.erl index 3ad0694c4..fa3f0e7df 100644 --- a/lib-ce/emqx_dashboard/src/emqx_dashboard.erl +++ b/lib-ce/emqx_dashboard/src/emqx_dashboard.erl @@ -107,7 +107,10 @@ http_handlers() -> %%-------------------------------------------------------------------- is_authorized(Req) -> - is_authorized(cowboy_req:method(Req), cowboy_req:path(Req), Req). + is_authorized( + iolist_to_binary(string:uppercase(cowboy_req:method(Req))), + iolist_to_binary(cowboy_req:path(Req)), + Req). is_authorized(<<"GET">>, <<"/api/v4/emqx_prometheus">>, _Req) -> true; From 949916fc1c1f5b413bcfaf718ef45f9ccf943c12 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Mon, 14 Nov 2022 19:51:52 +0100 Subject: [PATCH 2/3] ci: use self-hosted for all Erlang tests prepare, proper, eunit, ct and cover --- .github/workflows/run_test_cases.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run_test_cases.yaml b/.github/workflows/run_test_cases.yaml index 04045ac42..b68742b29 100644 --- a/.github/workflows/run_test_cases.yaml +++ b/.github/workflows/run_test_cases.yaml @@ -11,7 +11,7 @@ on: jobs: prepare: - runs-on: ubuntu-20.04 + runs-on: aws-amd64 container: emqx/build-env:erl23.3.4.9-3-ubuntu20.04 outputs: fast_ct_apps: ${{ steps.run_find_apps.outputs.fast_ct_apps }} @@ -40,6 +40,7 @@ jobs: - name: get_all_deps working-directory: source run: | + git config --global --add safe.directory $(pwd) # build the default profile for two purposes # 1. download all dependencies (so the individual app runs do not depend on github credentials) # 2. some of the files such as segmented config files are not created when compiling only the test profile @@ -55,7 +56,7 @@ jobs: eunit_and_proper: needs: prepare - runs-on: ubuntu-20.04 + runs-on: aws-amd64 container: emqx/build-env:erl23.3.4.9-3-ubuntu20.04 strategy: fail-fast: false @@ -83,7 +84,7 @@ jobs: fast_ct: needs: prepare - runs-on: ubuntu-20.04 + runs-on: ${{ matrix.runs-on }} container: emqx/build-env:erl23.3.4.9-3-ubuntu20.04 strategy: fail-fast: false @@ -246,7 +247,7 @@ jobs: - eunit_and_proper - fast_ct - docker_ct - runs-on: ubuntu-20.04 + runs-on: aws-amd64 container: emqx/build-env:erl23.3.4.9-3-ubuntu20.04 steps: - uses: AutoModality/action-clean@v1 @@ -276,7 +277,7 @@ jobs: finish: needs: make_cover - runs-on: ubuntu-20.04 + runs-on: aws-amd64 steps: - name: Coveralls Finished env: From 2b22ff0710c1fbbc4f17af839676d3fff885ca57 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Mon, 14 Nov 2022 20:11:50 +0100 Subject: [PATCH 3/3] ci: ensure github action workspace is clear --- .github/workflows/run_test_cases.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run_test_cases.yaml b/.github/workflows/run_test_cases.yaml index b68742b29..ea30902bc 100644 --- a/.github/workflows/run_test_cases.yaml +++ b/.github/workflows/run_test_cases.yaml @@ -17,6 +17,7 @@ jobs: fast_ct_apps: ${{ steps.run_find_apps.outputs.fast_ct_apps }} docker_ct_apps: ${{ steps.run_find_apps.outputs.docker_ct_apps }} steps: + - uses: AutoModality/action-clean@v1 - uses: actions/checkout@v3 with: path: source