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