emqx/.github/workflows/run_relup_tests.yaml

122 lines
3.6 KiB
YAML

name: Release Upgrade Tests
concurrency:
group: relup-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_call:
inputs:
builder:
required: true
type: string
permissions:
contents: read
jobs:
relup_test_plan:
runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
container: ${{ inputs.builder }}
outputs:
CUR_EE_VSN: ${{ steps.find-versions.outputs.CUR_EE_VSN }}
OLD_VERSIONS: ${{ steps.find-versions.outputs.OLD_VERSIONS }}
defaults:
run:
shell: bash
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: emqx-enterprise
- name: extract artifact
run: |
unzip -o -q emqx-enterprise.zip
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Find versions
id: find-versions
run: |
set -x
ee_vsn="$(./pkg-vsn.sh enterprise)"
old_ee_vsns="$(./scripts/relup-build/base-vsns.sh enterprise | xargs)"
old_vsns=$(echo -n "${old_ee_vsns}" | sed 's/ $//g' | jq -R -s -c 'split(" ")')
echo "CUR_EE_VSN=$ee_vsn" >> $GITHUB_OUTPUT
echo "OLD_VERSIONS=$old_vsns" >> $GITHUB_OUTPUT
- name: build emqx
run: |
export PROFILE='emqx-enterprise'
make emqx-enterprise-tgz
- uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5
name: Upload built emqx and test scenario
with:
name: relup_tests_emqx_built
path: |
_upgrade_base
_packages
scripts
.ci
retention-days: 7
relup_test_run:
needs:
- relup_test_plan
if: needs.relup_test_plan.outputs.OLD_VERSIONS != '[]'
runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
strategy:
fail-fast: false
matrix:
old_vsn: ${{ fromJson(needs.relup_test_plan.outputs.OLD_VERSIONS) }}
env:
OLD_VSN: "${{ matrix.old_vsn }}"
CUR_EE_VSN: "${{ needs.relup_test_plan.outputs.CUR_EE_VSN }}"
defaults:
run:
shell: bash
steps:
- uses: erlef/setup-beam@b9c58b0450cd832ccdb3c17cc156a47065d2114f # v1.18.1
with:
otp-version: 26.2.5
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: hawk/lux
ref: lux-2.8.1
path: lux
- name: Install lux
run: |
set -eu
cd lux
autoconf
./configure
make
echo "$(pwd)/bin" >> $GITHUB_PATH
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
name: Download built emqx and test scenario
with:
name: relup_tests_emqx_built
path: .
- name: run relup test
run: |
set -eux
case "$OLD_VSN" in
e*)
export CUR_VSN="$CUR_EE_VSN"
;;
*)
echo "unknown old version $OLD_VSN"
exit 1
;;
esac
mkdir -p lux_logs
if ! ./scripts/relup-test/run-relup-lux.sh $OLD_VSN; then
docker logs node1.emqx.io | tee lux_logs/emqx1.log
docker logs node2.emqx.io | tee lux_logs/emqx2.log
exit 1
fi
- uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5
name: Save debug data
if: failure()
with:
name: relup_test_run_debug_data
path: |
lux_logs
retention-days: 3