ci: fix relup test workflow and upgrade builder to 5.0-17

builder 5.0-17 has emqtt-bench and lux included
so we do not need to rebuild the software for each ci job
This commit is contained in:
Zaiming (Stone) Shi 2022-06-24 06:09:48 +02:00
parent 0d6c4e0996
commit d3f8ebd10f
17 changed files with 155 additions and 124 deletions

View File

@ -3,7 +3,7 @@ version: '3.9'
services:
erlang24:
container_name: erlang24
image: ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-ubuntu20.04
image: ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04
env_file:
- conf.env
environment:

View File

@ -1,14 +1,11 @@
[config var=PROFILE]
[config var=PACKAGE_PATH]
[config var=BENCH_PATH]
[config var=VSN]
[config var=OLD_VSNS]
[config var=OLD_VSN]
[config shell_cmd=/bin/bash]
[config timeout=600000]
[loop old_vsn $OLD_VSNS]
[shell http_server]
!cd http_server
!rebar3 shell
@ -22,10 +19,10 @@
[shell emqx1]
!cd $PACKAGE_PATH
!mkdir -p emqx1
!tar -C emqx -zxf ${PROFILE}-$(echo $old_vsn | sed -r 's/[v|e]//g')-*-ubuntu20.04-amd64.tar.gz
!tar -C emqx1 -zxf ${PROFILE}-$(echo $OLD_VSN | sed -r 's/[v|e]//g')-*-ubuntu20.04-amd64.tar.gz
?SH-PROMPT
!cd emqx
!cd emqx1
!export EMQX_NODE_NAME='emqx1@127.0.0.1'
!./bin/emqx start
?EMQX .* is started successfully!
@ -34,7 +31,7 @@
[shell emqx2]
!cd $PACKAGE_PATH
!mkdir -p emqx2
!tar -C emqx -zxf ${PROFILE}-$(echo $old_vsn | sed -r 's/[v|e]//g')-*-ubuntu20.04-amd64.tar.gz
!tar -C emqx2 -zxf ${PROFILE}-$(echo $OLD_VSN | sed -r 's/[v|e]//g')-*-ubuntu20.04-amd64.tar.gz
?SH-PROMPT
!cd emqx2
@ -58,12 +55,12 @@
?SH-PROMPT
## create a webhook data bridge with id "my_webhook"
!curl --user admin:public --silent --show-error 'http://localhost:18083/api/v5/bridges' -X 'POST' -H 'Content-Type: application/json' --data-binary '{"name":"my_webhook","method":"post","url":"http://127.0.0.1:7077/counter","headers":{"content-type":"application/json"},"pool_size":4,"enable_pipelining":100,"connect_timeout":"5s","request_timeout":"5s","max_retries":3,"type":"webhook","ssl":{"enable":false,"verify":"verify_none"}}' | jq '.status'
!curl --user admin:public --silent --show-error 'http://localhost:18082/api/v5/bridges' -X 'POST' -H 'Content-Type: application/json' --data-binary '{"name":"my_webhook","method":"post","url":"http://127.0.0.1:7077/counter","headers":{"content-type":"application/json"},"pool_size":4,"enable_pipelining":100,"connect_timeout":"5s","request_timeout":"5s","max_retries":3,"type":"webhook","ssl":{"enable":false,"verify":"verify_none"}}' | jq '.status'
?connected
?SH-PROMPT
## create a rule that uses the webhook as action, the rule id = "rule_edsy"
!curl --user admin:public --silent --show-error 'http://localhost:18083/api/v5/rules' -X 'POST' -H 'Content-Type: application/json' --data-binary '{"id":"rule_edsy","sql":"SELECT\n *\nFROM\n \"t/#\"","actions":["webhook:my_webhook"]}' | jq '.id'
!curl --user admin:public --silent --show-error 'http://localhost:18082/api/v5/rules' -X 'POST' -H 'Content-Type: application/json' --data-binary '{"id":"rule_edsy","sql":"SELECT\n *\nFROM\n \"t/#\"","actions":["webhook:my_webhook"]}' | jq '.id'
?rule_edsy
?SH-PROMPT
@ -77,9 +74,8 @@
?SH-PROMPT
[shell bench]
!cd $BENCH_PATH
!./emqtt_bench pub -c 10 -I 1000 -t t/%i -s 64 -L 300
!emqtt_bench pub -c 10 -I 1000 -t t/%i -s 64 -L 300
???sent
[shell emqx1]
@ -98,11 +94,11 @@
?SH-PROMPT
## 2. downgrade to the old version
!./bin/emqx install $old_vsn
!./bin/emqx install $OLD_VSN
?Made release permanent:.*
?SH-PROMPT
!./bin/emqx versions | grep permanent | grep -qs "$old_vsn"
!./bin/emqx versions | grep permanent | grep -qs "$OLD_VSN"
?SH-PROMPT:
!echo ==$$?==
?^==0==
@ -137,11 +133,11 @@
?SH-PROMPT
## 2. downgrade to the old version
!./bin/emqx install $old_vsn
!./bin/emqx install $OLD_VSN
?Made release permanent:.*
?SH-PROMPT
!./bin/emqx versions | grep permanent | grep -qs "$old_vsn"
!./bin/emqx versions | grep permanent | grep -qs "$OLD_VSN"
?SH-PROMPT:
!echo ==$$?==
?^==0==
@ -168,11 +164,11 @@
!sleep 5
?SH-PROMPT
!curl --user admin:public --silent --show-error http://localhost:18083/api/v5/rules | jq --raw-output ".[0].node_metrics[] | select(.node==\"emqx@127.0.0.1\") | .metrics.matched"
!curl --user admin:public --silent --show-error http://localhost:18083/api/v5/rules | jq --raw-output ".[0].node_metrics[] | select(.node==\"emqx1@127.0.0.1\") | .metrics.matched"
?300
?SH-PROMPT
!curl --user admin:public --silent --show-error http://localhost:18083/api/v5/rules | jq --raw-output ".[0].node_metrics[] | select(.node==\"emqx@127.0.0.1\") | .metrics.\"actions.success\""
!curl --user admin:public --silent --show-error http://localhost:18083/api/v5/rules | jq --raw-output ".[0].node_metrics[] | select(.node==\"emqx1@127.0.0.1\") | .metrics.\"actions.success\""
?\{"data":(29[0-9])|(300),"code":0\}
?SH-PROMPT
@ -212,8 +208,6 @@
!halt(3).
?SH-PROMPT:
[endloop]
[cleanup]
!echo ==$$?==
?==0==

