Files
portfolio/scripts/validate-repo.sh
T

35 lines
720 B
Bash
Raw Normal View History

#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
status=0
run_check() {
local name="$1"
shift
printf '\n== %s ==\n' "$name"
if "$@"; then
printf 'OK: %s completed\n' "$name"
else
printf 'CRITICAL: %s failed\n' "$name"
status=1
fi
}
run_check "Bash" "$ROOT_DIR/scripts/check-bash.sh"
run_check "Ansible" "$ROOT_DIR/scripts/check-ansible.sh"
run_check "Docs" "$ROOT_DIR/scripts/check-docs.sh"
printf '\n== Repository summary ==\n'
if ((status == 0)); then
printf 'OK: repository validation completed with no critical failures\n'
else
printf 'CRITICAL: one or more validation checks failed\n'
fi
exit "$status"