Always end with NC

This commit is contained in:
Eric Nemchik 2020-07-01 15:47:24 -05:00
parent c872288faa
commit ff21bbf79c
6 changed files with 99 additions and 99 deletions

View file

@ -54,8 +54,8 @@ ValidateInput()
# Validate GITHUB_WORKSPACE #
############################
if [ -z "$GITHUB_WORKSPACE" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_WORKSPACE]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_WORKSPACE]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_WORKSPACE]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_WORKSPACE]${NC}"
exit 1
else
echo "Successfully found:[GITHUB_WORKSPACE], value:[$GITHUB_WORKSPACE]"
@ -66,15 +66,15 @@ ValidateInput()
#######################
if [ -z "$IMAGE_REPO" ]; then
# No repo was pulled
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [IMAGE_REPO]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$IMAGE_REPO]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [IMAGE_REPO]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$IMAGE_REPO]${NC}"
exit 1
elif [[ "$IMAGE_REPO" == "github/super-linter" ]]; then
# Found our main repo
echo "Successfully found:[IMAGE_REPO], value:[$IMAGE_REPO]"
else
# This is a fork and we cant pull vars or any info
echo -e "${NC}${F[Y]}WARN!${NC} No image to cleanup as this is a forked branch, and not being built with current automation!"
echo -e "${NC}${F[Y]}WARN!${NC} No image to cleanup as this is a forked branch, and not being built with current automation!${NC}"
exit 0
fi
@ -82,8 +82,8 @@ ValidateInput()
# Validate IMAGE_VERSION #
##########################
if [ -z "$IMAGE_VERSION" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [IMAGE_VERSION]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$IMAGE_VERSION]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [IMAGE_VERSION]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$IMAGE_VERSION]${NC}"
exit 1
else
echo "Successfully found:[IMAGE_VERSION], value:[$IMAGE_VERSION]"
@ -93,8 +93,8 @@ ValidateInput()
# Validate DOCKER_USERNAME #
############################
if [ -z "$DOCKER_USERNAME" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_USERNAME]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKER_USERNAME]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_USERNAME]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKER_USERNAME]${NC}"
exit 1
else
echo "Successfully found:[DOCKER_USERNAME], value:[$DOCKER_USERNAME]"
@ -104,8 +104,8 @@ ValidateInput()
# Validate DOCKER_PASSWORD #
############################
if [ -z "$DOCKER_PASSWORD" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_PASSWORD]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKER_PASSWORD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_PASSWORD]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKER_PASSWORD]${NC}"
exit 1
else
echo "Successfully found:[DOCKER_PASSWORD], value:[********]"
@ -157,8 +157,8 @@ LoginToDocker()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to authenticate to DockerHub!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LOGIN_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to authenticate to DockerHub!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LOGIN_CMD]${NC}"
exit 1
else
# SUCCESS
@ -197,8 +197,8 @@ RemoveImage()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to gain token from DockerHub!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$TOKEN]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to gain token from DockerHub!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$TOKEN]${NC}"
exit 1
else
# SUCCESS
@ -222,8 +222,8 @@ RemoveImage()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to remove tag from DockerHub!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$REMOVE_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to remove tag from DockerHub!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$REMOVE_CMD]${NC}"
exit 1
else
# SUCCESS

View file

@ -53,8 +53,8 @@ CheckGHEPid()
# Check the shell for errors #
##############################
if [ $ERROR_CODE -ne 0 ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to sleep!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$SLEEP_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to sleep!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$SLEEP_CMD]${NC}"
echo "Will try to call apply as last effort..."
####################################
# Call config apply as last effort #
@ -117,8 +117,8 @@ CheckGHEProcess()
# Check the shell for errors #
##############################
if [ $ERROR_CODE -ne 0 ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to sleep!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$SLEEP_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to sleep!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$SLEEP_CMD]${NC}"
echo "Will try to call apply as last effort..."
####################################
# Call config apply as last effort #
@ -161,8 +161,8 @@ RunConfigApply()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# Errors
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to run config apply command!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$APPLY_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to run config apply command!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$APPLY_CMD]${NC}"
exit 1
else
# Success

