Skip to content

Commit

Permalink
sysnc 4.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
lsxredrain committed Aug 16, 2021
1 parent c7a3dfb commit 589951c
Show file tree
Hide file tree
Showing 143 changed files with 4,866 additions and 1,255 deletions.
8 changes: 5 additions & 3 deletions .ci/build_packages/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
ARG BUILD_FROM=emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04
FROM ${BUILD_FROM}

ARG EMQX_NAME=dgiot
ARG EMQX_NAME=emqx

COPY . /dgiot
COPY . /emqx

WORKDIR /dgiot
WORKDIR /emqx

RUN rm -rf _build/${EMQX_NAME}/lib _build/${EMQX_NAME}-pkg/lib

RUN make ${EMQX_NAME}-zip || cat rebar3.crashdump

Expand Down
62 changes: 38 additions & 24 deletions .ci/build_packages/tests.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
#!/bin/bash
set -x -e -u
export CODE_PATH=${CODE_PATH:-"/dgiot"}
export EMQX_NAME=${EMQX_NAME:-"dgiot"}
export CODE_PATH=${CODE_PATH:-"/emqx"}
export EMQX_NAME=${EMQX_NAME:-"emqx"}
export PACKAGE_PATH="${CODE_PATH}/_packages/${EMQX_NAME}"
export RELUP_PACKAGE_PATH="${CODE_PATH}/relup_packages/${EMQX_NAME}"
export RELUP_PACKAGE_PATH="${CODE_PATH}/_upgrade_base"
# export EMQX_NODE_NAME="emqx-on-$(uname -m)@127.0.0.1"
# export EMQX_NODE_COOKIE=$(date +%s%N)

case "$(uname -m)" in
x86_64)
ARCH='amd64'
;;
aarch64)
ARCH='arm64'
;;
arm*)
ARCH=arm
;;
esac
export ARCH

