Skip to content
Snippets Groups Projects
Commit aa148b27 authored by Andrew Newdigate's avatar Andrew Newdigate
Browse files

Merge branch 'more-explicit-tflint-failure-output' into 'main'

fix: Make tflint output clearer for humans

See merge request gitlab-com/gl-infra/common-ci-tasks!141
parents 822e15ce dadc5ecd
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -18,11 +18,15 @@ tflint:
echo "${dir} -------------------------------------------------------";
cd "${CI_PROJECT_DIR}/${dir}" || exit 1;
terraform init -backend=false -reconfigure;
tflint -c "${CI_PROJECT_DIR}/.tflint.hcl" . -f compact || touch "${CI_PROJECT_DIR}/tflint-reports/failed";
tflint -c "${CI_PROJECT_DIR}/.tflint.hcl" . -f junit > "${CI_PROJECT_DIR}/tflint-reports/${junit_file}" || touch "${CI_PROJECT_DIR}/tflint-reports/failed";
tflint -c "${CI_PROJECT_DIR}/.tflint.hcl" . -f compact || echo "${dir}" >> "${CI_PROJECT_DIR}/tflint-reports/failed";
tflint -c "${CI_PROJECT_DIR}/.tflint.hcl" . -f junit > "${CI_PROJECT_DIR}/tflint-reports/${junit_file}";
done;
# tflint-reports/failed indicates a linter failure
- if [ -f "${CI_PROJECT_DIR}/tflint-reports/failed" ]; then exit 1; fi
- if [ -f "${CI_PROJECT_DIR}/tflint-reports/failed" ]; then
echo "Failures found in:"
cat "${CI_PROJECT_DIR}/tflint-reports/failed"
exit 1
fi
after_script: |
cat <<-EOD
----------------------------------------------------------
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment