merged against github

pull/2/head
Hari Sekhon 7 years ago
commit 7f7fc65e56

@ -21,7 +21,7 @@ srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# NFS issues sometimes cause scripts to rewritten from vim without executable bit set, which then gets committed to git by accident
section "Find Non Executable Scripts"
section "Finding Non Executable Scripts"
script_extensions="
sh
@ -30,23 +30,23 @@ pl
rb
"
name_opt=""
ext_regex=""
for ext in $script_extensions; do
name_opt="$name_opt -o -name '*.$ext'"
ext_regex="$ext_regex|\.$ext"
done
name_opt="${name_opt# -o }"
ext_regex="(${ext_regex#|})$"
set +o pipefail
# -executable switch not available on Mac
if ! is_linux; then
echo "Non-Linux system detected, skipping as find perm behaviour is broken on Mac"
return 0 &>/dev/null || :
exit 0
fi
# trying to build up successive -name options doesn't work and ruins the logic of find, simplify to grep
non_executable_scripts="$(eval find "${1:-.}" -maxdepth 2 -type f -not -perm -u+x | egrep "$ext_regex" | grep -v '/\.' | tee /dev/stderr)"
set -o pipefail
non_executable_scripts="$(eval find "${1:-.}" -maxdepth 2 -not -perm -500 -type f $name_opt)"
if [ -n "$non_executable_scripts" ]; then
echo
echo 'Non-executable scripts detected!'
echo
if [ -z "$non_executable_scripts" ]; then
echo "OK: no non-executable scripts detected"
exit 0
else
echo 'FAILED: non-executable scripts detected!'
exit 1
fi

@ -28,15 +28,18 @@ fi
section "PyTools Checks"
# must be up here before skipping check so that Dockerfiles can import it
export PATH="$PATH:$srcdir/pytools_checks:$srcdir/../pytools"
start_time="$(start_timer)"
skip_checks=0
if [ "$PROJECT" = "pytools" ]; then
echo "detected running in pytools repo, skipping checks here as will be called in bash-tools/all.sh..."
skip_checks=1
elif [ "$PROJECT" = "Dockerfiles" ]; then
echo "detected running in Dockerfiles repo, skipping checks here as will be called in bash-tools/all.sh..."
skip_checks=1
#elif [ "$PROJECT" = "Dockerfiles" ]; then
# echo "detected running in Dockerfiles repo, skipping checks here as will be called in bash-tools/all.sh..."
# skip_checks=1
elif is_inside_docker; then
echo "detected running inside Docker, skipping pytools checks"
skip_checks=1
@ -47,8 +50,6 @@ if [ $skip_checks = 1 ]; then
exit 0
fi
export PATH="$PATH:$srcdir/pytools_checks:$srcdir/../pytools"
echo -n "running on branch: "
git branch | grep ^*
echo

@ -417,6 +417,7 @@ when_url_content(){
local max_secs="$1"
local url="$2"
local expected_regex="$3"
local args="${@:4}"
local retry_interval=1
if [ -z "$max_secs" ]; then
echo 'when_url_content: max_secs $1 not set'
@ -442,7 +443,7 @@ when_url_content(){
while [ "$SECONDS" -lt "$max_secs" ]; do
let try_number+=1
timestamp "$try_number trying $url"
if curl -sL --connect-timeout 1 --max-time 5 "$url" | grep -q -- "$expected_regex"; then
if curl -skL --connect-timeout 1 --max-time 5 ${args:-} "$url" | grep -q -- "$expected_regex"; then
echo "URL content detected '$expected_regex'"
found=1
break

Loading…
Cancel
Save