From 14eb37a88c395bb0faf9e3cfe7678acc94caaa3e Mon Sep 17 00:00:00 2001 From: Lukas Gravley Date: Mon, 28 Mar 2022 13:32:04 -0500 Subject: [PATCH] adding addional command (#2711) * adding addional command * shell format --- lib/functions/detectFiles.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/functions/detectFiles.sh b/lib/functions/detectFiles.sh index 4cd79ec5..f5a0acb6 100755 --- a/lib/functions/detectFiles.sh +++ b/lib/functions/detectFiles.sh @@ -497,4 +497,35 @@ function RunAdditionalInstalls() { fi fi fi + + #################################### + # Run installs for TFLINT language # + #################################### + if [ "${VALIDATE_TERRAFORM_TFLINT}" == "true" ] && [ "${#FILE_ARRAY_TERRAFORM_TFLINT[@]}" -ne 0 ]; then + info "Detected TFLint Language files to lint." + info "Trying to install the TFLint init inside:[${WORKSPACE_PATH}]" + ######################### + # Run the build command # + ######################### + BUILD_CMD=$( + cd "${WORKSPACE_PATH}" || exit 0 + tflint --init 2>&1 + ) + + ############## + # Error code # + ############## + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ "${ERROR_CODE}" -ne 0 ]; then + # Error + warn "ERROR! Failed to run:[tflint --init] at location:[${WORKSPACE_PATH}]" + warn "BUILD_CMD:[${BUILD_CMD}]" + else + info "Successfully ran:[tflint --init] in workspace:[${WORKSPACE_PATH}]" + fi + fi }