Merge pull request #7031 from zmstone/chore-rename-var-name-to-avoid-confusion

4.3 fix upgrade base package download
This commit is contained in:
Zaiming (Stone) Shi 2022-02-17 06:05:14 +01:00 committed by GitHub
commit 8f9b351da8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 18 deletions

View File

@ -18,7 +18,7 @@ RELEASE="$(grep -E "define.+EMQX_RELEASE.+${EDITION}" include/emqx_release.hrl |
git_exact_vsn() {
local tag
tag="$(git describe --tags --match "[e|v]*" --exact 2>/dev/null)"
echo "$tag" | sed 's/^[v|e]//g'
echo "${tag#[e|v]}"
}
GIT_EXACT_VSN="$(git_exact_vsn)"

View File

@ -13,4 +13,5 @@ if [ "$1" != "emqx" ]; then
BASEDIR="$1"
fi
# shellcheck disable=SC2038
find "${BASEDIR}/test/props" -name "prop_*.erl" 2>/dev/null | xargs -I{} basename {} .erl | xargs | tr ' ' ','

View File

@ -12,4 +12,5 @@ TESTDIR="test"
if [ "$1" != "emqx" ]; then
TESTDIR="$1/test"
fi
# shellcheck disable=SC2038
find "${TESTDIR}" -name "*_SUITE.erl" 2>/dev/null | xargs | tr ' ' ','

View File

@ -1,4 +1,7 @@
#!/usr/bin/env bash
## This script helps to download relup base version packages
if [[ -n "$DEBUG" ]]; then
set -x
fi
@ -6,24 +9,27 @@ set -euo pipefail
PROFILE="${1}"
if [ "$PROFILE" = "" ]; then
$PROFILE="emqx"
PROFILE="emqx"
fi
case $PROFILE in
"emqx")
DIR="broker"
DIR='broker'
EDITION='community'
;;
"emqx-ee")
DIR="enterprise"
DIR='enterprise'
EDITION='enterprise'
;;
"emqx-edge")
DIR="edge"
DIR='edge'
EDITION='edge'
;;
esac
SYSTEM="$(./scripts/get-distro.sh)"
SYSTEM="${SYSTEM:-$(./scripts/get-distro.sh)}"
ARCH="$(uname -m)"
ARCH="${ARCH:-$(uname -m)}"
case "$ARCH" in
x86_64)
ARCH='amd64'
@ -47,16 +53,18 @@ cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
mkdir -p _upgrade_base
pushd _upgrade_base
for tag in $(../scripts/relup-base-vsns.sh community | xargs echo -n); do
if [ ! -f "$PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip" ] \
&& [ ! -z "$(echo $(curl -I -m 10 -o /dev/null -s -w %{http_code} https://www.emqx.com/downloads/$DIR/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip) | grep -oE "^[23]+")" ];then
wget --no-verbose https://www.emqx.com/downloads/$DIR/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip
for tag in $(../scripts/relup-base-vsns.sh $EDITION | xargs echo -n); do
filename="$PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip"
url="https://www.emqx.com/downloads/$DIR/$tag/$filename"
echo "downloading ${filename} ..."
if [ ! -f "$filename" ] && curl -I -m 10 -o /dev/null -s -w "%{http_code}" "${url}" | grep -q -oE "^[23]+" ; then
curl -L -o "${filename}" "${url}"
if [ "$SYSTEM" != "centos6" ]; then
wget --no-verbose https://www.emqx.com/downloads/$DIR/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip.sha256
curl -L -o "${filename}.sha256" "${url}.sha256"
## https://askubuntu.com/questions/1202208/checking-sha256-checksum
echo "$(cat $PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip.sha256) $PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip" | $SHASUM -c || exit 1
echo "$(cat "${filename}.sha256") ${filename}" | $SHASUM -c || exit 1
fi
fi
done
done
popd

View File

@ -20,8 +20,8 @@ parse_semver() {
echo "$1" | tr '.|-' ' '
}
PROFILE="${1:-}"
[ -z "${PROFILE}" ] && usage
EDITION="${1:-}"
[ -z "${EDITION}" ] && usage
## Get the current release version
## e.g.
@ -49,7 +49,7 @@ else
IS_RELEASE=false
fi
case "${PROFILE}" in
case "${EDITION}" in
*enterprise*)
GIT_TAG_PREFIX="e"
;;

View File

@ -3,7 +3,11 @@
set -euo pipefail
target_files=()
while IFS='' read -r line; do target_files+=("$line"); done < <(grep -r -l --exclude-dir=.git --exclude-dir=_build "#!/bin/" .)
while IFS='' read -r line;
do
target_files+=("$line");
done < <(git grep -r -l '^#!/\(bin/\|usr/bin/env bash\)' .)
return_code=0
for i in "${target_files[@]}"; do
echo checking "$i" ...