Merge pull request #11289 from id/0713-build-debian12-packages

This commit is contained in:
Ivan Dyachkov 2023-07-18 19:46:29 +02:00 committed by GitHub
commit 3be1773e99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 85 additions and 80 deletions

View File

@ -120,7 +120,7 @@ jobs:
# NOTE: 'otp' and 'elixir' are to configure emqx-builder image # NOTE: 'otp' and 'elixir' are to configure emqx-builder image
# only support latest otp and elixir, not a matrix # only support latest otp and elixir, not a matrix
builder: builder:
- 5.1-1 # update to latest - 5.1-3 # update to latest
otp: otp:
- 25.3.2-1 - 25.3.2-1
elixir: elixir:

View File

@ -181,6 +181,7 @@ jobs:
- ubuntu22.04 - ubuntu22.04
- ubuntu20.04 - ubuntu20.04
- ubuntu18.04 - ubuntu18.04
- debian12
- debian11 - debian11
- debian10 - debian10
- el9 - el9
@ -190,16 +191,16 @@ jobs:
- amzn2023 - amzn2023
build_machine: build_machine:
- aws-arm64 - aws-arm64
- ubuntu-22.04 - aws-amd64
builder: builder:
- 5.1-1 - 5.1-3
elixir: elixir:
- 1.14.5 - 1.14.5
with_elixir: with_elixir:
- 'no' - 'no'
exclude: exclude:
- arch: arm64 - arch: arm64
build_machine: ubuntu-22.04 build_machine: aws-amd64
- arch: amd64 - arch: amd64
build_machine: aws-arm64 build_machine: aws-arm64
include: include:
@ -207,16 +208,8 @@ jobs:
otp: 25.3.2-1 otp: 25.3.2-1
arch: amd64 arch: amd64
os: ubuntu22.04 os: ubuntu22.04
build_machine: ubuntu-22.04 build_machine: aws-amd64
builder: 5.1-1 builder: 5.1-3
elixir: 1.14.5
with_elixir: 'yes'
- profile: emqx
otp: 25.3.2-1
arch: amd64
os: amzn2
build_machine: ubuntu-22.04
builder: 5.1-1
elixir: 1.14.5 elixir: 1.14.5
with_elixir: 'yes' with_elixir: 'yes'
@ -226,18 +219,13 @@ jobs:
steps: steps:
- uses: AutoModality/action-clean@v1 - uses: AutoModality/action-clean@v1
if: matrix.build_machine == 'aws-arm64'
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
ref: ${{ github.event.inputs.branch_or_tag }} ref: ${{ github.event.inputs.branch_or_tag }}
fetch-depth: 0 fetch-depth: 0
- name: build emqx packages - name: fix workdir
env:
ELIXIR: ${{ matrix.elixir }}
PROFILE: ${{ matrix.profile }}
ARCH: ${{ matrix.arch }}
run: | run: |
set -eu set -eu
git config --global --add safe.directory "$GITHUB_WORKSPACE" git config --global --add safe.directory "$GITHUB_WORKSPACE"
@ -247,22 +235,33 @@ jobs:
cd /emqx cd /emqx
fi fi
echo "pwd is $PWD" echo "pwd is $PWD"
PKGTYPES="tgz pkg"
IS_ELIXIR=${{ matrix.with_elixir }} - name: build emqx packages
env:
PROFILE: ${{ matrix.profile }}
IS_ELIXIR: ${{ matrix.with_elixir }}
ACLOCAL_PATH: "/usr/share/aclocal:/usr/local/share/aclocal"
run: |
set -eu
if [ "${IS_ELIXIR:-}" == 'yes' ]; then if [ "${IS_ELIXIR:-}" == 'yes' ]; then
PKGTYPES="tgz" make "${PROFILE}-elixir-tgz"
else
make "${PROFILE}-tgz"
make "${PROFILE}-pkg"
fi
- name: test emqx packages
env:
PROFILE: ${{ matrix.profile }}
IS_ELIXIR: ${{ matrix.with_elixir }}
run: |
set -eu
if [ "${IS_ELIXIR:-}" == 'yes' ]; then
./scripts/pkg-tests.sh "${PROFILE}-elixir-tgz"
else
./scripts/pkg-tests.sh "${PROFILE}-tgz"
./scripts/pkg-tests.sh "${PROFILE}-pkg"
fi fi
for PKGTYPE in ${PKGTYPES};
do
./scripts/buildx.sh \
--profile "${PROFILE}" \
--pkgtype "${PKGTYPE}" \
--arch "${ARCH}" \
--elixir "${IS_ELIXIR}" \
--builder "force_host"
done
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
if: success()
with: with:
name: ${{ matrix.profile }} name: ${{ matrix.profile }}
path: _packages/${{ matrix.profile }}/ path: _packages/${{ matrix.profile }}/

