2020-10-25 03:20:37 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2022-12-01 01:21:48 +08:00
|
|
|
SCRIPT_DIR="$( pwd; )/$( dirname -- $0; )"
|
2023-09-29 22:43:55 +08:00
|
|
|
cd "${SCRIPT_DIR}"
|
2023-02-09 16:02:28 +08:00
|
|
|
FIND="find"
|
2023-09-29 22:43:55 +08:00
|
|
|
|
|
|
|
mkdir -p fixtures
|
2023-02-09 16:02:28 +08:00
|
|
|
# Brew installs GNU find as "gfind" by default
|
|
|
|
if command -v gfind >/dev/null 2>&2; then
|
|
|
|
FIND="$(which gfind)"
|
|
|
|
fi
|
|
|
|
|
2023-10-27 16:49:00 +08:00
|
|
|
do_the_test() {
|
|
|
|
local i="${1}"
|
2020-10-25 03:20:37 +08:00
|
|
|
echo "☆☆☆☆☆☆☆☆☆☆ $i ☆☆☆☆☆☆☆☆☆☆"
|
2020-11-03 18:51:51 +08:00
|
|
|
helm template -f $i --dry-run mail > fixtures/demo.yaml
|
2022-12-01 01:21:48 +08:00
|
|
|
docker run \
|
|
|
|
-v "${SCRIPT_DIR}/fixtures:/fixtures" \
|
|
|
|
-v "${SCRIPT_DIR}/schemas:/schemas" \
|
|
|
|
garethr/kubeval \
|
2023-09-29 22:50:21 +08:00
|
|
|
--force-color \
|
2022-12-01 01:21:48 +08:00
|
|
|
--additional-schema-locations file:///schemas \
|
|
|
|
fixtures/demo.yaml
|
2023-10-27 16:49:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if [[ $# -gt 0 ]]; then
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
do_the_test "${1}"
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
else
|
|
|
|
for i in `${FIND} -maxdepth 1 -type f -name test\*yml | sort`; do
|
|
|
|
do_the_test "${i}"
|
|
|
|
done
|
|
|
|
fi
|