From c872288faa4715f91022110b1548ea1e05aa510a Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Wed, 1 Jul 2020 15:40:24 -0500 Subject: [PATCH] More colors --- .automation/cleanup-docker.sh | 2 +- .automation/upload-docker.sh | 26 +++++++++++++------------- lib/buildFileList.sh | 6 +++--- lib/linter.sh | 16 ++++++++-------- lib/worker.sh | 2 +- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.automation/cleanup-docker.sh b/.automation/cleanup-docker.sh index f493bd6c..cb9e5dff 100755 --- a/.automation/cleanup-docker.sh +++ b/.automation/cleanup-docker.sh @@ -74,7 +74,7 @@ ValidateInput() echo "Successfully found:[IMAGE_REPO], value:[$IMAGE_REPO]" else # This is a fork and we cant pull vars or any info - echo "WARN! 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!" exit 0 fi diff --git a/.automation/upload-docker.sh b/.automation/upload-docker.sh index 83e97d0f..2a65d82f 100755 --- a/.automation/upload-docker.sh +++ b/.automation/upload-docker.sh @@ -64,7 +64,7 @@ ValidateInput() echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_WORKSPACE]" exit 1 else - echo "Successfully found:[GITHUB_WORKSPACE], value:[$GITHUB_WORKSPACE]" + echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_WORKSPACE]${F[B]}, value:${F[W]}[$GITHUB_WORKSPACE]${NC}" fi ##################### @@ -75,7 +75,7 @@ ValidateInput() echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$REGISTRY]" exit 1 else - echo "Successfully found:[REGISTRY], value:[$REGISTRY]" + echo -e "${NC}${F[B]}Successfully found:${F[W]}[REGISTRY]${F[B]}, value:${F[W]}[$REGISTRY]${NC}" fi ##################################################### @@ -90,7 +90,7 @@ ValidateInput() echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GPR_USERNAME]" exit 1 else - echo "Successfully found:[GPR_USERNAME], value:[$GPR_USERNAME]" + echo -e "${NC}${F[B]}Successfully found:${F[W]}[GPR_USERNAME]${F[B]}, value:${F[W]}[$GPR_USERNAME]${NC}" fi ###################### @@ -101,7 +101,7 @@ ValidateInput() echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GPR_TOKEN]" exit 1 else - echo "Successfully found:[GPR_TOKEN], value:[********]" + echo -e "${NC}${F[B]}Successfully found:${F[W]}[GPR_TOKEN]${F[B]}, value:${F[W]}[********]${NC}" fi ######################################## # See if we need values for Ducker hub # @@ -115,7 +115,7 @@ ValidateInput() echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKER_USERNAME]" exit 1 else - echo "Successfully found:[DOCKER_USERNAME], value:[$DOCKER_USERNAME]" + echo -e "${NC}${F[B]}Successfully found:${F[W]}[DOCKER_USERNAME]${F[B]}, value:${F[W]}[$DOCKER_USERNAME]${NC}" fi ############################ @@ -126,7 +126,7 @@ ValidateInput() echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKER_PASSWORD]" exit 1 else - echo "Successfully found:[DOCKER_PASSWORD], value:[********]" + echo -e "${NC}${F[B]}Successfully found:${F[W]}[DOCKER_PASSWORD]${F[B]}, value:${F[B]}[********]${NC}" fi ########################################### # We were not passed a registry to update # @@ -146,7 +146,7 @@ ValidateInput() echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$IMAGE_REPO]" exit 1 else - echo "Successfully found:[IMAGE_REPO], value:[$IMAGE_REPO]" + echo -e "${NC}${F[B]}Successfully found:${F[W]}[IMAGE_REPO]${F[B]}, value:${F[W]}[$IMAGE_REPO]${NC}" ############################################### # Need to see if GPR registry and update name # ############################################### @@ -161,7 +161,7 @@ ValidateInput() # Validate IMAGE_VERSION # ########################## if [ -z "$IMAGE_VERSION" ]; then - echo "WARN! Failed to get [IMAGE_VERSION]!" + echo -e "${NC}${F[Y]}WARN!${NC} Failed to get [IMAGE_VERSION]!" echo "Pulling from Branch Name..." ############################## # Get the name of the branch # @@ -193,7 +193,7 @@ ValidateInput() IMAGE_VERSION="$BRANCH_NAME" echo "Tag:[$IMAGE_VERSION]" else - echo "Successfully found:[IMAGE_VERSION], value:[$IMAGE_VERSION]" + echo -e "${NC}${F[B]}Successfully found:${F[W]}[IMAGE_VERSION]${F[B]}, value:${F[W]}[$IMAGE_VERSION]${NC}" fi ################################## @@ -228,7 +228,7 @@ ValidateInput() echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKERFILE_PATH]" exit 1 else - echo "Successfully found:[DOCKERFILE_PATH], value:[$DOCKERFILE_PATH]" + echo -e "${NC}${F[B]}Successfully found:${F[W]}[DOCKERFILE_PATH]${F[B]}, value:${F[W]}[$DOCKERFILE_PATH]${NC}" fi } ################################################################################ @@ -272,7 +272,7 @@ Authenticate() exit 1 else # SUCCESS - echo "Successfully authenticated to $NAME!" + echo -e "${NC}${F[B]}Successfully authenticated to $NAME!${NC}" fi } ################################################################################ @@ -378,7 +378,7 @@ UploadImage() exit 1 else # SUCCESS - echo "Successfully Uploaded Docker image:[$IMAGE_VERSION] to $REGISTRY!" + echo -e "${NC}${F[B]}Successfully Uploaded Docker image:${F[W]}[$IMAGE_VERSION]${F[B]} to $REGISTRY!${NC}" fi ######################### @@ -444,7 +444,7 @@ UploadImage() exit 1 else # SUCCESS - echo "Successfully Uploaded TAGOR_TAG:[$MAJOR_TAG] Docker image to $REGISTRY!" + echo -e "${NC}${F[B]}Successfully Uploaded TAGOR_TAG:${F[W]}[$MAJOR_TAG]${F[B]} Docker image to $REGISTRY!${NC}" fi fi } diff --git a/lib/buildFileList.sh b/lib/buildFileList.sh index 7618cf37..050b7984 100755 --- a/lib/buildFileList.sh +++ b/lib/buildFileList.sh @@ -374,7 +374,7 @@ function BuildFileList() ####################### # It is a bash script # ####################### - echo "WARN! Found bash script without extension:[.sh]" + echo -e "${NC}${F[Y]}WARN!${NC} Found bash script without extension:[.sh]" 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 "WARN! Found ruby script without extension:[.rb]" + echo -e "${NC}${F[Y]}WARN!${NC} Found ruby script without extension:[.rb]" echo "Please update file with proper extensions." ################################ # Append the file to the array # @@ -402,7 +402,7 @@ function BuildFileList() ############################ # Extension was not found! # ############################ - echo " - WARN! Failed to get filetype for:[$FILE]!" + echo -e "${NC}${F[Y]} - WARN!${NC} Failed to get filetype for:[$FILE]!" ########################################################## # Set the READ_ONLY_CHANGE_FLAG since this could be exec # ########################################################## diff --git a/lib/linter.sh b/lib/linter.sh index 6c6973ed..9656da92 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -279,7 +279,7 @@ GetLinterVersions() # Check the shell for errors # ############################## if [ $ERROR_CODE -ne 0 ] || [ -z "${GET_VERSION_CMD[*]}" ]; then - echo "WARN! Failed to get version info for:[$LINTER]" + echo -e "${NC}${F[Y]}WARN!${NC} Failed to get version info for:[$LINTER]" echo "---------------------------------------------" else ########################## @@ -580,7 +580,7 @@ GetGitHubVars() echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_SHA]" exit 1 else - echo "Successfully found:[GITHUB_SHA], value:[$GITHUB_SHA]" + echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_SHA]${F[B]}, value:${F[W]}[$GITHUB_SHA]${NC}" fi ############################ @@ -591,7 +591,7 @@ GetGitHubVars() echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_WORKSPACE]" exit 1 else - echo "Successfully found:[GITHUB_WORKSPACE], value:[$GITHUB_WORKSPACE]" + echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_WORKSPACE]${F[B]}, value:${F[W]}[$GITHUB_WORKSPACE]${NC}" fi ############################ @@ -602,7 +602,7 @@ GetGitHubVars() echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_EVENT_PATH]" exit 1 else - echo "Successfully found:[GITHUB_EVENT_PATH], value:[$GITHUB_EVENT_PATH]" + echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_EVENT_PATH]${F[B]}, value:${F[W]}[$GITHUB_EVENT_PATH]${F[B]}" fi ################################################## @@ -622,7 +622,7 @@ GetGitHubVars() echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_ORG]" exit 1 else - echo "Successfully found:[GITHUB_ORG], value:[$GITHUB_ORG]" + echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_ORG]${F[B]}, value:${F[W]}[$GITHUB_ORG]${NC}" fi ####################### @@ -638,7 +638,7 @@ GetGitHubVars() echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_REPO]" exit 1 else - echo "Successfully found:[GITHUB_REPO], value:[$GITHUB_REPO]" + echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_REPO]${F[B]}, value:${F[W]}[$GITHUB_REPO]${NC}" fi fi } @@ -679,8 +679,8 @@ function ValidatePowershellModules() else # Success if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then - echo "Successfully found module [$VALIDATE_PSSA_MODULE] in system" - echo "Successfully found command [$VALIDATE_PSSA_CMD] in system" + echo -e "${NC}${F[B]}Successfully found module ${F[W]}[$VALIDATE_PSSA_MODULE]${F[B]} in system${NC}" + echo -e "${NC}${F[B]}Successfully found command ${F[W]}[$VALIDATE_PSSA_CMD]${F[B]} in system${NC}" fi fi } diff --git a/lib/worker.sh b/lib/worker.sh index 03db8460..dd36d438 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -638,7 +638,7 @@ function LintAnsibleFiles() ######################## # No Ansible dir found # ######################## - echo "WARN! No Ansible base directory found at:[$ANSIBLE_DIRECTORY]" + echo -e "${NC}${F[Y]}WARN!${NC} No Ansible base directory found at:[$ANSIBLE_DIRECTORY]" echo "skipping ansible lint" fi fi