View File

@ -32,7 +32,7 @@ jobs:
- debian10 - debian10
- amzn2023 - amzn2023
builder: builder:
- 5.1-1 - 5.1-3
elixir: elixir:
- 1.14.5 - 1.14.5

View File

@ -35,7 +35,7 @@ jobs:
- ["emqx-enterprise", "25.3.2-1", "amzn2023", "erlang"] - ["emqx-enterprise", "25.3.2-1", "amzn2023", "erlang"]
- ["emqx-enterprise", "25.3.2-1", "ubuntu20.04", "erlang"] - ["emqx-enterprise", "25.3.2-1", "ubuntu20.04", "erlang"]
builder: builder:
- 5.1-1 - 5.1-3
elixir: elixir:
- '1.14.5' - '1.14.5'

View File

@ -87,6 +87,8 @@ jobs:
push "debian/buster" "packages/$PROFILE-$VERSION-debian10-arm64.deb" push "debian/buster" "packages/$PROFILE-$VERSION-debian10-arm64.deb"
push "debian/bullseye" "packages/$PROFILE-$VERSION-debian11-amd64.deb" push "debian/bullseye" "packages/$PROFILE-$VERSION-debian11-amd64.deb"
push "debian/bullseye" "packages/$PROFILE-$VERSION-debian11-arm64.deb" push "debian/bullseye" "packages/$PROFILE-$VERSION-debian11-arm64.deb"
push "debian/bookworm" "packages/$PROFILE-$VERSION-debian12-amd64.deb"
push "debian/bookworm" "packages/$PROFILE-$VERSION-debian12-arm64.deb"
push "ubuntu/bionic" "packages/$PROFILE-$VERSION-ubuntu18.04-amd64.deb" push "ubuntu/bionic" "packages/$PROFILE-$VERSION-ubuntu18.04-amd64.deb"
push "ubuntu/bionic" "packages/$PROFILE-$VERSION-ubuntu18.04-arm64.deb" push "ubuntu/bionic" "packages/$PROFILE-$VERSION-ubuntu18.04-arm64.deb"
push "ubuntu/focal" "packages/$PROFILE-$VERSION-ubuntu20.04-amd64.deb" push "ubuntu/focal" "packages/$PROFILE-$VERSION-ubuntu20.04-amd64.deb"

View File

@ -12,7 +12,7 @@ jobs:
strategy: strategy:
matrix: matrix:
builder: builder:
- 5.1-1 - 5.1-3
otp: otp:
- 25.3.2-1 - 25.3.2-1
# no need to use more than 1 version of Elixir, since tests # no need to use more than 1 version of Elixir, since tests

View File

@ -50,7 +50,7 @@ jobs:
os: os:
- ["debian11", "debian:11-slim"] - ["debian11", "debian:11-slim"]
builder: builder:
- 5.1-1 - 5.1-3
otp: otp:
- 25.3.2-1 - 25.3.2-1
elixir: elixir:
@ -123,7 +123,7 @@ jobs:
os: os:
- ["debian11", "debian:11-slim"] - ["debian11", "debian:11-slim"]
builder: builder:
- 5.1-1 - 5.1-3
otp: otp:
- 25.3.2-1 - 25.3.2-1
elixir: elixir:

View File

