mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcd 3.4: Install shellcheck if not installed.
Include conditional logic to install shellcheck with correct architecture. This is based on commit 4f23883 and pull request etcd-io#14872. Signed-off-by: D Tripp <38776199+thedtripp@users.noreply.github.com>
This commit is contained in:
parent
f599316654
commit
e3c0ac0bec
1
Makefile
1
Makefile
@ -34,6 +34,7 @@ clean:
|
||||
rm -f ./integration/127.0.0.1:* ./integration/localhost:*
|
||||
rm -f ./clientv3/integration/127.0.0.1:* ./clientv3/integration/localhost:*
|
||||
rm -f ./clientv3/ordering/127.0.0.1:* ./clientv3/ordering/localhost:*
|
||||
rm -rf ./bin/shellcheck*
|
||||
|
||||
docker-clean:
|
||||
docker images
|
||||
|
26
test
26
test
@ -38,6 +38,7 @@ export ETCD_VERIFY=all
|
||||
source ./build
|
||||
|
||||
PASSES=${PASSES:-}
|
||||
SHELLCHECK_VERSION=${SHELLCHECK_VERSION:-"v0.10.0"}
|
||||
|
||||
# build before setting up test GOPATH
|
||||
if [[ "${PASSES}" == *"functional"* ]]; then
|
||||
@ -397,12 +398,33 @@ function release_pass {
|
||||
}
|
||||
|
||||
function shellcheck_pass {
|
||||
if command -v shellcheck >/dev/null; then
|
||||
shellcheckResult=$(shellcheck -fgcc build test scripts/*.sh 2>&1 || true)
|
||||
SHELLCHECK=shellcheck
|
||||
|
||||
if ! command -v $SHELLCHECK >/dev/null; then
|
||||
echo "Installing shellcheck $SHELLCHECK_VERSION"
|
||||
if [ "$GOARCH" == "amd64" ]; then
|
||||
URL="https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz"
|
||||
elif [[ "$GOARCH" == "arm" || "$GOARCH" == "arm64" ]]; then
|
||||
URL="https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.aarch64.tar.xz"
|
||||
else
|
||||
echo "Unsupported architecture: $GOARCH"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
wget -qO- "$URL" | tar -xJv -C /tmp/ --strip-components=1
|
||||
mkdir -p ./bin
|
||||
mv /tmp/shellcheck ./bin/
|
||||
SHELLCHECK=./bin/shellcheck
|
||||
fi
|
||||
|
||||
if command -v $SHELLCHECK >/dev/null; then
|
||||
shellcheckResult=$(${SHELLCHECK} -fgcc build test scripts/*.sh 2>&1 || true)
|
||||
if [ -n "${shellcheckResult}" ]; then
|
||||
echo -e "shellcheck checking failed:\\n${shellcheckResult}"
|
||||
exit 255
|
||||
fi
|
||||
else
|
||||
echo "Skipping shellcheck..."
|
||||
fi
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user