View file

@ -60,8 +60,8 @@ ValidateInput()
# Validate GITHUB_WORKSPACE #
#############################
if [ -z "$GITHUB_WORKSPACE" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_WORKSPACE]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_WORKSPACE]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_WORKSPACE]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_WORKSPACE]${NC}"
exit 1
else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_WORKSPACE]${F[B]}, value:${F[W]}[$GITHUB_WORKSPACE]${NC}"
@ -71,8 +71,8 @@ ValidateInput()
# Validate REGISTRY #
#####################
if [ -z "$REGISTRY" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [REGISTRY]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$REGISTRY]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [REGISTRY]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$REGISTRY]${NC}"
exit 1
else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[REGISTRY]${F[B]}, value:${F[W]}[$REGISTRY]${NC}"
@ -86,8 +86,8 @@ ValidateInput()
# Validate GPR_USERNAME #
#########################
if [ -z "$GPR_USERNAME" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GPR_USERNAME]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GPR_USERNAME]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GPR_USERNAME]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GPR_USERNAME]${NC}"
exit 1
else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GPR_USERNAME]${F[B]}, value:${F[W]}[$GPR_USERNAME]${NC}"
@ -97,8 +97,8 @@ ValidateInput()
# Validate GPR_TOKEN #
######################
if [ -z "$GPR_TOKEN" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GPR_TOKEN]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GPR_TOKEN]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GPR_TOKEN]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GPR_TOKEN]${NC}"
exit 1
else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GPR_TOKEN]${F[B]}, value:${F[W]}[********]${NC}"
@ -111,8 +111,8 @@ ValidateInput()
# Validate DOCKER_USERNAME #
############################
if [ -z "$DOCKER_USERNAME" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_USERNAME]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKER_USERNAME]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_USERNAME]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKER_USERNAME]${NC}"
exit 1
else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[DOCKER_USERNAME]${F[B]}, value:${F[W]}[$DOCKER_USERNAME]${NC}"
@ -122,8 +122,8 @@ ValidateInput()
# Validate DOCKER_PASSWORD #
############################
if [ -z "$DOCKER_PASSWORD" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_PASSWORD]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKER_PASSWORD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_PASSWORD]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKER_PASSWORD]${NC}"
exit 1
else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[DOCKER_PASSWORD]${F[B]}, value:${F[B]}[********]${NC}"
@ -132,7 +132,7 @@ ValidateInput()
# We were not passed a registry to update #
###########################################
else
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find a valid registry!"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find a valid registry!${NC}"
echo "Registry:[$REGISTRY]"
exit 1
fi
@ -142,8 +142,8 @@ ValidateInput()
# Validate IMAGE_REPO #
#######################
if [ -z "$IMAGE_REPO" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [IMAGE_REPO]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$IMAGE_REPO]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [IMAGE_REPO]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$IMAGE_REPO]${NC}"
exit 1
else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[IMAGE_REPO]${F[B]}, value:${F[W]}[$IMAGE_REPO]${NC}"
@ -161,7 +161,7 @@ ValidateInput()
# Validate IMAGE_VERSION #
##########################
if [ -z "$IMAGE_VERSION" ]; then
echo -e "${NC}${F[Y]}WARN!${NC} Failed to get [IMAGE_VERSION]!"
echo -e "${NC}${F[Y]}WARN!${NC} Failed to get [IMAGE_VERSION]!${NC}"
echo "Pulling from Branch Name..."
##############################
# Get the name of the branch #
@ -177,8 +177,8 @@ ValidateInput()
# Check the shell for errors #
##############################
if [ $ERROR_CODE -ne 0 ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get branch name!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$BRANCH_NAME]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get branch name!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$BRANCH_NAME]${NC}"
exit 1
fi
@ -224,8 +224,8 @@ ValidateInput()
# Validate DOCKERFILE_PATH #
############################
if [ -z "$DOCKERFILE_PATH" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKERFILE_PATH]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKERFILE_PATH]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKERFILE_PATH]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKERFILE_PATH]${NC}"
exit 1
else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[DOCKERFILE_PATH]${F[B]}, value:${F[W]}[$DOCKERFILE_PATH]${NC}"
@ -267,8 +267,8 @@ Authenticate()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to authenticate to $NAME!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LOGIN_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to authenticate to $NAME!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LOGIN_CMD]${NC}"
exit 1
else
# SUCCESS
@ -293,7 +293,7 @@ BuildImage()
################################
if [ ! -f "$DOCKERFILE_PATH" ]; then
# No file found
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to find Dockerfile at:[$DOCKERFILE_PATH]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to find Dockerfile at:[$DOCKERFILE_PATH]${NC}"
echo "Please make sure you give full path!"
echo "Example:[/configs/Dockerfile] or [Dockerfile] if at root directory"
exit 1
@ -314,7 +314,7 @@ BuildImage()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [build] Dockerfile!"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [build] Dockerfile!${NC}"
exit 1
else
# SUCCESS
@ -338,7 +338,7 @@ BuildImage()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [tag] Dockerfile!"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [tag] Dockerfile!${NC}"
exit 1
else
# SUCCESS
@ -374,7 +374,7 @@ UploadImage()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [upload] Dockerfile!"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [upload] Dockerfile!${NC}"
exit 1
else
# SUCCESS
@ -397,8 +397,8 @@ UploadImage()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get information about built Image!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GET_INFO_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get information about built Image!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GET_INFO_CMD]${NC}"
exit 1
else
################
@ -440,7 +440,7 @@ UploadImage()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [upload] MAJOR_TAG:[$MAJOR_TAG] Dockerfile!"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [upload] MAJOR_TAG:[$MAJOR_TAG] Dockerfile!${NC}"
exit 1
else
# SUCCESS
@ -495,7 +495,7 @@ else
#########
# ERROR #
#########
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Registry not set correctly!"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Registry not set correctly!${NC}"
echo "Registry:[$REGISTRY]"
exit 1
fi

