Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #63 from PaulMaddox/master
Browse files Browse the repository at this point in the history
Better CloudFormation validation output in tests
  • Loading branch information
PaulMaddox authored Mar 8, 2018
2 parents cfdec67 + f5cd2c5 commit ecacd7a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/validate-templates.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
#!/bin/bash
ERROR_COUNT=0;

echo "Validating AWS CloudFormation templates..."

# Loop through the YAML templates in this repository
for TEMPLATE in $(find . -name '*.yaml'); do

# Validate the template with CloudFormation
ERRORS=$(aws cloudformation validate-template --template-body file://$TEMPLATE 2>&1 >/dev/null);

if [ "$?" -gt "0" ]; then

((ERROR_COUNT++));
echo "$TEMPLATE: $ERRORS";
echo "[fail] $TEMPLATE: $ERRORS";
else
echo "[pass] $TEMPLATE";
fi;

done;

echo "$ERROR_COUNT template validation error(s)";
if [ "$ERROR_COUNT" -gt 0 ];
then exit 1;
fi
fi

0 comments on commit ecacd7a

Please sign in to comment.