forked from travis-ci/packer-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests
executable file
·46 lines (40 loc) · 1.19 KB
/
runtests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -o errexit
set -o pipefail
unset GEM_PATH
if [[ $# -gt 1 && $1 == --env ]]; then
echo "Running isolated with env ${2}"
exec env -i HOME="${HOME}" PATH="${PATH}" \
BUNDLE_GEMFILE="${BUNDLE_GEMFILE}" \
BUNDLE_BIN_PATH="${BUNDLE_BIN_PATH}" \
BUNDLE_ORIG_PATH="${BUNDLE_ORIG_PATH}" \
RUBYLIB="${RUBYLIB}" \
RUBYOPT="${RUBYOPT}" \
TERM="${TERM}" \
LANG="${LANG}" \
bash -c "source '${2}' && \\
unset PACKER_LOG && \\
bash ${BASH_SOURCE[0]}
"
fi
for f in $(git ls-files '*.yml'); do
echo -en "$f "
./bin/yml2json <"${f}" | ./bin/json2yml &>/dev/null
if grep -q ^builders: "$f"; then
ruby -ryaml -rerb \
-e "def git_desc;'x';end;YAML.load(ERB.new(File.read('${f}')).result).fetch('description')"
echo -en "(packer validate ...) "
packer validate -except openstack -except vsphere <(bin/yml2json <"$f")
echo "\`--> ✓"
else
echo "✓"
fi
done
echo 'Running shellcheck'
git grep -l '^#!/usr/bin/env bash' | xargs shellcheck
echo 'Running shfmt'
git grep -l '^#!/usr/bin/env bash' | xargs shfmt -i 2 -w
rubocop
./run-foodcritic cookbooks
./bin/check-job-board-tags
./bin/check-image-metadata-export-import