@ -34,12 +34,12 @@ jobs:
MATRIX="$(echo "${APPS}" | jq -c ' MATRIX="$(echo "${APPS}" | jq -c '
[ [
(.[] | select(.profile == "emqx") | . + { (.[] | select(.profile == "emqx") | . + {
builder: "5.1-1", builder: "5.1-3",
otp: "25.3.2-1", otp: "25.3.2-1",
elixir: "1.14.5" elixir: "1.14.5"
}), }),
(.[] | select(.profile == "emqx-enterprise") | . + { (.[] | select(.profile == "emqx-enterprise") | . + {
builder: "5.1-1", builder: "5.1-3",
otp: ["25.3.2-1"][], otp: ["25.3.2-1"][],
elixir: "1.14.5" elixir: "1.14.5"
}) })

View File

@ -811,8 +811,8 @@ is_down() {
PID="$1" PID="$1"
if ps -p "$PID" >/dev/null; then if ps -p "$PID" >/dev/null; then
# still around # still around
# shellcheck disable=SC2009 # this grep pattern is not a part of the progra names # shellcheck disable=SC2009 # this grep pattern is not a part of the program names
if ps -p "$PID" | $GREP -q 'defunct'; then if ps -efp "$PID" | $GREP -q 'defunct'; then
# zombie state, print parent pid # zombie state, print parent pid
parent="$(ps -o ppid= -p "$PID" | tr -d ' ')" parent="$(ps -o ppid= -p "$PID" | tr -d ' ')"
logwarn "$PID is marked <defunct>, parent: $(ps -p "$parent")" logwarn "$PID is marked <defunct>, parent: $(ps -p "$parent")"

View File

@ -0,0 +1 @@
Release packages for Debian 12.

View File

@ -46,6 +46,7 @@ export SCRIPTS="${CODE_PATH}/scripts"
export EMQX_NAME export EMQX_NAME
export PACKAGE_PATH="${CODE_PATH}/_packages/${EMQX_NAME}" export PACKAGE_PATH="${CODE_PATH}/_packages/${EMQX_NAME}"
export RELUP_PACKAGE_PATH="${CODE_PATH}/_upgrade_base" export RELUP_PACKAGE_PATH="${CODE_PATH}/_upgrade_base"
export PAHO_MQTT_TESTING_PATH="${PAHO_MQTT_TESTING_PATH:-/paho-mqtt-testing}"
SYSTEM="$("$SCRIPTS"/get-distro.sh)" SYSTEM="$("$SCRIPTS"/get-distro.sh)"
@ -64,7 +65,7 @@ fi
PACKAGE_VERSION="$("$CODE_PATH"/pkg-vsn.sh "${EMQX_NAME}")" PACKAGE_VERSION="$("$CODE_PATH"/pkg-vsn.sh "${EMQX_NAME}")"
PACKAGE_VERSION_LONG="$("$CODE_PATH"/pkg-vsn.sh "${EMQX_NAME}" --long --elixir "${IS_ELIXIR}")" PACKAGE_VERSION_LONG="$("$CODE_PATH"/pkg-vsn.sh "${EMQX_NAME}" --long --elixir "${IS_ELIXIR}")"
PACKAGE_NAME="${EMQX_NAME}-${PACKAGE_VERSION_LONG}" PACKAGE_NAME="${EMQX_NAME}-${PACKAGE_VERSION_LONG}"
PACKAGE_FILE_NAME="${PACKAGE_NAME}.${PKG_SUFFIX}" PACKAGE_FILE_NAME="${PACKAGE_FILE_NAME:-${PACKAGE_NAME}.${PKG_SUFFIX}}"
PACKAGE_FILE="${PACKAGE_PATH}/${PACKAGE_FILE_NAME}" PACKAGE_FILE="${PACKAGE_PATH}/${PACKAGE_FILE_NAME}"
if ! [ -f "$PACKAGE_FILE" ]; then if ! [ -f "$PACKAGE_FILE" ]; then
@ -75,9 +76,21 @@ fi
emqx_prepare(){ emqx_prepare(){
mkdir -p "${PACKAGE_PATH}" mkdir -p "${PACKAGE_PATH}"
if [ ! -d "/paho-mqtt-testing" ]; then if [ ! -d "${PAHO_MQTT_TESTING_PATH}" ]; then
git clone -b develop-4.0 https://github.com/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_PATH}"
fi fi
# Debian 12 complains if we don't use venv
case "${SYSTEM:-}" in
debian12)
apt-get update -y && apt-get install -y virtualenv
virtualenv venv
# https://www.shellcheck.net/wiki/SC1091
# shellcheck source=/dev/null
source ./venv/bin/activate
;;
*)
;;
esac
pip3 install pytest pip3 install pytest
} }
@ -97,36 +110,22 @@ emqx_test(){
# fi # fi
# sed -i '/emqx_telemetry/d' "${PACKAGE_PATH}"/emqx/data/loaded_plugins # sed -i '/emqx_telemetry/d' "${PACKAGE_PATH}"/emqx/data/loaded_plugins
echo "running ${packagename} start" run_test "${PACKAGE_PATH}/emqx/bin" "${PACKAGE_PATH}/emqx/log" "${PACKAGE_PATH}/emqx/releases/emqx_vars"
if ! "${PACKAGE_PATH}"/emqx/bin/emqx start; then
cat "${PACKAGE_PATH}"/emqx/log/erlang.log.1 || true
cat "${PACKAGE_PATH}"/emqx/log/emqx.log.1 || true
exit 1
fi
"$SCRIPTS/test/emqx-smoke-test.sh" 127.0.0.1 18083
pytest -v /paho-mqtt-testing/interoperability/test_client/V5/test_connect.py::test_basic
if ! "${PACKAGE_PATH}"/emqx/bin/emqx stop; then
cat "${PACKAGE_PATH}"/emqx/log/erlang.log.1 || true
cat "${PACKAGE_PATH}"/emqx/log/emqx.log.1 || true
exit 1
fi
echo "running ${packagename} stop"
rm -rf "${PACKAGE_PATH}"/emqx rm -rf "${PACKAGE_PATH}"/emqx
;; ;;
"deb") "deb")
dpkg -i "${PACKAGE_PATH}/${packagename}" dpkg -i "${PACKAGE_PATH}/${packagename}"
if [ "$(dpkg -l |grep emqx |awk '{print $1}')" != "ii" ] if [ "$(dpkg -l | grep ${EMQX_NAME} | awk '{print $1}')" != "ii" ]
then then
echo "package install error" echo "package install error"
exit 1 exit 1
fi fi
echo "running ${packagename} start" run_test "/usr/bin" "/var/log/emqx" "$(dpkg -L ${EMQX_NAME} | grep emqx_vars)"
run_test
echo "running ${packagename} stop"
dpkg -r "${EMQX_NAME}" dpkg -r "${EMQX_NAME}"
if [ "$(dpkg -l |grep emqx |awk '{print $1}')" != "rc" ] if [ "$(dpkg -l | grep ${EMQX_NAME} | awk '{print $1}')" != "rc" ]
then then
echo "package remove error" echo "package remove error"
exit 1 exit 1
@ -146,6 +145,10 @@ emqx_test(){
# el8 is fine with python3 # el8 is fine with python3
true true
;; ;;
"el9")
# el9 is fine with python3
true
;;
*) *)
alternatives --list | grep python && alternatives --set python /usr/bin/python2 alternatives --list | grep python && alternatives --set python /usr/bin/python2
;; ;;
@ -161,12 +164,10 @@ emqx_test(){
exit 1 exit 1
fi fi
echo "running ${packagename} start" run_test "/usr/bin" "/var/log/emqx" "$(rpm -ql ${EMQX_NAME} | grep emqx_vars)"
run_test
echo "running ${packagename} stop"
rpm -e "${EMQX_NAME}" rpm -e "${EMQX_NAME}"
if [ "$(rpm -q emqx)" != "package emqx is not installed" ];then if [ "$(rpm -q ${EMQX_NAME})" != "package ${EMQX_NAME} is not installed" ];then
echo "package uninstall error" echo "package uninstall error"
exit 1 exit 1
fi fi
@ -175,8 +176,10 @@ emqx_test(){
} }
run_test(){ run_test(){
local bin_dir="$1"
local log_dir="$2"
local emqx_env_vars="$3"
# sed -i '/emqx_telemetry/d' /var/lib/emqx/loaded_plugins # sed -i '/emqx_telemetry/d' /var/lib/emqx/loaded_plugins
emqx_env_vars=$(dirname "$(readlink "$(command -v emqx)")")/../releases/emqx_vars
if [ -f "$emqx_env_vars" ]; if [ -f "$emqx_env_vars" ];
then then
@ -194,21 +197,21 @@ EOF
echo "Error: cannot locate emqx_vars" echo "Error: cannot locate emqx_vars"
exit 1 exit 1
fi fi
if ! emqx 'start'; then echo "running ${packagename} start"
cat /var/log/emqx/erlang.log.1 || true if ! "${bin_dir}/emqx" 'start'; then
cat /var/log/emqx/emqx.log.1 || true echo "ERROR: failed_to_start_emqx"
cat "${log_dir}/erlang.log.1" || true
cat "${log_dir}/emqx.log.1" || true
exit 1 exit 1
fi fi
"$SCRIPTS/test/emqx-smoke-test.sh" 127.0.0.1 18083 "$SCRIPTS/test/emqx-smoke-test.sh" 127.0.0.1 18083
pytest -v /paho-mqtt-testing/interoperability/test_client/V5/test_connect.py::test_basic pytest -v "${PAHO_MQTT_TESTING_PATH}"/interoperability/test_client/V5/test_connect.py::test_basic
# shellcheck disable=SC2009 # pgrep does not support Extended Regular Expressions "${bin_dir}/emqx" ping
ps -ef | grep -E '\-progname\s.+emqx\s' echo "running ${packagename} stop"
if ! emqx 'stop'; then if ! "${bin_dir}/emqx" 'stop'; then
# shellcheck disable=SC2009 # pgrep does not support Extended Regular Expressions
ps -ef | grep -E '\-progname\s.+emqx\s'
echo "ERROR: failed_to_stop_emqx_with_the_stop_command" echo "ERROR: failed_to_stop_emqx_with_the_stop_command"
cat /var/log/emqx/erlang.log.1 || true cat "${log_dir}/erlang.log.1" || true
cat /var/log/emqx/emqx.log.1 || true cat "${log_dir}/emqx.log.1" || true
exit 1 exit 1
fi fi
} }