Created
February 7, 2023 15:40
-
-
Save artem-hatchenko/bf7445654395f4e9bbf30a3a01ef2731 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generating a summary for a $MODULES_OUTPUT file | |
ENVIRONMENT_STAT="$(cat $ENVIRONMENT_OUTPUT | grep -v -e '^$' | grep -v -P '^[0-9]+\ +issue\(s\)\ +found:' | grep -v -P '^(ENVIRONMENT: .[a-zA-Z]+.*)' | wc -l)" | |
if [[ -f "$MODULES_OUTPUT" ]] | |
then | |
MODULE_STAT="$(cat $MODULES_OUTPUT | grep -v -e '^$' | grep -v -P '^[0-9]+\ +issue\(s\)\ +found:' | grep -v -P '^(MODULE: .\/[a-z0-9]+.*)' | wc -l)" | |
else | |
MODULE_STAT="0" | |
fi | |
echo -e "\n\n\n" | |
echo -e "TFLINT SUMMARY" | |
echo -e "\nEnvironment total: $ENVIRONMENT_STAT issue(s)" | |
echo -e "\nModules total: $MODULE_STAT issue(s)" | tee -a $MODULES_OUTPUT | |
echo -e "\n\n" | |
if [[ "$ENVIRONMENT_STAT" == "0" && "$MODULE_STAT" == "0" ]] | |
then | |
echo "TFLINT CHECK: PASS" | |
exit 0 | |
else | |
echo "TFLINT CHECK: FAIL" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment