Improve verify-errexit UX

Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
James Munnelly 2019-09-26 14:08:30 +01:00
parent 5c87f83a03
commit a725d651a5
2 changed files with 14 additions and 3 deletions

View File

@ -15,7 +15,7 @@ sh_test(
name = "verify-errexit",
srcs = ["verify-errexit.sh"],
data = [
"//:all-srcs",
"@//:all-srcs",
],
tags = ["lint"],
)

View File

@ -26,12 +26,23 @@ set -o errexit
set -o nounset
set -o pipefail
REPO_ROOT=$(dirname "${BASH_SOURCE}")/..
if [[ -n "${TEST_WORKSPACE:-}" ]]; then # Running inside bazel
echo "Validating all scripts set '-o errexit'" >&2
elif ! command -v bazel &> /dev/null; then
echo "Install bazel at https://bazel.build" >&2
exit 1
else
(
set -o xtrace
bazel test --test_output=streamed @com_github_jetstack_cert_manager//hack:verify-errexit
)
exit 0
fi
if [ "$*" != "" ]; then
args="$*"
else
args=$(ls "$REPO_ROOT" | grep -v vendor | grep -v glide | grep -v 'bazel-' )
args=$(ls "$(pwd)" | grep -v 'bazel-' | grep -v 'external/' )
fi
# Gather the list of files that appear to be shell scripts.