View File

@ -20,7 +20,7 @@ jobs:
prepare:
runs-on: ubuntu-20.04
# prepare source with any OTP version, no need for a matrix
container: "ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-ubuntu20.04"
container: "ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04"
outputs:
BUILD_PROFILE: ${{ steps.get_profile.outputs.BUILD_PROFILE }}
@ -211,7 +211,7 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_FROM=ghcr.io/emqx/emqx-builder/5.0-16:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os[0] }}
BUILD_FROM=ghcr.io/emqx/emqx-builder/5.0-17:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os[0] }}
RUN_FROM=${{ matrix.os[1] }}
EMQX_NAME=${{ steps.pre-meta.outputs.emqx_name }}
file: source/${{ matrix.os[2] }}

View File

@ -213,7 +213,7 @@ jobs:
needs: prepare
runs-on: ${{ matrix.build_machine }}
container:
image: "ghcr.io/emqx/emqx-builder/5.0-16:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
image: "ghcr.io/emqx/emqx-builder/5.0-17:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
strategy:
fail-fast: false
@ -328,7 +328,7 @@ jobs:
--pkgtype "${PKGTYPE}" \
--arch "${ARCH}" \
--elixir "${IsElixir}" \
--builder "ghcr.io/emqx/emqx-builder/5.0-16:${ELIXIR}-${OTP}-${SYSTEM}"
--builder "ghcr.io/emqx/emqx-builder/5.0-17:${ELIXIR}-${OTP}-${SYSTEM}"
done
- uses: actions/upload-artifact@v1
with:

View File

