From 8161414bef3d774d2081bd66922710b892a5dede Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Thu, 30 Jul 2020 14:15:42 -0500 Subject: [PATCH] Use log functions for all output --- .automation/cleanup-docker.sh | 68 ++++---- .../templates/ghe-config-apply.sh | 20 +-- .automation/upload-docker.sh | 112 ++++++------- Dockerfile | 2 + lib/buildFileList.sh | 42 +++-- lib/linter.sh | 147 +++++++++--------- lib/log.sh | 6 +- lib/validation.sh | 42 +++-- lib/worker.sh | 94 +++++------ 9 files changed, 258 insertions(+), 275 deletions(-) diff --git a/.automation/cleanup-docker.sh b/.automation/cleanup-docker.sh index 028a8aa6..12d29c4b 100755 --- a/.automation/cleanup-docker.sh +++ b/.automation/cleanup-docker.sh @@ -29,11 +29,11 @@ DOCKERFILE_PATH="${DOCKERFILE_PATH}" # Path to the Dockerfile to be uploaded ################################################################################ #### Function Header ########################################################### Header() { - echo "" - echo "-------------------------------------------------------" - echo "----- GitHub Actions remove image from DockerHub ------" - echo "-------------------------------------------------------" - echo "" + echo + info "-------------------------------------------------------" + info "----- GitHub Actions remove image from DockerHub ------" + info "-------------------------------------------------------" + echo } ################################################################################ #### Function ValidateInput #################################################### @@ -42,11 +42,11 @@ ValidateInput() { ################ # Print header # ################ - echo "" - echo "----------------------------------------------" - echo "Gathering variables..." - echo "----------------------------------------------" - echo "" + echo + info "----------------------------------------------" + info "Gathering variables..." + info "----------------------------------------------" + echo ############################ # Validate GITHUB_WORKSPACE # @@ -55,7 +55,7 @@ ValidateInput() { error "Failed to get [GITHUB_WORKSPACE]!" fatal "[${GITHUB_WORKSPACE}]" else - echo "Successfully found:[GITHUB_WORKSPACE], value:[${GITHUB_WORKSPACE}]" + info "Successfully found:[GITHUB_WORKSPACE], value:[${GITHUB_WORKSPACE}]" fi ####################### @@ -67,10 +67,10 @@ ValidateInput() { fatal "[${IMAGE_REPO}]" elif [[ ${IMAGE_REPO} == "github/super-linter" ]]; then # Found our main repo - echo "Successfully found:[IMAGE_REPO], value:[${IMAGE_REPO}]" + info "Successfully found:[IMAGE_REPO], value:[${IMAGE_REPO}]" else # This is a fork and we cant pull vars or any info - warn "No image to cleanup as this is a forked branch, and not being built with current automation!${NC}" + warn "No image to cleanup as this is a forked branch, and not being built with current automation!" exit 0 fi @@ -81,7 +81,7 @@ ValidateInput() { error "Failed to get [IMAGE_VERSION]!" fatal "[${IMAGE_VERSION}]" else - echo "Successfully found:[IMAGE_VERSION], value:[${IMAGE_VERSION}]" + info "Successfully found:[IMAGE_VERSION], value:[${IMAGE_VERSION}]" fi ############################ @@ -91,7 +91,7 @@ ValidateInput() { error "Failed to get [DOCKER_USERNAME]!" fatal "[${DOCKER_USERNAME}]" else - echo "Successfully found:[DOCKER_USERNAME], value:[${DOCKER_USERNAME}]" + info "Successfully found:[DOCKER_USERNAME], value:[${DOCKER_USERNAME}]" fi ############################ @@ -101,7 +101,7 @@ ValidateInput() { error "Failed to get [DOCKER_PASSWORD]!" fatal "[${DOCKER_PASSWORD}]" else - echo "Successfully found:[DOCKER_PASSWORD], value:[********]" + info "Successfully found:[DOCKER_PASSWORD], value:[********]" fi ################################################## @@ -127,11 +127,11 @@ LoginToDocker() { ################ # Print header # ################ - echo "" - echo "----------------------------------------------" - echo "Login to DockerHub..." - echo "----------------------------------------------" - echo "" + echo + info "----------------------------------------------" + info "Login to DockerHub..." + info "----------------------------------------------" + echo ###################### # Login to DockerHub # @@ -152,7 +152,7 @@ LoginToDocker() { fatal "[${LOGIN_CMD}]" else # SUCCESS - echo "Successfully authenticated to DockerHub!" + info "Successfully authenticated to DockerHub!" fi } ################################################################################ @@ -161,11 +161,11 @@ RemoveImage() { ################ # Print header # ################ - echo "" - echo "----------------------------------------------" - echo "Removing the DockerFile image:[${IMAGE_REPO}:${IMAGE_VERSION}]" - echo "----------------------------------------------" - echo "" + echo + info "----------------------------------------------" + info "Removing the DockerFile image:[${IMAGE_REPO}:${IMAGE_VERSION}]" + info "----------------------------------------------" + echo ##################################### # Create Token to auth to DockerHub # @@ -190,7 +190,7 @@ RemoveImage() { fatal "[${TOKEN}]" else # SUCCESS - echo "Successfully gained auth token from DockerHub!" + info "Successfully gained auth token from DockerHub!" fi ################################# @@ -214,17 +214,17 @@ RemoveImage() { fatal "[${REMOVE_CMD}]" else # SUCCESS - echo "Successfully [removed] Docker image tag:[${IMAGE_VERSION}] from DockerHub!" + info "Successfully [removed] Docker image tag:[${IMAGE_VERSION}] from DockerHub!" fi } ################################################################################ #### Function Footer ########################################################### Footer() { - echo "" - echo "-------------------------------------------------------" - echo "The step has completed" - echo "-------------------------------------------------------" - echo "" + echo + info "-------------------------------------------------------" + info "The step has completed" + info "-------------------------------------------------------" + echo } ################################################################################ ################################## MAIN ######################################## diff --git a/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh b/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh index 9258978b..c7370032 100644 --- a/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh +++ b/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh @@ -28,17 +28,17 @@ CheckGHEPid() ################################## if [ ${PID_CHECK} -gt ${PID_CHECK_LIMIT} ]; then # Over the limit, move on - echo "We have checked the pid ${PID_CHECK} times, moving on..." + info "We have checked the pid ${PID_CHECK} times, moving on..." else ################################################ # Check to see if the PID is alive and running # ################################################ if [ ! -f "${GHE_CONFIG_PID}" ]; then # File not found - echo "We're good to move forward, no .pid file found at:[${GHE_CONFIG_PID}]" + info "We're good to move forward, no .pid file found at:[${GHE_CONFIG_PID}]" else # Found the pid running, need to sleep - echo "Current PID found, sleeping ${SLEEP_SECONDS} seconds before next check..." + info "Current PID found, sleeping ${SLEEP_SECONDS} seconds before next check..." ################ # Sleep it off # ################ @@ -55,7 +55,7 @@ CheckGHEPid() if [ ${ERROR_CODE} -ne 0 ]; then error "Failed to sleep!" error "[${SLEEP_CMD}]" - echo "Will try to call apply as last effort..." + info "Will try to call apply as last effort..." #################################### # Call config apply as last effort # #################################### @@ -82,7 +82,7 @@ CheckGHEProcess() ################################## if [ ${PROCESS_CHECK} -gt ${PROCESS_CHECK_LIMIT} ]; then # Over the limit, move on - echo "We have checked the process ${PROCESS_CHECK} times, moving on..." + info "We have checked the process ${PROCESS_CHECK} times, moving on..." else #################################################### # Check to see if the process is alive and running # @@ -99,10 +99,10 @@ CheckGHEProcess() ############################## if [ ${ERROR_CODE} -ne 0 ]; then # No process running on the system - echo "Were good to move forward, no process like:[${GHE_APPLY_COMMAND}] running currently on the system" + info "Were good to move forward, no process like:[${GHE_APPLY_COMMAND}] running currently on the system" else # Found the process running, need to sleep - echo "Current process alive:[${CHECK_PROCESS_CMD}], sleeping ${SLEEP_SECONDS} seconds before next check..." + info "Current process alive:[${CHECK_PROCESS_CMD}], sleeping ${SLEEP_SECONDS} seconds before next check..." ################ # Sleep it off # ################ @@ -119,7 +119,7 @@ CheckGHEProcess() if [ ${ERROR_CODE} -ne 0 ]; then error "Failed to sleep!" error "[${SLEEP_CMD}]" - echo "Will try to call apply as last effort..." + info "Will try to call apply as last effort..." #################################### # Call config apply as last effort # #################################### @@ -144,7 +144,7 @@ RunConfigApply() ########## # Header # ########## - echo "Running ${GHE_APPLY_COMMAND} to the server..." + info "Running ${GHE_APPLY_COMMAND} to the server..." ############################################## # Run the command to apply changes to server # @@ -165,7 +165,7 @@ RunConfigApply() fatal "[${APPLY_CMD}]" else # Success - notice "Successfully ran ${F[C]}${GHE_APPLY_COMMAND}${NC}" + info "Successfully ran ${F[C]}${GHE_APPLY_COMMAND}" fi } ################################################################################ diff --git a/.automation/upload-docker.sh b/.automation/upload-docker.sh index bbb1bae7..bac7f3e8 100755 --- a/.automation/upload-docker.sh +++ b/.automation/upload-docker.sh @@ -35,11 +35,11 @@ UPDATE_MAJOR_TAG=0 # Flag to deploy the major tag version as ################################################################################ #### Function Header ########################################################### Header() { - echo "" - echo "-------------------------------------------------------" - echo "---- GitHub Actions Upload image to [${REGISTRY}] ----" - echo "-------------------------------------------------------" - echo "" + echo + info "-------------------------------------------------------" + info "---- GitHub Actions Upload image to [${REGISTRY}] ----" + info "-------------------------------------------------------" + echo } ################################################################################ #### Function ValidateInput #################################################### @@ -48,11 +48,11 @@ ValidateInput() { ################ # Print header # ################ - echo "" - echo "----------------------------------------------" - echo "Gathering variables..." - echo "----------------------------------------------" - echo "" + echo + info "----------------------------------------------" + info "Gathering variables..." + info "----------------------------------------------" + echo ############################# # Validate GITHUB_WORKSPACE # @@ -61,7 +61,7 @@ ValidateInput() { error "Failed to get [GITHUB_WORKSPACE]!" fatal "[${GITHUB_WORKSPACE}]" else - notice "Successfully found:${F[W]}[GITHUB_WORKSPACE]${F[B]}, value:${F[W]}[${GITHUB_WORKSPACE}]${NC}" + info "Successfully found:${F[W]}[GITHUB_WORKSPACE]${F[B]}, value:${F[W]}[${GITHUB_WORKSPACE}]" fi ##################### @@ -71,7 +71,7 @@ ValidateInput() { error "Failed to get [REGISTRY]!" fatal "[${REGISTRY}]" else - notice "Successfully found:${F[W]}[REGISTRY]${F[B]}, value:${F[W]}[${REGISTRY}]${NC}" + info "Successfully found:${F[W]}[REGISTRY]${F[B]}, value:${F[W]}[${REGISTRY}]" fi ##################################################### @@ -85,7 +85,7 @@ ValidateInput() { error "Failed to get [GPR_USERNAME]!" fatal "[${GPR_USERNAME}]" else - notice "Successfully found:${F[W]}[GPR_USERNAME]${F[B]}, value:${F[W]}[${GPR_USERNAME}]${NC}" + info "Successfully found:${F[W]}[GPR_USERNAME]${F[B]}, value:${F[W]}[${GPR_USERNAME}]" fi ###################### @@ -95,7 +95,7 @@ ValidateInput() { error "Failed to get [GPR_TOKEN]!" fatal "[${GPR_TOKEN}]" else - notice "Successfully found:${F[W]}[GPR_TOKEN]${F[B]}, value:${F[W]}[********]${NC}" + info "Successfully found:${F[W]}[GPR_TOKEN]${F[B]}, value:${F[W]}[********]" fi ######################################## # See if we need values for Ducker hub # @@ -108,7 +108,7 @@ ValidateInput() { error "Failed to get [DOCKER_USERNAME]!" fatal "[${DOCKER_USERNAME}]" else - notice "Successfully found:${F[W]}[DOCKER_USERNAME]${F[B]}, value:${F[W]}[${DOCKER_USERNAME}]${NC}" + info "Successfully found:${F[W]}[DOCKER_USERNAME]${F[B]}, value:${F[W]}[${DOCKER_USERNAME}]" fi ############################ @@ -118,7 +118,7 @@ ValidateInput() { error "Failed to get [DOCKER_PASSWORD]!" fatal "[${DOCKER_PASSWORD}]" else - notice "Successfully found:${F[W]}[DOCKER_PASSWORD]${F[B]}, value:${F[B]}[********]${NC}" + info "Successfully found:${F[W]}[DOCKER_PASSWORD]${F[B]}, value:${F[B]}[********]" fi ########################################### # We were not passed a registry to update # @@ -135,14 +135,14 @@ ValidateInput() { error "Failed to get [IMAGE_REPO]!" fatal "[${IMAGE_REPO}]" else - notice "Successfully found:${F[W]}[IMAGE_REPO]${F[B]}, value:${F[W]}[${IMAGE_REPO}]${NC}" + info "Successfully found:${F[W]}[IMAGE_REPO]${F[B]}, value:${F[W]}[${IMAGE_REPO}]" ############################################### # Need to see if GPR registry and update name # ############################################### if [[ ${REGISTRY} == "GPR" ]]; then NAME="docker.pkg.github.com/${IMAGE_REPO}/super-linter" IMAGE_REPO="${NAME}" - echo "Updated [IMAGE_REPO] to:[${IMAGE_REPO}] for GPR" + info "Updated [IMAGE_REPO] to:[${IMAGE_REPO}] for GPR" fi fi @@ -150,8 +150,8 @@ ValidateInput() { # Validate IMAGE_VERSION # ########################## if [ -z "${IMAGE_VERSION}" ]; then - warn "Failed to get [IMAGE_VERSION]!${NC}" - echo "Pulling from Branch Name..." + warn "Failed to get [IMAGE_VERSION]!" + info "Pulling from Branch Name..." ############################## # Get the name of the branch # ############################## @@ -179,9 +179,9 @@ ValidateInput() { # Set the IMAGE_VERSION to the BRANCH_NAME # ############################################ IMAGE_VERSION="${BRANCH_NAME}" - echo "Tag:[${IMAGE_VERSION}]" + info "Tag:[${IMAGE_VERSION}]" else - notice "Successfully found:${F[W]}[IMAGE_VERSION]${F[B]}, value:${F[W]}[${IMAGE_VERSION}]${NC}" + info "Successfully found:${F[W]}[IMAGE_VERSION]${F[B]}, value:${F[W]}[${IMAGE_VERSION}]" fi ################################## @@ -205,7 +205,7 @@ ValidateInput() { ################################### UPDATE_MAJOR_TAG=1 - echo "- Also deploying a major tag of:[${MAJOR_TAG}]" + info "- Also deploying a major tag of:[${MAJOR_TAG}]" fi ############################ @@ -215,7 +215,7 @@ ValidateInput() { error "Failed to get [DOCKERFILE_PATH]!" fatal "[${DOCKERFILE_PATH}]" else - notice "Successfully found:${F[W]}[DOCKERFILE_PATH]${F[B]}, value:${F[W]}[${DOCKERFILE_PATH}]${NC}" + info "Successfully found:${F[W]}[DOCKERFILE_PATH]${F[B]}, value:${F[W]}[${DOCKERFILE_PATH}]" fi } ################################################################################ @@ -232,11 +232,11 @@ Authenticate() { ################ # Print header # ################ - echo "" - echo "----------------------------------------------" - echo "Login to ${NAME}..." - echo "----------------------------------------------" - echo "" + echo + info "----------------------------------------------" + info "Login to ${NAME}..." + info "----------------------------------------------" + echo ################### # Auth to service # @@ -257,7 +257,7 @@ Authenticate() { fatal "[${LOGIN_CMD}]" fatal else # SUCCESS - notice "Successfully authenticated to ${F[C]}${NAME}${F[B]}!${NC}" + info "Successfully authenticated to ${F[C]}${NAME}${F[B]}!" fi } ################################################################################ @@ -266,11 +266,11 @@ BuildImage() { ################ # Print header # ################ - echo "" - echo "----------------------------------------------" - echo "Building the DockerFile image..." - echo "----------------------------------------------" - echo "" + echo + info "----------------------------------------------" + info "Building the DockerFile image..." + info "----------------------------------------------" + echo ################################ # Validate the DOCKERFILE_PATH # @@ -300,7 +300,7 @@ BuildImage() { fatal "failed to [build] Dockerfile!" else # SUCCESS - notice "Successfully Built image!${NC}" + info "Successfully Built image!" fi ######################################################## @@ -323,7 +323,7 @@ BuildImage() { fatal "failed to [tag] Dockerfile!" else # SUCCESS - notice "Successfully tagged image!${NC}" + info "Successfully tagged image!" fi fi } @@ -333,11 +333,11 @@ UploadImage() { ################ # Print header # ################ - echo "" - echo "----------------------------------------------" - echo "Uploading the DockerFile image to ${REGISTRY}..." - echo "----------------------------------------------" - echo "" + echo + info "----------------------------------------------" + info "Uploading the DockerFile image to ${REGISTRY}..." + info "----------------------------------------------" + echo ############################################ # Upload the docker image that was created # @@ -357,7 +357,7 @@ UploadImage() { fatal "failed to [upload] Dockerfile!" else # SUCCESS - notice "Successfully Uploaded Docker image:${F[W]}[${IMAGE_VERSION}]${F[B]} to ${F[C]}${REGISTRY}${F[B]}!${NC}" + info "Successfully Uploaded Docker image:${F[W]}[${IMAGE_VERSION}]${F[B]} to ${F[C]}${REGISTRY}${F[B]}!" fi ######################### @@ -390,13 +390,13 @@ UploadImage() { ################### # Print the goods # ################### - echo "----------------------------------------------" - echo "Docker Image Details:" - echo "Repository:[${REPO}]" - echo "Tag:[${TAG}]" - echo "Image_ID:[${IMAGE_ID}]" - echo "Size:[${SIZE}]" - echo "----------------------------------------------" + info "----------------------------------------------" + info "Docker Image Details:" + info "Repository:[${REPO}]" + info "Tag:[${TAG}]" + info "Image_ID:[${IMAGE_ID}]" + info "Size:[${SIZE}]" + info "----------------------------------------------" fi ############################################################### @@ -421,18 +421,18 @@ UploadImage() { fatal "failed to [upload] MAJOR_TAG:[${MAJOR_TAG}] Dockerfile!" else # SUCCESS - notice "Successfully Uploaded TAG:${F[W]}[${MAJOR_TAG}]${F[B]} of Docker image to ${F[C]}${REGISTRY}${F[B]}!${NC}" + info "Successfully Uploaded TAG:${F[W]}[${MAJOR_TAG}]${F[B]} of Docker image to ${F[C]}${REGISTRY}${F[B]}!" fi fi } ################################################################################ #### Function Footer ########################################################### Footer() { - echo "" - echo "-------------------------------------------------------" - echo "The step has completed" - echo "-------------------------------------------------------" - echo "" + echo + info "-------------------------------------------------------" + info "The step has completed" + info "-------------------------------------------------------" + echo } ################################################################################ ################################## MAIN ######################################## diff --git a/Dockerfile b/Dockerfile index e50a42bf..3533b1d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -228,6 +228,8 @@ ENV ACTIONS_RUNNER_DEBUG=${ACTIONS_RUNNER_DEBUG} \ GITHUB_TOKEN=${GITHUB_TOKEN} \ GITHUB_WORKSPACE=${GITHUB_WORKSPACE} \ LINTER_RULES_PATH=${LINTER_RULES_PATH} \ + LOG_FILE=${LOG_FILE} \ + LOG_LEVEL=${LOG_LEVEL} \ OUTPUT_DETAILS=${OUTPUT_DETAILS} \ OUTPUT_FOLDER=${OUTPUT_FOLDER} \ OUTPUT_FORMAT=${OUTPUT_FORMAT} \ diff --git a/lib/buildFileList.sh b/lib/buildFileList.sh index 4a64eea3..ccd47747 100755 --- a/lib/buildFileList.sh +++ b/lib/buildFileList.sh @@ -16,11 +16,8 @@ function BuildFileList() { ################ # print header # ################ - if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then - echo "" - echo "----------------------------------------------" - echo "Pulling in code history and branches..." - fi + debug "----------------------------------------------" + debug "Pulling in code history and branches..." ################################################################################# # Switch codebase back to the default branch to get a list of all files changed # @@ -40,18 +37,15 @@ function BuildFileList() { ############################## if [ ${ERROR_CODE} -ne 0 ]; then # Error - echo "Failed to switch to ${DEFAULT_BRANCH} branch to get files changed!" + info "Failed to switch to ${DEFAULT_BRANCH} branch to get files changed!" fatal "[${SWITCH_CMD}]" fi ################ # print header # ################ - if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then - echo "" - echo "----------------------------------------------" - echo "Generating Diff with:[git diff --name-only '${DEFAULT_BRANCH}..${GITHUB_SHA}' --diff-filter=d]" - fi + debug "----------------------------------------------" + debug "Generating Diff with:[git diff --name-only '${DEFAULT_BRANCH}..${GITHUB_SHA}' --diff-filter=d]" ################################################# # Get the Array of files changed in the commits # @@ -75,9 +69,9 @@ function BuildFileList() { ################################################ # Iterate through the array of all files found # ################################################ - echo "" - echo "----------------------------------------------" - echo "Files that have been modified in the commit(s):" + echo + info "----------------------------------------------" + info "Files that have been modified in the commit(s):" for FILE in "${RAW_FILE_ARRAY[@]}"; do ########################### # Get the files extension # @@ -90,12 +84,12 @@ function BuildFileList() { ############## # Print file # ############## - echo "File:[${FILE}], File_type:[${FILE_TYPE}]" + info "File:[${FILE}], File_type:[${FILE_TYPE}]" ######### # DEBUG # ######### - #echo "FILE_TYPE:[${FILE_TYPE}]" + debug "FILE_TYPE:[${FILE_TYPE}]" ################################ # Get the CLOUDFORMATION files # @@ -472,8 +466,8 @@ function BuildFileList() { ####################### # It is a bash script # ####################### - warn "Found bash script without extension:[.sh]${NC}" - echo "Please update file with proper extensions." + warn "Found bash script without extension:[.sh]" + info "Please update file with proper extensions." ################################ # Append the file to the array # ################################ @@ -486,8 +480,8 @@ function BuildFileList() { ####################### # It is a Ruby script # ####################### - warn "Found ruby script without extension:[.rb]${NC}" - echo "Please update file with proper extensions." + warn "Found ruby script without extension:[.rb]" + info "Please update file with proper extensions." ################################ # Append the file to the array # ################################ @@ -500,7 +494,7 @@ function BuildFileList() { ############################ # Extension was not found! # ############################ - warn "Failed to get filetype for:[${FILE}]!${NC}" + warn "Failed to get filetype for:[${FILE}]!" ########################################################## # Set the READ_ONLY_CHANGE_FLAG since this could be exec # ########################################################## @@ -533,7 +527,7 @@ function BuildFileList() { ################ # Footer print # ################ - echo "" - echo "----------------------------------------------" - notice "Successfully gathered list of files...${NC}" + echo + info "----------------------------------------------" + info "Successfully gathered list of files..." } diff --git a/lib/linter.sh b/lib/linter.sh index bb9928cc..f94dd7bc 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -137,6 +137,8 @@ GITHUB_RUN_ID="${GITHUB_RUN_ID}" # GitHub GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit GITHUB_TOKEN="${GITHUB_TOKEN}" # GitHub Token passed from environment GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace +LOG_FILE="${LOG_FILE:-super-linter.log}" # Default log file name (located in GITHUB_WORKSPACE folder) +LOG_LEVEL="${LOG_LEVEL:-VERBOSE}" # Default log level (VERBOSE, DEBUG, TRACE) MULTI_STATUS="${MULTI_STATUS:-true}" # Multiple status are created for each check ran TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files @@ -185,6 +187,16 @@ VALIDATE_YAML="${VALIDATE_YAML}" # Boolean RUN_LOCAL="${RUN_LOCAL}" # Boolean to see if we are running locally ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG:-false}" # Boolean to see even more info (debug) +############ +# Log Vars # +############ +LOG_TRACE=$(if [[ ${LOG_LEVEL} == "TRACE" ]]; then echo "true";fi) # Boolean to see trace logs +export LOG_TRACE +LOG_DEBUG=$(if [[ ${LOG_LEVEL} == "DEBUG" || ${ACTIONS_RUNNER_DEBUG} == true ]]; then echo "true";fi) # Boolean to see debug logs +export LOG_DEBUG +LOG_VERBOSE=$(if [[ ${LOG_LEVEL} == "VERBOSE" ]]; then echo "true";fi) # Boolean to see verbose logs (info function) +export LOG_VERBOSE + ################ # Default Vars # ################ @@ -352,15 +364,15 @@ Header() { ########## # Prints # ########## - echo "" - echo "---------------------------------------------" - echo "--- GitHub Actions Multi Language Linter ----" - echo "---------------------------------------------" - echo "" - echo "---------------------------------------------" - echo "The Super-Linter source code can be found at:" - echo " - https://github.com/github/super-linter" - echo "---------------------------------------------" + echo + info "---------------------------------------------" + info "--- GitHub Actions Multi Language Linter ----" + info "---------------------------------------------" + echo + info "---------------------------------------------" + info "The Super-Linter source code can be found at:" + info " - https://github.com/github/super-linter" + info "---------------------------------------------" } ################################################################################ #### Function GetLinterVersions ################################################ @@ -368,9 +380,8 @@ GetLinterVersions() { ######################### # Print version headers # ######################### - echo "" - echo "---------------------------------------------" - echo "Linter Version Info:" + debug "---------------------------------------------" + debug "Linter Version Info:" ########################################################## # Go through the array of linters and print version info # @@ -399,20 +410,19 @@ GetLinterVersions() { # Check the shell for errors # ############################## if [ ${ERROR_CODE} -ne 0 ] || [ -z "${GET_VERSION_CMD[*]}" ]; then - warn "[${LINTER}]: Failed to get version info for:${NC}" + warn "[${LINTER}]: Failed to get version info for:" else ########################## # Print the version info # ########################## - notice "Successfully found version for ${F[W]}[${LINTER}]${F[B]}: ${F[W]}${GET_VERSION_CMD[*]}${NC}" + debug "Successfully found version for ${F[W]}[${LINTER}]${F[B]}: ${F[W]}${GET_VERSION_CMD[*]}" fi done ######################### # Print version footers # ######################### - echo "---------------------------------------------" - echo "" + debug "---------------------------------------------" } ################################################################################ #### Function GetLinterRules ################################################### @@ -434,8 +444,8 @@ GetLinterRules() { # Validate we have the linter rules # ##################################### if [ -f "${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${!LANGUAGE_FILE_NAME}" ]; then - echo "----------------------------------------------" - echo "User provided file:[${!LANGUAGE_FILE_NAME}], setting rules file..." + info "----------------------------------------------" + info "User provided file:[${!LANGUAGE_FILE_NAME}], setting rules file..." ######################################## # Update the path to the file location # @@ -445,9 +455,7 @@ GetLinterRules() { ######################################################## # No user default provided, using the template default # ######################################################## - if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then - echo " -> Codebase does NOT have file:[${LINTER_RULES_PATH}/${!LANGUAGE_FILE_NAME}], using Default rules at:[${!LANGUAGE_LINTER_RULES}]" - fi + debug " -> Codebase does NOT have file:[${LINTER_RULES_PATH}/${!LANGUAGE_FILE_NAME}], using Default rules at:[${!LANGUAGE_LINTER_RULES}]" fi } ################################################################################ @@ -514,7 +522,7 @@ GetStandardRules() { # Get the env to add to string # ################################ ENV="$(echo "${ENV}" | cut -d'"' -f2)" - # echo "ENV:[${ENV}]" + debug "ENV:[${ENV}]" ENV_STRING+="--env ${ENV} " done @@ -652,8 +660,8 @@ GetGitHubVars() { ########## # Prints # ########## - echo "--------------------------------------------" - echo "Gathering GitHub information..." + info "--------------------------------------------" + info "Gathering GitHub information..." ############################### # Get the Run test cases flag # @@ -692,8 +700,8 @@ GetGitHubVars() { ########################################## # We are running locally for a debug run # ########################################## - echo "NOTE: ENV VAR [RUN_LOCAL] has been set to:[true]" - echo "bypassing GitHub Actions variables..." + info "NOTE: ENV VAR [RUN_LOCAL] has been set to:[true]" + info "bypassing GitHub Actions variables..." ############################ # Set the GITHUB_WORKSPACE # @@ -706,7 +714,7 @@ GetGitHubVars() { fatal "Provided volume is not a directory!" fi - echo "Linting all files in mapped directory:[${DEFAULT_WORKSPACE}]" + info "Linting all files in mapped directory:[${DEFAULT_WORKSPACE}]" # No need to touch or set the GITHUB_SHA # No need to touch or set the GITHUB_EVENT_PATH @@ -725,7 +733,7 @@ GetGitHubVars() { error "Failed to get [GITHUB_SHA]!" fatal "[${GITHUB_SHA}]" else - notice "Successfully found:${F[W]}[GITHUB_SHA]${F[B]}, value:${F[W]}[${GITHUB_SHA}]${NC}" + info "Successfully found:${F[W]}[GITHUB_SHA]${F[B]}, value:${F[W]}[${GITHUB_SHA}]" fi ############################ @@ -735,7 +743,7 @@ GetGitHubVars() { error "Failed to get [GITHUB_WORKSPACE]!" fatal "[${GITHUB_WORKSPACE}]" else - notice "Successfully found:${F[W]}[GITHUB_WORKSPACE]${F[B]}, value:${F[W]}[${GITHUB_WORKSPACE}]${NC}" + info "Successfully found:${F[W]}[GITHUB_WORKSPACE]${F[B]}, value:${F[W]}[${GITHUB_WORKSPACE}]" fi ############################ @@ -745,7 +753,7 @@ GetGitHubVars() { error "Failed to get [GITHUB_EVENT_PATH]!" fatal "[${GITHUB_EVENT_PATH}]" else - notice "Successfully found:${F[W]}[GITHUB_EVENT_PATH]${F[B]}, value:${F[W]}[${GITHUB_EVENT_PATH}]${F[B]}${NC}" + info "Successfully found:${F[W]}[GITHUB_EVENT_PATH]${F[B]}, value:${F[W]}[${GITHUB_EVENT_PATH}]${F[B]}" fi ################################################## @@ -764,7 +772,7 @@ GetGitHubVars() { error "Failed to get [GITHUB_ORG]!" fatal "[${GITHUB_ORG}]" else - notice "Successfully found:${F[W]}[GITHUB_ORG]${F[B]}, value:${F[W]}[${GITHUB_ORG}]${NC}" + info "Successfully found:${F[W]}[GITHUB_ORG]${F[B]}, value:${F[W]}[${GITHUB_ORG}]" fi ####################### @@ -779,7 +787,7 @@ GetGitHubVars() { error "Failed to get [GITHUB_REPO]!" fatal "[${GITHUB_REPO}]" else - notice "Successfully found:${F[W]}[GITHUB_REPO]${F[B]}, value:${F[W]}[${GITHUB_REPO}]${NC}" + info "Successfully found:${F[W]}[GITHUB_REPO]${F[B]}, value:${F[W]}[${GITHUB_REPO}]" fi fi @@ -796,7 +804,7 @@ GetGitHubVars() { ################################################################################ MULTI_STATUS='false' else - notice "Successfully found:${F[W]}[GITHUB_TOKEN]${NC}" + info "Successfully found:${F[W]}[GITHUB_TOKEN]" fi ############################### @@ -815,7 +823,7 @@ GetGitHubVars() { error "Failed to get [GITHUB_REPOSITORY]!" fatal "[${GITHUB_REPOSITORY}]" else - notice "Successfully found:${F[W]}[GITHUB_REPOSITORY]${F[B]}, value:${F[W]}[${GITHUB_REPOSITORY}]${NC}" + info "Successfully found:${F[W]}[GITHUB_REPOSITORY]${F[B]}, value:${F[W]}[${GITHUB_REPOSITORY}]" fi ############################ @@ -825,7 +833,7 @@ GetGitHubVars() { error "Failed to get [GITHUB_RUN_ID]!" fatal "[${GITHUB_RUN_ID}]" else - notice "Successfully found:${F[W]}[GITHUB_RUN_ID]${F[B]}, value:${F[W]}[${GITHUB_RUN_ID}]${NC}" + info "Successfully found:${F[W]}[GITHUB_RUN_ID]${F[B]}, value:${F[W]}[${GITHUB_RUN_ID}]" fi fi } @@ -861,10 +869,8 @@ function ValidatePowershellModules() { fatal "[PSSA_MODULE ${VALIDATE_PSSA_MODULE}] [PSSA_CMD ${VALIDATE_PSSA_CMD}]" else # Success - if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then - notice "Successfully found module ${F[W]}[${VALIDATE_PSSA_MODULE}]${F[B]} in system${NC}" - notice "Successfully found command ${F[W]}[${VALIDATE_PSSA_CMD}]${F[B]} in system${NC}" - fi + debug "Successfully found module ${F[W]}[${VALIDATE_PSSA_MODULE}]${F[B]} in system" + debug "Successfully found command ${F[W]}[${VALIDATE_PSSA_CMD}]${F[B]} in system" fi } ################################################################################ @@ -917,8 +923,8 @@ CallStatusAPI() { ############################## if [ "${ERROR_CODE}" -ne 0 ]; then # ERROR - echo "ERROR! Failed to call GitHub Status API!" - echo "ERROR:[${SEND_STATUS_CMD}]" + info "ERROR! Failed to call GitHub Status API!" + info "ERROR:[${SEND_STATUS_CMD}]" # Not going to fail the script on this yet... fi fi @@ -926,39 +932,39 @@ CallStatusAPI() { ################################################################################ #### Function Reports ########################################################## Reports() { - echo "" - echo "----------------------------------------------" - echo "----------------------------------------------" - echo "Generated reports:" - echo "----------------------------------------------" - echo "----------------------------------------------" - echo "" + echo + info "----------------------------------------------" + info "----------------------------------------------" + info "Generated reports:" + info "----------------------------------------------" + info "----------------------------------------------" + echo ################################### # Prints output report if enabled # ################################### if [ -z "${FORMAT_REPORT}" ] ; then - echo "Reports generated in folder ${REPORT_OUTPUT_FOLDER}" + info "Reports generated in folder ${REPORT_OUTPUT_FOLDER}" fi ################################ # Prints for warnings if found # ################################ for TEST in "${WARNING_ARRAY_TEST[@]}"; do - warn "Expected file to compare with was not found for ${TEST}${NC}" + warn "Expected file to compare with was not found for ${TEST}" done } ################################################################################ #### Function Footer ########################################################### Footer() { - echo "" - echo "----------------------------------------------" - echo "----------------------------------------------" - echo "The script has completed" - echo "----------------------------------------------" - echo "----------------------------------------------" - echo "" + echo + info "----------------------------------------------" + info "----------------------------------------------" + info "The script has completed" + info "----------------------------------------------" + info "----------------------------------------------" + echo #################################################### # Need to clean up the lanuage array of duplicates # @@ -1001,7 +1007,7 @@ Footer() { # Exit with 0 if errors disabled # ################################## if [ "${DISABLE_ERRORS}" == "true" ]; then - warn "Exiting with exit code:[0] as:[DISABLE_ERRORS] was set to:[${DISABLE_ERRORS}]${NC}" + warn "Exiting with exit code:[0] as:[DISABLE_ERRORS] was set to:[${DISABLE_ERRORS}]" exit 0 fi @@ -1022,10 +1028,10 @@ Footer() { ######################## # Footer prints Exit 0 # ######################## - echo "" - notice "All file(s) linted successfully with no errors detected${NC}" - echo "----------------------------------------------" - echo "" + echo + notice "All file(s) linted successfully with no errors detected" + info "----------------------------------------------" + echo # Successful exit exit 0 } @@ -1036,7 +1042,7 @@ Footer() { cleanup() { local -ri EXIT_CODE=$? - sudo sh -c "cat ${LOG_TEMP} >> ${GITHUB_WORKSPACE}/super-linter.log" || true + sudo sh -c "cat ${LOG_TEMP} >> ${GITHUB_WORKSPACE}/${LOG_FILE}" || true exit ${EXIT_CODE} trap - 0 1 2 3 6 14 15 @@ -1118,15 +1124,10 @@ GetLinterRules "TYPESCRIPT" # Get YAML rules GetLinterRules "YAML" -################################# -# Check if were in verbose mode # -################################# -if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then - ################################## - # Get and print all version info # - ################################## - GetLinterVersions -fi +################################## +# Get and print all version info # +################################## +GetLinterVersions ########################################### # Check to see if this is a test case run # @@ -1562,7 +1563,7 @@ if [ "${VALIDATE_RAKU}" == "true" ]; then ####################### # Lint the raku files # ####################### - echo "${GITHUB_WORKSPACE}/META6.json" + info "${GITHUB_WORKSPACE}/META6.json" if [ -e "${GITHUB_WORKSPACE}/META6.json" ]; then cd "${GITHUB_WORKSPACE}" && zef install --deps-only --/test . fi diff --git a/lib/log.sh b/lib/log.sh index 532a60a5..fce6b072 100644 --- a/lib/log.sh +++ b/lib/log.sh @@ -41,9 +41,9 @@ log() { fi ) } -trace() { log "${TRACE:-}" "${NC}$(date +"%F %T") ${F[B]}[TRACE ]${NC} $*${NC}"; } -debug() { log "${DEBUG:-}" "${NC}$(date +"%F %T") ${F[B]}[DEBUG ]${NC} $*${NC}"; } -info() { log "${VERBOSE:-}" "${NC}$(date +"%F %T") ${F[B]}[INFO ]${NC} $*${NC}"; } +trace() { log "${LOG_TRACE:-}" "${NC}$(date +"%F %T") ${F[B]}[TRACE ]${NC} $*${NC}"; } +debug() { log "${LOG_DEBUG:-}" "${NC}$(date +"%F %T") ${F[B]}[DEBUG ]${NC} $*${NC}"; } +info() { log "${LOG_VERBOSE:-}" "${NC}$(date +"%F %T") ${F[B]}[INFO ]${NC} $*${NC}"; } notice() { log "true" "${NC}$(date +"%F %T") ${F[G]}[NOTICE]${NC} $*${NC}"; } warn() { log "true" "${NC}$(date +"%F %T") ${F[Y]}[WARN ]${NC} $*${NC}"; } error() { log "true" "${NC}$(date +"%F %T") ${F[R]}[ERROR ]${NC} $*${NC}"; } diff --git a/lib/validation.sh b/lib/validation.sh index 178ffbae..1cc7517d 100755 --- a/lib/validation.sh +++ b/lib/validation.sh @@ -13,9 +13,9 @@ function GetValidationInfo() { ############################################ # Print headers for user provided env vars # ############################################ - echo "" - echo "--------------------------------------------" - echo "Gathering user validation information..." + echo + info "--------------------------------------------" + info "Gathering user validation information..." ########################################### # Skip validation if were running locally # @@ -31,10 +31,10 @@ function GetValidationInfo() { if [[ ${VALIDATE_ALL_CODEBASE} != "false" ]]; then # Set to true VALIDATE_ALL_CODEBASE="${DEFAULT_VALIDATE_ALL_CODEBASE}" - echo "- Validating ALL files in code base..." + info "- Validating ALL files in code base..." else # Its false - echo "- Only validating [new], or [edited] files in code base..." + info "- Only validating [new], or [edited] files in code base..." fi fi @@ -167,23 +167,19 @@ function GetValidationInfo() { ACTIONS_RUNNER_DEBUG="true" fi - ################### - # Debug on runner # - ################### - if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then - ########################### - # Print the validate info # - ########################### - for LINE in "${PRINT_ARRAY[@]}"; do - echo "${LINE}" - done + ########################### + # Print the validate info # + ########################### + for LINE in "${PRINT_ARRAY[@]}"; do + debug "${LINE}" + done - echo "--- DEBUG INFO ---" - echo "---------------------------------------------" - RUNNER=$(whoami) - echo "Runner:[${RUNNER}]" - echo "ENV:" - printenv - echo "---------------------------------------------" - fi + debug "--- DEBUG INFO ---" + debug "---------------------------------------------" + RUNNER=$(whoami) + debug "Runner:[${RUNNER}]" + PRINTENV=$(printenv) + debug "ENV:" + debug "${PRINTENV}" + debug "---------------------------------------------" } diff --git a/lib/worker.sh b/lib/worker.sh index 39312b35..a2d1c1eb 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -53,9 +53,7 @@ function LintCodebase() { fatal "[${VALIDATE_INSTALL_CMD}]" else # Success - if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then - notice "Successfully found binary for ${F[W]}[${LINTER_NAME}]${F[B]} in system location: ${F[W]}[${VALIDATE_INSTALL_CMD}]${NC}" - fi + debug "Successfully found binary for ${F[W]}[${LINTER_NAME}]${F[B]} in system location: ${F[W]}[${VALIDATE_INSTALL_CMD}]" fi ########################## @@ -74,7 +72,7 @@ function LintCodebase() { if [ ${#FILE_ARRAY[@]} -eq 0 ] && [ "${VALIDATE_ALL_CODEBASE}" == "false" ]; then # No files found in commit and user has asked to not validate code base SKIP_FLAG=1 - # echo " - No files found in changeset to lint for language:[${FILE_TYPE}]" + debug " - No files found in changeset to lint for language:[${FILE_TYPE}]" elif [ ${#FILE_ARRAY[@]} -ne 0 ]; then # We have files added to array of files to check LIST_FILES=("${FILE_ARRAY[@]}") # Copy the array into list @@ -120,7 +118,7 @@ function LintCodebase() { ######################### # Print the header info # ######################### - echo "${LINE}" + info "${LINE}" done ######################################## @@ -165,8 +163,8 @@ function LintCodebase() { ############## # File print # ############## - echo "---------------------------" - echo "File:[${FILE}]" + info "---------------------------" + info "File:[${FILE}]" ################################# # Add the language to the array # @@ -242,7 +240,7 @@ function LintCodebase() { ########### # Success # ########### - notice " - File:${F[W]}[${FILE_NAME}]${F[B]} was linted with ${F[W]}[${LINTER_NAME}]${F[B]} successfully${NC}" + info " - File:${F[W]}[${FILE_NAME}]${F[B]} was linted with ${F[W]}[${LINTER_NAME}]${F[B]} successfully" ####################################################### # Store the linting as a temporary file in TAP format # @@ -278,13 +276,13 @@ function TestCodebase() { ################ # print header # ################ - echo "" - echo "----------------------------------------------" - echo "----------------------------------------------" - echo "Testing Codebase [${FILE_TYPE}] files..." - echo "----------------------------------------------" - echo "----------------------------------------------" - echo "" + echo + info "----------------------------------------------" + info "----------------------------------------------" + info "Testing Codebase [${FILE_TYPE}] files..." + info "----------------------------------------------" + info "----------------------------------------------" + echo ##################################### # Validate we have linter installed # @@ -305,7 +303,7 @@ function TestCodebase() { fatal "[${VALIDATE_INSTALL_CMD}]" else # Success - notice "Successfully found binary for ${F[W]}[${LINTER_NAME}]${F[B]} in system location: ${F[W]}[${VALIDATE_INSTALL_CMD}]${NC}" + info "Successfully found binary for ${F[W]}[${LINTER_NAME}]${F[B]} in system location: ${F[W]}[${VALIDATE_INSTALL_CMD}]" fi ########################## @@ -356,8 +354,8 @@ function TestCodebase() { ############## # File print # ############## - echo "---------------------------" - echo "File:[${FILE}]" + info "---------------------------" + info "File:[${FILE}]" ######################## # Set the lint command # @@ -461,7 +459,7 @@ function TestCodebase() { ########### # Success # ########### - notice " - File:${F[W]}[${FILE_NAME}]${F[B]} was linted with ${F[W]}[${LINTER_NAME}]${F[B]} successfully${NC}" + info " - File:${F[W]}[${FILE_NAME}]${F[B]} was linted with ${F[W]}[${LINTER_NAME}]${F[B]} successfully" fi ####################################################### # Store the linting as a temporary file in TAP format # @@ -491,7 +489,7 @@ function TestCodebase() { ########### # Success # ########### - notice " - File:${F[W]}[${FILE_NAME}]${F[B]} failed test case with ${F[W]}[${LINTER_NAME}]${F[B]} successfully${NC}" + info " - File:${F[W]}[${FILE_NAME}]${F[B]} failed test case with ${F[W]}[${LINTER_NAME}]${F[B]} successfully" fi ####################################################### # Store the linting as a temporary file in TAP format # @@ -521,17 +519,17 @@ function TestCodebase() { ############################################# # We failed to compare the reporting output # ############################################# - error "Failed to assert TAP output:[${LINTER_NAME}]${NC}"! - echo "Please validate the asserts!" + error "Failed to assert TAP output:[${LINTER_NAME}]"! + info "Please validate the asserts!" cat "${TMPFILE}" exit 1 else # Success - notice "Successfully validation in the expected TAP format for ${F[W]}[${LINTER_NAME}]${NC}" + info "Successfully validation in the expected TAP format for ${F[W]}[${LINTER_NAME}]" fi else - warn "No TAP expected file found at:[${EXPECTED_FILE}]${NC}" - echo "skipping report assertions" + warn "No TAP expected file found at:[${EXPECTED_FILE}]" + info "skipping report assertions" ##################################### # Append the file type to the array # ##################################### @@ -546,7 +544,7 @@ function TestCodebase() { ################################################# # We failed to find files and no tests were ran # ################################################# - error "Failed to find any tests ran for the Linter:[${LINTER_NAME}]${NC}"! + error "Failed to find any tests ran for the Linter:[${LINTER_NAME}]"! fatal "Please validate logic or that tests exist!" fi } @@ -564,11 +562,11 @@ function RunTestCases() { ################# # Header prints # ################# - echo "" - echo "----------------------------------------------" - echo "-------------- TEST CASE RUN -----------------" - echo "----------------------------------------------" - echo "" + echo + info "----------------------------------------------" + info "-------------- TEST CASE RUN -----------------" + info "----------------------------------------------" + echo ####################### # Test case languages # @@ -661,11 +659,8 @@ function LintAnsibleFiles() { fatal "[${VALIDATE_INSTALL_CMD}]" else # Success - if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then - # Success - notice "Successfully found binary in system${NC}" - echo "Location:[${VALIDATE_INSTALL_CMD}]" - fi + debug "Successfully found binary in system" + debug "Location:[${VALIDATE_INSTALL_CMD}]" fi ########################## @@ -700,7 +695,7 @@ function LintAnsibleFiles() { ################################### # Send message that were skipping # ################################### - #echo "- Skipping Ansible lint run as file(s) that were modified were read only..." + debug "- Skipping Ansible lint run as file(s) that were modified were read only..." ############################ # Create flag to skip loop # ############################ @@ -715,7 +710,7 @@ function LintAnsibleFiles() { ######################### # Print the header line # ######################### - echo "${LINE}" + info "${LINE}" done fi @@ -755,8 +750,8 @@ function LintAnsibleFiles() { ############## # File print # ############## - echo "---------------------------" - echo "File:[${FILE}]" + info "---------------------------" + info "File:[${FILE}]" ################################ # Lint the file with the rules # @@ -792,7 +787,7 @@ function LintAnsibleFiles() { ########### # Success # ########### - notice " - File:${F[W]}[${FILE_NAME}]${F[B]} was linted with ${F[W]}[${LINTER_NAME}]${F[B]} successfully${NC}" + info " - File:${F[W]}[${FILE_NAME}]${F[B]} was linted with ${F[W]}[${LINTER_NAME}]${F[B]} successfully" ####################################################### # Store the linting as a temporary file in TAP format # @@ -810,17 +805,12 @@ function LintAnsibleFiles() { HeaderTap "${INDEX}" "${REPORT_OUTPUT_FILE}" cat "${TMPFILE}" >> "${REPORT_OUTPUT_FILE}" fi - else # No ansible directory found in path - ############################### - # Check to see if debug is on # - ############################### - if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then - ######################## - # No Ansible dir found # - ######################## - warn "No Ansible base directory found at:[${ANSIBLE_DIRECTORY}]${NC}" - echo "skipping ansible lint" - fi + else + ######################## + # No Ansible dir found # + ######################## + warn "No Ansible base directory found at:[${ANSIBLE_DIRECTORY}]" + debug "skipping ansible lint" fi } ################################################################################