emqx_prepare(){
mkdir -p "${PACKAGE_PATH}"

if [ ! -d "/paho-mqtt-testing" ]; then
git clone -b develop-4.0 https://github.com.cnpmjs.org/emqx/paho.mqtt.testing.git /paho-mqtt-testing
git clone -b develop-4.0 https://github.com/emqx/paho.mqtt.testing.git /paho-mqtt-testing
fi
pip3 install pytest
}
Expand All @@ -31,7 +44,7 @@ emqx_test(){
echo "running ${packagename} start"
"${PACKAGE_PATH}"/emqx/bin/emqx start || ( tail "${PACKAGE_PATH}"/emqx/log/emqx.log.1 && exit 1 )
IDLE_TIME=0
while [ -z "$("${PACKAGE_PATH}"/emqx/bin/emqx_ctl status |grep 'is running'|awk '{print $1}')" ]
while ! "${PACKAGE_PATH}"/emqx/bin/emqx_ctl status | grep -qE 'Node\s.*@.*\sis\sstarted'
do
if [ $IDLE_TIME -gt 10 ]
then
Expand Down Expand Up @@ -103,7 +116,7 @@ running_test(){

emqx start || ( tail /var/log/emqx/emqx.log.1 && exit 1 )
IDLE_TIME=0
while [ -z "$(emqx_ctl status |grep 'is running'|awk '{print $1}')" ]
while ! emqx_ctl status | grep -qE 'Node\s.*@.*\sis\sstarted'
do
if [ $IDLE_TIME -gt 10 ]
then
Expand All @@ -121,7 +134,7 @@ running_test(){
|| [ "$(sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g' | sed 's/"//g')" = debian ] ;then
service emqx start || ( tail /var/log/emqx/emqx.log.1 && exit 1 )
IDLE_TIME=0
while [ -z "$(emqx_ctl status |grep 'is running'|awk '{print $1}')" ]
while ! emqx_ctl status | grep -E 'Node\s.*@.*\sis\sstarted'
do
if [ $IDLE_TIME -gt 10 ]
then
Expand All @@ -136,26 +149,27 @@ running_test(){
}

relup_test(){
TARGET_VERSION="$1"
TARGET_VERSION="$("$CODE_PATH"/pkg-vsn.sh)"
if [ -d "${RELUP_PACKAGE_PATH}" ];then
cd "${RELUP_PACKAGE_PATH }"

for var in "${EMQX_NAME}"-*-"$(uname -m)".zip;do
packagename=$(basename "${var}")
unzip "$packagename"
./emqx/bin/emqx start || ( tail emqx/log/emqx.log.1 && exit 1 )
./emqx/bin/emqx_ctl status
./emqx/bin/emqx versions
cp "${PACKAGE_PATH}/${EMQX_NAME}"-*-"${TARGET_VERSION}-$(uname -m)".zip ./emqx/releases
./emqx/bin/emqx install "${TARGET_VERSION}"
[ "$(./emqx/bin/emqx versions |grep permanent | grep -oE "[0-9].[0-9].[0-9]")" = "${TARGET_VERSION}" ] || exit 1
./emqx/bin/emqx_ctl status
./emqx/bin/emqx stop
rm -rf emqx
done
cd "${RELUP_PACKAGE_PATH}"

find . -maxdepth 1 -name "${EMQX_NAME}-*-${ARCH}.zip" |
while read -r pkg; do
packagename=$(basename "${pkg}")
unzip "$packagename"
./emqx/bin/emqx start || ( tail emqx/log/emqx.log.1 && exit 1 )
./emqx/bin/emqx_ctl status
./emqx/bin/emqx versions
cp "${PACKAGE_PATH}/${EMQX_NAME}"-*-"${TARGET_VERSION}-${ARCH}".zip ./emqx/releases
./emqx/bin/emqx install "${TARGET_VERSION}"
[ "$(./emqx/bin/emqx versions |grep permanent | awk '{print $2}')" = "${TARGET_VERSION}" ] || exit 1
./emqx/bin/emqx_ctl status
./emqx/bin/emqx stop
rm -rf emqx
done
fi
}

emqx_prepare
emqx_test
# relup_test <TODO: parameterise relup target version>
relup_test
69 changes: 54 additions & 15 deletions .ci/fvt_tests/relup.lux
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[config var=PROFILE]
[config var=PACKAGE_PATH]
[config var=BENCH_PATH]
[config var=ONE_MORE_EMQX_PATH]
Expand All @@ -21,26 +22,32 @@

[shell emqx]
!cd $PACKAGE_PATH
!unzip -q -o emqx-ubuntu20.04-$(echo $old_vsn | sed -r 's/[v|e]//g')-amd64.zip
!unzip -q -o $PROFILE-ubuntu20.04-$(echo $old_vsn | sed -r 's/[v|e]//g')-amd64.zip
?SH-PROMPT

!cd emqx
!sed -i 's|listener.wss.external[ \t]*=.*|listener.wss.external = 8085|g' etc/emqx.conf
!sed -i '/emqx_telemetry/d' data/loaded_plugins
!export EMQX_LOG__CONSOLE_HANDLER__ENABLE=true
!export EMQX_LOG__CONSOLE_HANDLER__LEVEL=debug
!export EMQX_LOG__PRIMARY_LEVEL=debug
!export EMQX_ZONES__DEFAULT__LISTENERS__MQTT_WSS__BIND="0.0.0.0:8085"

!./bin/emqx start
?EMQ X .* is started successfully!
?SH-PROMPT

[shell emqx2]
!cd $PACKAGE_PATH
!cp -f $ONE_MORE_EMQX_PATH/one_more_emqx.sh .
!./one_more_emqx.sh emqx2
!cp -f $ONE_MORE_EMQX_PATH/one_more_$(echo $PROFILE | sed 's/-/_/g').sh .
!./one_more_$(echo $PROFILE | sed 's/-/_/g').sh emqx2
?SH-PROMPT
!cd emqx2

!sed -i '/emqx_telemetry/d' data/loaded_plugins
!export EMQX_LOG__CONSOLE_HANDLER__ENABLE=true
!export EMQX_LOG__CONSOLE_HANDLER__LEVEL=debug
!export EMQX_LOG__PRIMARY_LEVEL=debug

!./bin/emqx start
?EMQ X (.*) is started successfully!
?EMQ X .* is started successfully!
?SH-PROMPT

!./bin/emqx_ctl cluster join [email protected]
Expand Down Expand Up @@ -71,15 +78,22 @@

[shell bench]
!cd $BENCH_PATH
!./emqtt_bench pub -c 10 -I 1000 -t t/%i -s 64 -L 600

!./emqtt_bench pub -c 10 -I 1000 -t t/%i -s 64 -L 300
???sent

[shell emqx]
!cp -f ../emqx-ubuntu20.04-$VSN-amd64.zip releases/
!echo "" > log/emqx.log.1
?SH-PROMPT

!cp -f ../$PROFILE-ubuntu20.04-$VSN-amd64.zip releases/

!./bin/emqx install $VSN
?Made release permanent: "$VSN"
?SH-PROMPT
!./bin/emqx versions |grep permanent | grep -oE "[0-9].[0-9].[0-9]"
?$VSN

!./bin/emqx versions |grep permanent
?(.*)$VSN
?SH-PROMPT

!./bin/emqx_ctl cluster status
Expand All @@ -89,12 +103,22 @@
"""
?SH-PROMPT

!./bin/emqx_ctl plugins list | grep emqx_management
?Plugin\(emqx_management.*active=true\)
?SH-PROMPT

[shell emqx2]
!cp -f ../emqx-ubuntu20.04-$VSN-amd64.zip releases/
!echo "" > log/emqx.log.1
?SH-PROMPT

!cp -f ../$PROFILE-ubuntu20.04-$VSN-amd64.zip releases/

!./bin/emqx install $VSN
?Made release permanent: "$VSN"
?SH-PROMPT
!./bin/emqx versions |grep permanent | grep -oE "[0-9].[0-9].[0-9]"
?$VSN

!./bin/emqx versions |grep permanent
?(.*)$VSN
?SH-PROMPT

!./bin/emqx_ctl cluster status
Expand All @@ -104,11 +128,26 @@
"""
?SH-PROMPT

!./bin/emqx_ctl plugins list | grep emqx_management
?Plugin\(emqx_management.*active=true\)
?SH-PROMPT

[shell bench]
???publish complete
??SH-PROMPT:
!sleep 30
?SH-PROMPT

!curl --user admin:public --silent --show-error http://localhost:8081/api/v4/rules | jq --raw-output ".data[0].metrics[] | select(.node==\"[email protected]\").matched"
?300
?SH-PROMPT

!curl --user admin:public --silent --show-error http://localhost:8081/api/v4/rules | jq --raw-output ".data[0].actions[0].metrics[] | select(.node==\"[email protected]\").success"
?300
?SH-PROMPT

!curl http://127.0.0.1:8080/counter
???{"data":600,"code":0}
???{"data":300,"code":0}
?SH-PROMPT

[shell emqx2]
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Please describe the current behavior and link to a relevant issue. -->
Fixes <issue-number>

**If your build fails** due to your commit message not passing the build checks, please review the guidelines here: https://github.com.cnpmjs.org/emqx/emqx/blob/master/CONTRIBUTING.md.
**If your build fails** due to your commit message not passing the build checks, please review the guidelines here: https://github.com/emqx/emqx/blob/master/CONTRIBUTING.md.

## PR Checklist
Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:
Expand Down
2 changes: 1 addition & 1 deletion .github/weekly-digest.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Configuration for weekly-digest - https://github.com.cnpmjs.org/apps/weekly-digest
# Configuration for weekly-digest - https://github.com/apps/weekly-digest
publishDay: monday
canPublishIssues: true
canPublishPullRequests: true
Expand Down
Loading

0 comments on commit 589951c

Please sign in to comment.