@ -39,7 +39,7 @@ jobs:
- ubuntu20.04
- el8
container: "ghcr.io/emqx/emqx-builder/5.0-16:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
container: "ghcr.io/emqx/emqx-builder/5.0-17:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
steps:
- uses: AutoModality/action-clean@v1

View File

@ -5,7 +5,7 @@ on: [pull_request, push]
jobs:
check_deps_integrity:
runs-on: ubuntu-20.04
container: ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-ubuntu20.04
container: ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04
steps:
- uses: actions/checkout@v2

View File

@ -5,7 +5,7 @@ on: [pull_request]
jobs:
code_style_check:
runs-on: ubuntu-20.04
container: "ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-ubuntu20.04"
container: "ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04"
steps:
- uses: actions/checkout@v2
with:

View File

@ -8,7 +8,7 @@ jobs:
elixir_apps_check:
runs-on: ubuntu-latest
# just use the latest builder
container: "ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-ubuntu20.04"
container: "ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04"
strategy:
fail-fast: false

View File

@ -7,7 +7,7 @@ on: [pull_request, push]
jobs:
elixir_deps_check:
runs-on: ubuntu-20.04
container: ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-ubuntu20.04
container: ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04
steps:
- name: Checkout

View File

@ -12,7 +12,7 @@ on:
jobs:
elixir_release_build:
runs-on: ubuntu-latest
container: ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-ubuntu20.04
container: ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04
steps:
- name: Checkout

View File

@ -24,7 +24,7 @@ jobs:
- amd64
runs-on: aws-amd64
container: "ghcr.io/emqx/emqx-builder/5.0-16:${{ matrix.elixir}}-${{ matrix.otp }}-${{ matrix.os }}"
container: "ghcr.io/emqx/emqx-builder/5.0-17:${{ matrix.elixir}}-${{ matrix.otp }}-${{ matrix.os }}"
defaults:
run:

View File

@ -16,7 +16,7 @@ jobs:
prepare:
runs-on: ubuntu-20.04
# prepare source with any OTP version, no need for a matrix
container: ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-alpine3.15.1
container: ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-alpine3.15.1
steps:
- uses: actions/checkout@v2
@ -68,7 +68,7 @@ jobs:
- name: make docker image
working-directory: source
env:
EMQX_BUILDER: ghcr.io/emqx/emqx-builder/5.0-16:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os[0] }}
EMQX_BUILDER: ghcr.io/emqx/emqx-builder/5.0-17:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os[0] }}
EMQX_RUNNER: ${{ matrix.os[1] }}
run: |
make ${{ matrix.profile }}-docker
@ -140,7 +140,7 @@ jobs:
- name: make docker image
working-directory: source
env:
EMQX_BUILDER: ghcr.io/emqx/emqx-builder/5.0-16:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os[0] }}
EMQX_BUILDER: ghcr.io/emqx/emqx-builder/5.0-17:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os[0] }}
EMQX_RUNNER: ${{ matrix.os[1] }}
run: |
make ${{ matrix.profile }}-docker

View File

