Merge pull request #7401 from zmstone/ci-add-build-base-option-to-appup-update-script

chore: update-appup.sh always rebuild baseline
This commit is contained in:
Zaiming (Stone) Shi 2022-03-24 15:58:25 +01:00 committed by GitHub
commit d3bcc201d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 38 deletions

View File

@ -16,12 +16,14 @@ jobs:
container: emqx/build-env:${{ matrix.erl_otp }}-${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- name: Check apps version
run: ./scripts/apps-version-check.sh
- uses: actions/checkout@v2
with:
fetch-depth: 0 # need full history
- name: Check relup (ce)
if: endsWith(github.repository, 'emqx')
run: ./scripts/update-appup.sh emqx --check
- name: Check relup (ee)
if: endsWith(github.repository, 'enterprise')
run: ./scripts/update-appup.sh emqx-ee --check
- name: Check apps version
run: ./scripts/apps-version-check.sh

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
latest_release=$(git describe --abbrev=0 --tags)
latest_release=$(git describe --abbrev=0 --tags --exclude '*rc*' --exclude '*alpha*' --exclude '*beta*')
bad_app_count=0

View File

@ -16,15 +16,12 @@ cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
PROFILE="${1:-}"
case "$PROFILE" in
emqx-ee)
DIR='enterprise'
TAG_PREFIX='e'
;;
emqx)
DIR='broker'
TAG_PREFIX='v'
;;
emqx-edge)
DIR='edge'
TAG_PREFIX='v'
;;
*)
@ -34,8 +31,12 @@ case "$PROFILE" in
;;
esac
PREV_TAG="$(git describe --tag --match "${TAG_PREFIX}*" | grep -oE "${TAG_PREFIX}4\.[0-9]+\.[0-9]+")"
PREV_VERSION="${PREV_TAG#[e|v]}"
## possible tags:
## v4.3.11
## e4.3.11
## rel-v4.4.3
## rel-e4.4.3
PREV_TAG="$(git describe --tag --abbrev=0 --match "[${TAG_PREFIX}|rel-]*" --exclude '*rc*' --exclude '*alpha*' --exclude '*beta*')"
shift 1
# bash 3.2 treat empty array as unbound, so we can't use 'ESCRIPT_ARGS=()' here,
@ -74,46 +75,30 @@ if [ "${SKIP_BUILD:-}" != 'yes' ]; then
make "${PROFILE}"
fi
SYSTEM="${SYSTEM:-$(./scripts/get-distro.sh)}"
if [ -z "${ARCH:-}" ]; then
UNAME="$(uname -m)"
case "$UNAME" in
x86_64)
ARCH='amd64'
;;
aarch64)
ARCH='arm64'
;;
arm*)
ARCH='arm'
;;
esac
fi
PACKAGE_NAME="${PROFILE}-${SYSTEM}-${PREV_VERSION}-${ARCH}.zip"
DOWNLOAD_URL="https://www.emqx.com/downloads/${DIR}/v${PREV_VERSION}/${PACKAGE_NAME}"
PREV_DIR_BASE="/tmp/emqx-appup-base"
PREV_DIR_BASE="/tmp/emqx-appup-build"
mkdir -p "${PREV_DIR_BASE}"
pushd "${PREV_DIR_BASE}"
if [ ! -f "${PACKAGE_NAME}" ]; then
echo "Download: ${PACKAGE_NAME}"
curl -f -L -o "${PACKAGE_NAME}" "${DOWNLOAD_URL}"
fi
if [ ! -d "${PREV_TAG}" ]; then
unzip -q -n -d "${PREV_TAG}" "${PACKAGE_NAME}"
if [ ! -d "${PREV_TAG}" ]; then
cp -R . "${PREV_DIR_BASE}/${PREV_TAG}"
fi
pushd "${PREV_DIR_BASE}/${PREV_TAG}"
git reset --hard
git checkout "${PREV_TAG}"
make clean-all
make "$PROFILE"
popd
PREV_REL_DIR="${PREV_DIR_BASE}/${PREV_TAG}/_build/${PROFILE}/lib"
# bash 3.2 does not allow empty array, so we had to add an empty string in the ESCRIPT_ARGS array,
# this in turn makes quoting "${ESCRIPT_ARGS[@]}" problematic, hence disable SC2068 check here
# shellcheck disable=SC2068
./scripts/update_appup.escript \
--src-dirs "${SRC_DIRS}/**" \
--release-dir "_build/${PROFILE}/lib" \
--prev-release-dir "${PREV_DIR_BASE}/${PREV_TAG}/emqx/lib" \
--prev-release-dir "${PREV_REL_DIR}" \
--skip-build \
${ESCRIPT_ARGS[@]} "$PREV_VERSION"
${ESCRIPT_ARGS[@]} "$PREV_TAG"
if [ "${IS_CHECK:-}" = 'yes' ]; then
diffs="$(git diff --name-only | grep -E '\.appup\.src' || true)"