mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcd 3.5: Install shellcheck if not installed.
Include conditional logic to install shellcheck with correct architecture. This is based on commit 4f23883 and pull request #14872. Signed-off-by: D Tripp <38776199+thedtripp@users.noreply.github.com>
This commit is contained in:
parent
dcd7f29ec9
commit
31bce64a70
1
Makefile
1
Makefile
@ -37,6 +37,7 @@ clean:
|
|||||||
rm -rf ./release
|
rm -rf ./release
|
||||||
rm -rf ./coverage/*.err ./coverage/*.out
|
rm -rf ./coverage/*.err ./coverage/*.out
|
||||||
rm -rf ./tests/e2e/default.proxy
|
rm -rf ./tests/e2e/default.proxy
|
||||||
|
rm -rf ./bin/shellcheck*
|
||||||
find ./ -name "127.0.0.1:*" -o -name "localhost:*" -o -name "*.log" -o -name "agent-*" -o -name "*.coverprofile" -o -name "testname-proxy-*" | $(XARGS)
|
find ./ -name "127.0.0.1:*" -o -name "localhost:*" -o -name "*.log" -o -name "agent-*" -o -name "*.coverprofile" -o -name "testname-proxy-*" | $(XARGS)
|
||||||
|
|
||||||
docker-clean:
|
docker-clean:
|
||||||
|
25
test.sh
25
test.sh
@ -50,6 +50,7 @@ source ./build.sh
|
|||||||
|
|
||||||
PASSES=${PASSES:-"fmt bom dep build unit"}
|
PASSES=${PASSES:-"fmt bom dep build unit"}
|
||||||
PKG=${PKG:-}
|
PKG=${PKG:-}
|
||||||
|
SHELLCHECK_VERSION=${SHELLCHECK_VERSION:-"v0.10.0"}
|
||||||
|
|
||||||
if [ -z "${GOARCH:-}" ]; then
|
if [ -z "${GOARCH:-}" ]; then
|
||||||
GOARCH=$(go env GOARCH);
|
GOARCH=$(go env GOARCH);
|
||||||
@ -393,9 +394,29 @@ function fmt_pass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function shellcheck_pass {
|
function shellcheck_pass {
|
||||||
if tool_exists "shellcheck" "https://github.com/koalaman/shellcheck#installing"; then
|
SHELLCHECK=shellcheck
|
||||||
generic_checker run shellcheck -fgcc build test scripts/*.sh ./*.sh
|
|
||||||
|
if ! tool_exists "shellcheck" "https://github.com/koalaman/shellcheck#installing"; then
|
||||||
|
log_callout "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 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
wget -qO- "$URL" | tar -xJv -C /tmp/ --strip-components=1
|
||||||
|
mkdir -p ./bin
|
||||||
|
mv /tmp/shellcheck ./bin/
|
||||||
|
SHELLCHECK=./bin/shellcheck
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running shellcheck with $SHELLCHECK"
|
||||||
|
generic_checker run ${SHELLCHECK} -fgcc build test scripts/*.sh ./*.sh
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function shellws_pass {
|
function shellws_pass {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user