@ -14,104 +14,141 @@ on:
pull_request:
jobs:
relup_test:
runs-on: aws-amd64
relup_test_plan:
runs-on: ubuntu-20.04
container: ghcr.io/emqx/emqx-builder/4.4-12:24.1.5-3-ubuntu20.04
outputs:
ce_vsn: ${{ steps.find-versions.outputs.CUR_CE_VSN }}
ee_vsn: ${{ steps.find-versions.outputs.CUR_EE_VSN }}
old_vsns: ${{ steps.generate-matrix.outputs.OLD_VERSIONS }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
name: Checkout
with:
path: emqx
fetch-depth: 0
- name: Find versions
id: find-versions
run: |
set -x
cd emqx
ce_vsn="$(./pkg-vsn.sh opensource)"
ee_vsn="$(./pkg-vsn.sh enterprise)"
old_ce_vsns="$(./scripts/relup-base-vsns.sh opensource | xargs)"
old_ee_vsns="$(./scripts/relup-base-vsns.sh enterprise | xargs)"
echo "OLD_CE_VERSIONS=$old_ce_vsns" >> $GITHUB_ENV
echo "OLD_EE_VERSIONS=$old_ee_vsns" >> $GITHUB_ENV
echo "::set-output name=CUR_CE_VSN::$ce_vsn"
echo "::set-output name=CUR_EE_VSN::$ee_vsn"
- name: Generate matrix
id: generate-matrix
run: |
set -x
old_vsns=$(echo -n "${OLD_CE_VSNS} ${OLD_EE_VSNS}" | sed 's/ $//g' | jq -R -s -c 'split(" ")')
echo "::set-output name=OLD_VERSIONS::$old_vsns"
relup_test_build:
needs: relup_test_plan
runs-on: ubuntu-20.04
strategy:
matrix:
profile:
- emqx
- emqx-enterprise
otp:
- 24.2.1-1
# no need to use more than 1 version of Elixir, since tests
# run using only Erlang code. This is needed just to specify
# the base image.
elixir:
- 1.13.4
os:
- ubuntu20.04
arch:
- amd64
container: "ghcr.io/emqx/emqx-builder/5.0-16:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
container: "ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04"
defaults:
run:
shell: bash
steps:
- uses: AutoModality/action-clean@v1
- uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- uses: actions/checkout@v2
with:
repository: emqx/paho.mqtt.testing
ref: develop-4.0
path: paho.mqtt.testing
- uses: actions/checkout@v2
with:
repository: emqx/emqtt-bench
ref: 0.3.4
path: emqtt-bench
- uses: actions/checkout@v2
with:
repository: hawk/lux
ref: lux-2.6
path: lux
- uses: actions/checkout@v2
with:
repository: ${{ github.repository }}
path: emqx
fetch-depth: 0
- name: Get old vsn
run: |
set -x
echo "OLD_VSNS=$(emqx/scripts/relup-base-vsns.sh ${{ matrix.profile }} | xargs echo -n)" >> $GITHUB_ENV
echo "NOW_VSN=$(emqx/pkg-vsn.sh ${{ matrix.profile }})" >> $GITHUB_ENV
- name: build emqx
env:
PROFILE: ${{ matrix.profile }}
run: make -C emqx ${PROFILE}-tgz
- name: build emqtt-bench
run: make -C emqtt-bench
- name: build lux
run: |
set -e -u -x
cd lux
autoconf
./configure
make
make install
- name: run relup test
- uses: actions/upload-artifact@v2
name: Upload built emqx and test scenario
with:
name: emqx_built
path: |
emqx/_packages/*/*.tar.gz
emqx/.ci/fvt_tests
relup_test_run:
needs:
- relup_test_plan
- relup_test_build
runs-on: ubuntu-20.04
container: "ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04"
strategy:
fail-fast: false
matrix:
old_vsn: ${{ fromJson(needs.relup_test_plan.outputs.OLD_VERSIONS) }}
env:
PROFILE: ${{ matrix.profile }}
timeout-minutes: 20
OLD_VSN: "${{ matrix.old_vsn }}"
CUR_CE_VSN: "${{ needs.relup_test_plan.outputs.CUR_CE_VSN }}"
CUR_EE_VSN: "${{ needs.relup_test_plan.outputs.CUR_EE_VSN }}"
defaults:
run:
shell: bash
steps:
- uses: actions/download-artifact@v2
name: Download built emqx and test scenario
with:
name: emqx_built
path: emqx_built
- name: Prepare packages
run: |
set -e -x -u
if [ -n "$OLD_VSNS" ]; then
mkdir -p packages
cp emqx/_packages/${PROFILE}/*.tar.gz packages/
cp emqx/_upgrade_base/*.tar.gz packages/
cp emqx_built/_packages/*/*.tar.gz packages
cd packages
case "$OLD_VSN" in
e*)
profile='emqx-enterprise'
s3dir='emqx-ee'
;;
v*)
profile='emqx'
s3dir='emqx-ce'
;;
*)
echo "unknown old version $OLD_VSN"
exit 1
;;
esac
wget --no-verbose https://s3-us-west-2.amazonaws.com/packages.emqx/${s3dir}/$OLD_VSN/${profile}-${OLD_VSN#[e|v]}-24.2.1-1-ubuntu20.04-amd64.tar.gz
- name: Run relup test scenario
timeout-minutes: 5
run: |
set -x
case "$OLD_VSN" in
e*)
cur_vsn=$CUR_EE_VSN
profile='emqx-enterprise'
;;
v*)
cur_vsn=$CUR_CE_VSN
profile='emqx'
;;
esac
lux \
--progress verbose \
--case_timeout infinity \
--var PROFILE=$PROFILE \
--var PROFILE="$profile" \
--var PACKAGE_PATH=$(pwd)/packages \
--var BENCH_PATH=$(pwd)/emqtt-bench \
--var VSN="$NOW_VSN" \
--var OLD_VSNS="$OLD_VSNS" \
emqx/.ci/fvt_tests/relup.lux
fi
- uses: actions/upload-artifact@v1
--var VSN="$cur_vsn" \
--var OLD_VSN="$OLD_VSN" \
emqx_built/.ci/fvt_tests/relup.lux
- uses: actions/upload-artifact@v2
name: Save debug data
if: failure()
with:
name: lux_logs
path: lux_logs
- uses: actions/upload-artifact@v1
if: failure()
with:
name: packages
path: packages
name: debug_data
path: |
packages/emqx1/log/emqx.log.1
packages/emqx2/log/emqx.log.1
packages/*.zip
lux_logs

View File

@ -17,7 +17,7 @@ jobs:
prepare:
runs-on: ubuntu-20.04
# prepare source with any OTP version, no need for a matrix
container: "ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-ubuntu20.04"
container: "ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04"
outputs:
fast_ct_apps: ${{ steps.run_find_apps.outputs.fast_ct_apps }}
docker_ct_apps: ${{ steps.run_find_apps.outputs.docker_ct_apps }}
@ -54,7 +54,7 @@ jobs:
defaults:
run:
shell: bash
container: "ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-ubuntu20.04"
container: "ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04"
steps:
- uses: AutoModality/action-clean@v1
@ -144,7 +144,7 @@ jobs:
matrix:
app_name: ${{ fromJson(needs.prepare.outputs.fast_ct_apps) }}
runs-on: aws-amd64
container: "ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-ubuntu20.04"
container: "ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04"
defaults:
run:
shell: bash
@ -179,7 +179,7 @@ jobs:
- ct
- ct_docker
runs-on: ubuntu-20.04
container: "ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-ubuntu20.04"
container: "ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04"
steps:
- uses: AutoModality/action-clean@v1
- uses: actions/download-artifact@v2

View File

@ -3,7 +3,7 @@ REBAR = $(CURDIR)/rebar3
BUILD = $(CURDIR)/build
SCRIPTS = $(CURDIR)/scripts
export EMQX_RELUP ?= true
export EMQX_DEFAULT_BUILDER = ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-debian11
export EMQX_DEFAULT_BUILDER = ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-debian11
export EMQX_DEFAULT_RUNNER = debian:11-slim
export OTP_VSN ?= $(shell $(CURDIR)/scripts/get-otp-vsn.sh)
export ELIXIR_VSN ?= $(shell $(CURDIR)/scripts/get-elixir-vsn.sh)

View File

@ -1,4 +1,4 @@
ARG BUILD_FROM=ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-debian11
ARG BUILD_FROM=ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-debian11
ARG RUN_FROM=debian:11-slim
FROM ${BUILD_FROM} AS builder

View File

@ -9,7 +9,7 @@
## example:
## ./scripts/buildx.sh --profile emqx --pkgtype tgz --arch arm64 \
## --builder ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-debian10
## --builder ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-debian10
set -euo pipefail
@ -24,7 +24,7 @@ help() {
echo "--arch amd64|arm64: Target arch to build the EMQX package for"
echo "--src_dir <SRC_DIR>: EMQX source ode in this dir, default to PWD"
echo "--builder <BUILDER>: Builder image to pull"
echo " E.g. ghcr.io/emqx/emqx-builder/5.0-16:1.13.4-24.2.1-1-debian10"
echo " E.g. ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-debian10"
}
while [ "$#" -gt 0 ]; do