View file

@ -39,7 +39,7 @@ function BuildFileList()
if [ $ERROR_CODE -ne 0 ]; then
# Error
echo "Failed to switch to $DEFAULT_BRANCH branch to get files changed!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$SWITCH_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$SWITCH_CMD]${NC}"
exit 1
fi
@ -67,8 +67,8 @@ function BuildFileList()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# Error
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to gain a list of all files changed!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${RAW_FILE_ARRAY[*]}]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to gain a list of all files changed!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${RAW_FILE_ARRAY[*]}]${NC}"
exit 1
fi
@ -374,7 +374,7 @@ function BuildFileList()
#######################
# It is a bash script #
#######################
echo -e "${NC}${F[Y]}WARN!${NC} Found bash script without extension:[.sh]"
echo -e "${NC}${F[Y]}WARN!${NC} Found bash script without extension:[.sh]${NC}"
echo "Please update file with proper extensions."
################################
# Append the file to the array #
@ -388,7 +388,7 @@ function BuildFileList()
#######################
# It is a Ruby script #
#######################
echo -e "${NC}${F[Y]}WARN!${NC} Found ruby script without extension:[.rb]"
echo -e "${NC}${F[Y]}WARN!${NC} Found ruby script without extension:[.rb]${NC}"
echo "Please update file with proper extensions."
################################
# Append the file to the array #
@ -402,7 +402,7 @@ function BuildFileList()
############################
# Extension was not found! #
############################
echo -e "${NC}${F[Y]} - WARN!${NC} Failed to get filetype for:[$FILE]!"
echo -e "${NC}${F[Y]} - WARN!${NC} Failed to get filetype for:[$FILE]!${NC}"
##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
##########################################################
@ -429,7 +429,7 @@ function BuildFileList()
if [ $ERROR_CODE -ne 0 ]; then
# Error
echo "Failed to switch back to branch!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$SWITCH2_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$SWITCH2_CMD]${NC}"
exit 1
fi

