-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathci.sh
executable file
·37 lines (32 loc) · 990 Bytes
/
ci.sh
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
#!/usr/bin/env bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'
# Credit to Stack Overflow questioner Jiarro and answerer Dave Dopson
# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
# http://stackoverflow.com/a/246128/424301
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Returns all variants of CF templates
function search_cf_files () {
find "${DIR}"/* \
-type f \
\( \
-iname '*.cf' \
-o \
-iname 'template.*.yaml' \
-o \
-iname '*.cf.yaml' \
-o \
-iname 'template.*.json' \
-o \
-iname '*.cf.json' \
\)
}
# Search for all CF files within the repo
CF_TEMPLATES=$(search_cf_files)
for i in $CF_TEMPLATES ; do
echo "Testing: $i";
aws cloudformation validate-template \
--template-body "file://$i" \
> /dev/null ;
done