From 6ca0e635998598db0a815f7470af5e5bbd2c872e Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Fri, 25 Mar 2022 21:13:55 +0100 Subject: [PATCH 1/2] chore: fix appup update script so it can handle switch between tags --- scripts/update-appup.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/update-appup.sh b/scripts/update-appup.sh index 7c8ef1925..d21791cce 100755 --- a/scripts/update-appup.sh +++ b/scripts/update-appup.sh @@ -16,12 +16,15 @@ cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.." PROFILE="${1:-}" case "$PROFILE" in emqx-ee) + GIT_REPO='emqx/emqx-enterprise.git' TAG_PREFIX='e' ;; emqx) + GIT_REPO='emqx/emqx.git' TAG_PREFIX='v' ;; emqx-edge) + GIT_REPO='emqx/emqx.git' TAG_PREFIX='v' ;; *) @@ -36,7 +39,7 @@ esac ## 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*')" +PREV_TAG="${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, @@ -77,14 +80,17 @@ fi PREV_DIR_BASE="/tmp/emqx-appup-build" mkdir -p "${PREV_DIR_BASE}" -if [ ! -d "${PREV_TAG}" ]; then +if [ ! -d "${PREV_DIR_BASE}/${PREV_TAG}" ]; then cp -R . "${PREV_DIR_BASE}/${PREV_TAG}" fi pushd "${PREV_DIR_BASE}/${PREV_TAG}" +REMOTE="$(git remote -v | grep "${GIT_REPO}" | head -1 | awk '{print $1}')" git reset --hard -git checkout "${PREV_TAG}" +git clean -fdx +git fetch "$REMOTE" make clean-all +git checkout "${PREV_TAG}" make "$PROFILE" popd From 59fae1714beeec680af8ea725081bd80600c46f5 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Mon, 28 Mar 2022 13:53:28 +0200 Subject: [PATCH 2/2] chore: use shorter path --- scripts/update-appup.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/update-appup.sh b/scripts/update-appup.sh index d21791cce..d5f3b5407 100755 --- a/scripts/update-appup.sh +++ b/scripts/update-appup.sh @@ -78,18 +78,22 @@ if [ "${SKIP_BUILD:-}" != 'yes' ]; then make "${PROFILE}" fi -PREV_DIR_BASE="/tmp/emqx-appup-build" +PREV_DIR_BASE="/tmp/_w" mkdir -p "${PREV_DIR_BASE}" if [ ! -d "${PREV_DIR_BASE}/${PREV_TAG}" ]; then cp -R . "${PREV_DIR_BASE}/${PREV_TAG}" + # always 'yes' in CI + NEW_COPY='yes' +else + NEW_COPY='no' fi pushd "${PREV_DIR_BASE}/${PREV_TAG}" -REMOTE="$(git remote -v | grep "${GIT_REPO}" | head -1 | awk '{print $1}')" -git reset --hard +if [ "$NEW_COPY" = 'no' ]; then + REMOTE="$(git remote -v | grep "${GIT_REPO}" | head -1 | awk '{print $1}')" + git fetch "$REMOTE" +fi git clean -fdx -git fetch "$REMOTE" -make clean-all git checkout "${PREV_TAG}" make "$PROFILE" popd