View file

@ -279,7 +279,7 @@ GetLinterVersions()
# Check the shell for errors #
##############################
if [ $ERROR_CODE -ne 0 ] || [ -z "${GET_VERSION_CMD[*]}" ]; then
echo -e "${NC}${F[Y]}WARN!${NC} Failed to get version info for:[$LINTER]"
echo -e "${NC}${F[Y]}WARN!${NC} Failed to get version info for:[$LINTER]${NC}"
echo "---------------------------------------------"
else
##########################
@ -323,8 +323,8 @@ GetLinterRules()
# Check the shell for errors #
##############################
if [ $ERROR_CODE -ne 0 ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to set file:[$FILE_NAME] as default!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$CP_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to set file:[$FILE_NAME] as default!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$CP_CMD]${NC}"
exit 1
fi
else
@ -374,8 +374,8 @@ GetStandardRules()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to gain list of ENV vars to load!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${GET_ENV_ARRAY[*]}]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to gain list of ENV vars to load!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${GET_ENV_ARRAY[*]}]${NC}"
exit 1
fi
@ -576,8 +576,8 @@ GetGitHubVars()
# Validate we have a value #
############################
if [ -z "$GITHUB_SHA" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_SHA]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_SHA]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_SHA]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_SHA]${NC}"
exit 1
else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_SHA]${F[B]}, value:${F[W]}[$GITHUB_SHA]${NC}"
@ -587,8 +587,8 @@ GetGitHubVars()
# Validate we have a value #
############################
if [ -z "$GITHUB_WORKSPACE" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_WORKSPACE]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_WORKSPACE]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_WORKSPACE]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_WORKSPACE]${NC}"
exit 1
else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_WORKSPACE]${F[B]}, value:${F[W]}[$GITHUB_WORKSPACE]${NC}"
@ -598,11 +598,11 @@ GetGitHubVars()
# Validate we have a value #
############################
if [ -z "$GITHUB_EVENT_PATH" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_EVENT_PATH]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_EVENT_PATH]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_EVENT_PATH]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_EVENT_PATH]${NC}"
exit 1
else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_EVENT_PATH]${F[B]}, value:${F[W]}[$GITHUB_EVENT_PATH]${F[B]}"
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_EVENT_PATH]${F[B]}, value:${F[W]}[$GITHUB_EVENT_PATH]${F[B]}${NC}"
fi
##################################################
@ -618,8 +618,8 @@ GetGitHubVars()
# Validate we have a value #
############################
if [ -z "$GITHUB_ORG" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_ORG]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_ORG]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_ORG]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_ORG]${NC}"
exit 1
else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_ORG]${F[B]}, value:${F[W]}[$GITHUB_ORG]${NC}"
@ -634,8 +634,8 @@ GetGitHubVars()
# Validate we have a value #
############################
if [ -z "$GITHUB_REPO" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_REPO]!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_REPO]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_REPO]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_REPO]${NC}"
exit 1
else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_REPO]${F[B]}, value:${F[W]}[$GITHUB_REPO]${NC}"
@ -673,8 +673,8 @@ function ValidatePowershellModules()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# Failed
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed find module [PSScriptAnalyzer] for [$LINTER_NAME] in system!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[PSSA_MODULE $VALIDATE_PSSA_MODULE] [PSSA_CMD $VALIDATE_PSSA_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed find module [PSScriptAnalyzer] for [$LINTER_NAME] in system!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[PSSA_MODULE $VALIDATE_PSSA_MODULE] [PSSA_CMD $VALIDATE_PSSA_CMD]${NC}"
exit 1
else
# Success
@ -711,7 +711,7 @@ Footer()
##################
if [ "${!ERROR_COUNTER}" -ne 0 ]; then
# Print the goods
echo -e "${NC}${B[R]}${F[W]}ERRORS FOUND${NC} in $LANGUAGE:[${!ERROR_COUNTER}]"
echo -e "${NC}${B[R]}${F[W]}ERRORS FOUND${NC} in $LANGUAGE:[${!ERROR_COUNTER}]${NC}"
fi
done
@ -719,7 +719,7 @@ Footer()
# Exit with 0 if errors disabled #
##################################
if [ "$DISABLE_ERRORS" == "true" ]; then
echo -e "${NC}${F[Y]}WARN!${NC} Exiting with exit code:[0] as:[DISABLE_ERRORS] was set to:[$DISABLE_ERRORS]"
echo -e "${NC}${F[Y]}WARN!${NC} Exiting with exit code:[0] as:[DISABLE_ERRORS] was set to:[$DISABLE_ERRORS]${NC}"
exit 0
###############################
# Exit with 1 if errors found #

View file

@ -50,8 +50,8 @@ function LintCodebase()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# Failed
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find [$LINTER_NAME] in system!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$VALIDATE_INSTALL_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find [$LINTER_NAME] in system!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$VALIDATE_INSTALL_CMD]${NC}"
exit 1
else
# Success
@ -187,8 +187,8 @@ function LintCodebase()
#########
# Error #
#########
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [$LINTER_NAME] linter!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LINT_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [$LINTER_NAME] linter!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LINT_CMD]${NC}"
# Increment the error count
(("ERRORS_FOUND_$FILE_TYPE++"))
else
@ -240,8 +240,8 @@ function TestCodebase()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# Failed
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find [$LINTER_NAME] in system!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$VALIDATE_INSTALL_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find [$LINTER_NAME] in system!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$VALIDATE_INSTALL_CMD]${NC}"
exit 1
else
# Success
@ -358,9 +358,9 @@ function TestCodebase()
#########
# Error #
#########
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [$LINTER_NAME] linter!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LINT_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC} Linter CMD:[$LINTER_COMMAND $FILE]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [$LINTER_NAME] linter!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LINT_CMD]${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC} Linter CMD:[$LINTER_COMMAND $FILE]${NC}"
# Increment the error count
(("ERRORS_FOUND_$FILE_TYPE++"))
# Increment counter that check was ran
@ -384,10 +384,10 @@ function TestCodebase()
#########
# Error #
#########
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [$LINTER_NAME] linter!"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} This file should have failed test case!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LINT_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC} Linter CMD:[$LINTER_COMMAND $FILE]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [$LINTER_NAME] linter!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} This file should have failed test case!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LINT_CMD]${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC} Linter CMD:[$LINTER_COMMAND $FILE]${NC}"
# Increment the error count
(("ERRORS_FOUND_$FILE_TYPE++"))
# Increment counter that check was ran
@ -410,7 +410,7 @@ function TestCodebase()
#################################################
# We failed to find files and no tests were ran #
#################################################
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find any tests ran for the Linter:[$LINTER_NAME]"!
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find any tests ran for the Linter:[$LINTER_NAME]${NC}"!
echo "Please validate logic or that tests exist!"
exit 1
fi
@ -513,8 +513,8 @@ function LintAnsibleFiles()
##############################
if [ $ERROR_CODE -ne 0 ]; then
# Failed
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find $LINTER_NAME in system!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$VALIDATE_INSTALL_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find $LINTER_NAME in system!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$VALIDATE_INSTALL_CMD]${NC}"
exit 1
else
# Success
@ -619,8 +619,8 @@ function LintAnsibleFiles()
#########
# Error #
#########
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [$LINTER_NAME] linter!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LINT_CMD]"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [$LINTER_NAME] linter!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LINT_CMD]${NC}"
# Increment error count
((ERRORS_FOUND_ANSIBLE++))
else
@ -638,7 +638,7 @@ function LintAnsibleFiles()
########################
# No Ansible dir found #
########################
echo -e "${NC}${F[Y]}WARN!${NC} No Ansible base directory found at:[$ANSIBLE_DIRECTORY]"
echo -e "${NC}${F[Y]}WARN!${NC} No Ansible base directory found at:[$ANSIBLE_DIRECTORY]${NC}"
echo "skipping ansible lint"
fi
fi