mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-23 05:02:15 -05:00
commit
dbc4dc9425
6 changed files with 53 additions and 75 deletions
|
@ -87,8 +87,7 @@ CheckGHEProcess()
|
||||||
####################################################
|
####################################################
|
||||||
# Check to see if the process is alive and running #
|
# Check to see if the process is alive and running #
|
||||||
####################################################
|
####################################################
|
||||||
# shellcheck disable=SC2009
|
CHECK_PROCESS_CMD=$(pgrep -f "$GHE_APPLY_COMMAND" 2>&1)
|
||||||
CHECK_PROCESS_CMD=$(ps -aef |grep "$GHE_APPLY_COMMAND" |grep -v grep 2>&1)
|
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
|
|
@ -166,7 +166,7 @@ ValidateInput()
|
||||||
##############################
|
##############################
|
||||||
# Get the name of the branch #
|
# Get the name of the branch #
|
||||||
##############################
|
##############################
|
||||||
BRANCH_NAME=$(git branch --contains "$GITHUB_SHA" |awk '{print $2}' 2>&1)
|
BRANCH_NAME=$(git -C "$GITHUB_WORKSPACE" branch --contains "$GITHUB_SHA" |awk '{print $2}' 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -407,8 +407,7 @@ UploadImage()
|
||||||
REPO=$(echo "$GET_INFO_CMD" | awk '{print $1}')
|
REPO=$(echo "$GET_INFO_CMD" | awk '{print $1}')
|
||||||
TAG=$(echo "$GET_INFO_CMD" | awk '{print $2}')
|
TAG=$(echo "$GET_INFO_CMD" | awk '{print $2}')
|
||||||
IMAGE_ID=$(echo "$GET_INFO_CMD" | awk '{print $3}')
|
IMAGE_ID=$(echo "$GET_INFO_CMD" | awk '{print $3}')
|
||||||
# shellcheck disable=SC2116
|
SIZE="${GET_INFO_CMD##* }"
|
||||||
SIZE=$(echo "${GET_INFO_CMD##* }")
|
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Print the goods #
|
# Print the goods #
|
||||||
|
|
2
.vscode/testlinter.sh
vendored
2
.vscode/testlinter.sh
vendored
|
@ -22,5 +22,5 @@ fi
|
||||||
#########################
|
#########################
|
||||||
export RUN_LOCAL=true
|
export RUN_LOCAL=true
|
||||||
|
|
||||||
# shellcheck disable=SC1091,SC1090
|
# shellcheck source=/dev/null
|
||||||
source "$PWD"/lib/linter.sh
|
source "$PWD"/lib/linter.sh
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck disable=SC2034
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -56,8 +55,7 @@ function BuildFileList()
|
||||||
#################################################
|
#################################################
|
||||||
# Get the Array of files changed in the commits #
|
# Get the Array of files changed in the commits #
|
||||||
#################################################
|
#################################################
|
||||||
# shellcheck disable=SC2207
|
mapfile -t RAW_FILE_ARRAY < <(git -C "$GITHUB_WORKSPACE" diff --name-only "$DEFAULT_BRANCH..$GITHUB_SHA" --diff-filter=d 2>&1)
|
||||||
RAW_FILE_ARRAY=($(cd "$GITHUB_WORKSPACE" || exit; git diff --name-only "$DEFAULT_BRANCH..$GITHUB_SHA" --diff-filter=d 2>&1))
|
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -413,6 +411,8 @@ function BuildFileList()
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo ${READ_ONLY_CHANGE_FLAG} > /dev/null 2>&1 || true # Workaround SC2034
|
||||||
|
|
||||||
#########################################
|
#########################################
|
||||||
# Need to switch back to branch of code #
|
# Need to switch back to branch of code #
|
||||||
#########################################
|
#########################################
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck disable=SC1003,SC2016,SC1091
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -10,8 +9,11 @@
|
||||||
#########################
|
#########################
|
||||||
# Source Function Files #
|
# Source Function Files #
|
||||||
#########################
|
#########################
|
||||||
|
# shellcheck source=/dev/null
|
||||||
source /action/lib/buildFileList.sh # Source the function script(s)
|
source /action/lib/buildFileList.sh # Source the function script(s)
|
||||||
|
# shellcheck source=/dev/null
|
||||||
source /action/lib/validation.sh # Source the function script(s)
|
source /action/lib/validation.sh # Source the function script(s)
|
||||||
|
# shellcheck source=/dev/null
|
||||||
source /action/lib/worker.sh # Source the function script(s)
|
source /action/lib/worker.sh # Source the function script(s)
|
||||||
|
|
||||||
###########
|
###########
|
||||||
|
@ -147,16 +149,16 @@ DEFAULT_IFS="$IFS" # Get the Default IFS for updating
|
||||||
###############################################################
|
###############################################################
|
||||||
# Default Vars that are called in Subs and need to be ignored #
|
# Default Vars that are called in Subs and need to be ignored #
|
||||||
###############################################################
|
###############################################################
|
||||||
# shellcheck disable=SC2034
|
|
||||||
DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors
|
DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors
|
||||||
# shellcheck disable=SC2034
|
echo "${DEFAULT_DISABLE_ERRORS}" > /dev/null 2>&1 || true # Workaround SC2034
|
||||||
RAW_FILE_ARRAY=() # Array of all files that were changed
|
RAW_FILE_ARRAY=() # Array of all files that were changed
|
||||||
# shellcheck disable=SC2034
|
echo "${RAW_FILE_ARRAY[*]}" > /dev/null 2>&1 || true # Workaround SC2034
|
||||||
READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if files changed are not txt or md
|
READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if files changed are not txt or md
|
||||||
# shellcheck disable=SC2034
|
echo "${READ_ONLY_CHANGE_FLAG}" > /dev/null 2>&1 || true # Workaround SC2034
|
||||||
TEST_CASE_FOLDER='.automation/test' # Folder for test cases we should always ignore
|
TEST_CASE_FOLDER='.automation/test' # Folder for test cases we should always ignore
|
||||||
# shellcheck disable=SC2034
|
echo "${TEST_CASE_FOLDER}" > /dev/null 2>&1 || true # Workaround SC2034
|
||||||
DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory
|
DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory
|
||||||
|
echo "${DEFAULT_ANSIBLE_DIRECTORY}" > /dev/null 2>&1 || true # Workaround SC2034
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# Array of changed files #
|
# Array of changed files #
|
||||||
|
@ -265,8 +267,7 @@ GetLinterVersions()
|
||||||
###################
|
###################
|
||||||
# Get the version #
|
# Get the version #
|
||||||
###################
|
###################
|
||||||
# shellcheck disable=SC2207
|
mapfile -t GET_VERSION_CMD < <("$LINTER" --version 2>&1)
|
||||||
GET_VERSION_CMD=($("$LINTER" --version 2>&1))
|
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -357,11 +358,9 @@ GetStandardRules()
|
||||||
# Only env vars that are marked as true
|
# Only env vars that are marked as true
|
||||||
GET_ENV_ARRAY=()
|
GET_ENV_ARRAY=()
|
||||||
if [[ "$LINTER" == "javascript" ]]; then
|
if [[ "$LINTER" == "javascript" ]]; then
|
||||||
# shellcheck disable=SC2207
|
mapfile -t GET_ENV_ARRAY < <(yq .env "$JAVASCRIPT_LINTER_RULES" | grep true)
|
||||||
GET_ENV_ARRAY=($(yq .env "$JAVASCRIPT_LINTER_RULES" |grep true))
|
|
||||||
elif [[ "$LINTER" == "typescript" ]]; then
|
elif [[ "$LINTER" == "typescript" ]]; then
|
||||||
# shellcheck disable=SC2207
|
mapfile -t GET_ENV_ARRAY < <(yq .env "$TYPESCRIPT_LINTER_RULES" | grep true)
|
||||||
GET_ENV_ARRAY=($(yq .env "$TYPESCRIPT_LINTER_RULES" |grep true))
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
|
@ -612,8 +611,7 @@ GetGitHubVars()
|
||||||
######################
|
######################
|
||||||
# Get the GitHub Org #
|
# Get the GitHub Org #
|
||||||
######################
|
######################
|
||||||
# shellcheck disable=SC2002
|
GITHUB_ORG=$(jq -r '.repository.owner.login' < "$GITHUB_EVENT_PATH" )
|
||||||
GITHUB_ORG=$(cat "$GITHUB_EVENT_PATH" | jq -r '.repository.owner.login' )
|
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# Validate we have a value #
|
# Validate we have a value #
|
||||||
|
@ -629,8 +627,7 @@ GetGitHubVars()
|
||||||
#######################
|
#######################
|
||||||
# Get the GitHub Repo #
|
# Get the GitHub Repo #
|
||||||
#######################
|
#######################
|
||||||
# shellcheck disable=SC2002
|
GITHUB_REPO=$(jq -r '.repository.name' < "$GITHUB_EVENT_PATH" )
|
||||||
GITHUB_REPO=$(cat "$GITHUB_EVENT_PATH"| jq -r '.repository.name' )
|
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# Validate we have a value #
|
# Validate we have a value #
|
||||||
|
@ -1109,8 +1106,7 @@ if [ "$VALIDATE_OPENAPI" == "true" ]; then
|
||||||
###############################################################################
|
###############################################################################
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
|
|
||||||
# shellcheck disable=SC2207
|
mapfile -t LIST_FILES < <(find "$GITHUB_WORKSPACE" -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)
|
||||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1))
|
|
||||||
for FILE in "${LIST_FILES[@]}"
|
for FILE in "${LIST_FILES[@]}"
|
||||||
do
|
do
|
||||||
if DetectOpenAPIFile "$FILE"; then
|
if DetectOpenAPIFile "$FILE"; then
|
||||||
|
|
|
@ -38,7 +38,6 @@ function LintCodebase()
|
||||||
#######################################
|
#######################################
|
||||||
# Validate we have jsonlint installed #
|
# Validate we have jsonlint installed #
|
||||||
#######################################
|
#######################################
|
||||||
# shellcheck disable=SC2230
|
|
||||||
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
|
@ -91,8 +90,7 @@ function LintCodebase()
|
||||||
#################################
|
#################################
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207,SC2086
|
mapfile -t LIST_FILES < <(find "$GITHUB_WORKSPACE" -type f -regex "$FILE_EXTENSIONS" 2>&1)
|
||||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -regex "$FILE_EXTENSIONS" 2>&1))
|
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
# Set IFS back to default #
|
# Set IFS back to default #
|
||||||
|
@ -214,6 +212,7 @@ function TestCodebase()
|
||||||
LINTER_COMMAND="$3" # Pull the variable and remove from array path (Example: jsonlint -c ConfigFile /path/to/file)
|
LINTER_COMMAND="$3" # Pull the variable and remove from array path (Example: jsonlint -c ConfigFile /path/to/file)
|
||||||
FILE_EXTENSIONS="$4" # Pull the variable and remove from array path (Example: *.json)
|
FILE_EXTENSIONS="$4" # Pull the variable and remove from array path (Example: *.json)
|
||||||
INDVIDUAL_TEST_FOLDER="$5" # Folder for specific tests
|
INDVIDUAL_TEST_FOLDER="$5" # Folder for specific tests
|
||||||
|
TESTS_RAN=0 # Incremented when tests are ran, this will help find failed finds
|
||||||
|
|
||||||
################
|
################
|
||||||
# print header #
|
# print header #
|
||||||
|
@ -229,7 +228,6 @@ function TestCodebase()
|
||||||
#####################################
|
#####################################
|
||||||
# Validate we have linter installed #
|
# Validate we have linter installed #
|
||||||
#####################################
|
#####################################
|
||||||
# shellcheck disable=SC2230
|
|
||||||
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
|
@ -256,32 +254,10 @@ function TestCodebase()
|
||||||
##########################
|
##########################
|
||||||
LIST_FILES=()
|
LIST_FILES=()
|
||||||
|
|
||||||
############################################
|
|
||||||
# Check if its ansible, as its the outlier #
|
|
||||||
############################################
|
|
||||||
if [[ "$FILE_TYPE" == "ANSIBLE" ]]; then
|
|
||||||
#################################
|
#################################
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207,SC2086,SC2010
|
mapfile -t LIST_FILES < <(find "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$INDVIDUAL_TEST_FOLDER" -type f -regex "$FILE_EXTENSIONS" ! -path "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/ansible/ghe-initialize/*" 2>&1)
|
||||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; ls ansible/ | grep ".yml" 2>&1))
|
|
||||||
else
|
|
||||||
###############################################################################
|
|
||||||
# Set the file seperator to newline to allow for grabbing objects with spaces #
|
|
||||||
###############################################################################
|
|
||||||
IFS=$'\n'
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# Get list of all files to lint #
|
|
||||||
#################################
|
|
||||||
# shellcheck disable=SC2207,SC2086
|
|
||||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; find "$INDVIDUAL_TEST_FOLDER" -type f -regex "$FILE_EXTENSIONS" ! -path "*./ansible*" 2>&1))
|
|
||||||
|
|
||||||
###########################
|
|
||||||
# Set IFS back to default #
|
|
||||||
###########################
|
|
||||||
IFS="$DEFAULT_IFS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -352,7 +328,7 @@ function TestCodebase()
|
||||||
################################
|
################################
|
||||||
# Lint the file with the rules #
|
# Lint the file with the rules #
|
||||||
################################
|
################################
|
||||||
LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/ansible" || exit; $LINTER_COMMAND "$FILE" 2>&1)
|
LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$INDVIDUAL_TEST_FOLDER" || exit; $LINTER_COMMAND "$FILE" 2>&1)
|
||||||
elif [[ "$FILE_TYPE" == "POWERSHELL" ]]; then
|
elif [[ "$FILE_TYPE" == "POWERSHELL" ]]; then
|
||||||
################################
|
################################
|
||||||
# Lint the file with the rules #
|
# Lint the file with the rules #
|
||||||
|
@ -387,11 +363,15 @@ function TestCodebase()
|
||||||
echo "ERROR: Linter CMD:[$LINTER_COMMAND $FILE]"
|
echo "ERROR: Linter CMD:[$LINTER_COMMAND $FILE]"
|
||||||
# Increment the error count
|
# Increment the error count
|
||||||
(("ERRORS_FOUND_$FILE_TYPE++"))
|
(("ERRORS_FOUND_$FILE_TYPE++"))
|
||||||
|
# Increment counter that check was ran
|
||||||
|
((TESTS_RAN++))
|
||||||
else
|
else
|
||||||
###########
|
###########
|
||||||
# Success #
|
# Success #
|
||||||
###########
|
###########
|
||||||
echo " - File:[$FILE_NAME] was linted with [$LINTER_NAME] successfully"
|
echo " - File:[$FILE_NAME] was linted with [$LINTER_NAME] successfully"
|
||||||
|
# Increment counter that check was ran
|
||||||
|
((TESTS_RAN++))
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
#######################################
|
#######################################
|
||||||
|
@ -410,14 +390,30 @@ function TestCodebase()
|
||||||
echo "ERROR: Linter CMD:[$LINTER_COMMAND $FILE]"
|
echo "ERROR: Linter CMD:[$LINTER_COMMAND $FILE]"
|
||||||
# Increment the error count
|
# Increment the error count
|
||||||
(("ERRORS_FOUND_$FILE_TYPE++"))
|
(("ERRORS_FOUND_$FILE_TYPE++"))
|
||||||
|
# Increment counter that check was ran
|
||||||
|
((TESTS_RAN++))
|
||||||
else
|
else
|
||||||
###########
|
###########
|
||||||
# Success #
|
# Success #
|
||||||
###########
|
###########
|
||||||
echo " - File:[$FILE_NAME] failed test case with [$LINTER_NAME] successfully"
|
echo " - File:[$FILE_NAME] failed test case with [$LINTER_NAME] successfully"
|
||||||
|
# Increment counter that check was ran
|
||||||
|
((TESTS_RAN++))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# Validate we ran some tests #
|
||||||
|
##############################
|
||||||
|
if [ "$TESTS_RAN" -eq 0 ]; then
|
||||||
|
#################################################
|
||||||
|
# We failed to find files and no tests were ran #
|
||||||
|
#################################################
|
||||||
|
echo "ERROR! Failed to find any tests ran for the Linter:[$LINTER_NAME]"!
|
||||||
|
echo "Please validate logic or that tests exist!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function RunTestCases #####################################################
|
#### Function RunTestCases #####################################################
|
||||||
|
@ -460,7 +456,7 @@ function RunTestCases()
|
||||||
TestCodebase "TYPESCRIPT_ES" "eslint" "eslint --no-eslintrc -c $TYPESCRIPT_LINTER_RULES" ".*\.\(ts\)\$" "typescript"
|
TestCodebase "TYPESCRIPT_ES" "eslint" "eslint --no-eslintrc -c $TYPESCRIPT_LINTER_RULES" ".*\.\(ts\)\$" "typescript"
|
||||||
TestCodebase "TYPESCRIPT_STANDARD" "standard" "standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin $TYPESCRIPT_STANDARD_LINTER_RULES" ".*\.\(ts\)\$" "typescript"
|
TestCodebase "TYPESCRIPT_STANDARD" "standard" "standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin $TYPESCRIPT_STANDARD_LINTER_RULES" ".*\.\(ts\)\$" "typescript"
|
||||||
TestCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint -c $DOCKER_LINTER_RULES" ".*\(Dockerfile\)\$" "docker"
|
TestCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint -c $DOCKER_LINTER_RULES" ".*\(Dockerfile\)\$" "docker"
|
||||||
TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c $ANSIBLE_LINTER_RULES" "ansible-lint" "ansible"
|
TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c $ANSIBLE_LINTER_RULES" ".*\.\(yml\|yaml\)\$" "ansible"
|
||||||
TestCodebase "TERRAFORM" "tflint" "tflint -c $TERRAFORM_LINTER_RULES" ".*\.\(tf\)\$" "terraform"
|
TestCodebase "TERRAFORM" "tflint" "tflint -c $TERRAFORM_LINTER_RULES" ".*\.\(tf\)\$" "terraform"
|
||||||
TestCodebase "CFN" "cfn-lint" "cfn-lint --config-file $CFN_LINTER_RULES" ".*\.\(json\|yml\|yaml\)\$" "cfn"
|
TestCodebase "CFN" "cfn-lint" "cfn-lint --config-file $CFN_LINTER_RULES" ".*\.\(json\|yml\|yaml\)\$" "cfn"
|
||||||
TestCodebase "POWERSHELL" "pwsh" "pwsh -c Invoke-ScriptAnalyzer -EnableExit -Settings $POWERSHELL_LINTER_RULES -Path" ".*\.\(ps1\|psm1\|psd1\|ps1xml\|pssc\|psrc\|cdxml\)\$" "powershell"
|
TestCodebase "POWERSHELL" "pwsh" "pwsh -c Invoke-ScriptAnalyzer -EnableExit -Settings $POWERSHELL_LINTER_RULES -Path" ".*\.\(ps1\|psm1\|psd1\|ps1xml\|pssc\|psrc\|cdxml\)\$" "powershell"
|
||||||
|
@ -505,7 +501,6 @@ function LintAnsibleFiles()
|
||||||
###########################################
|
###########################################
|
||||||
# Validate we have ansible-lint installed #
|
# Validate we have ansible-lint installed #
|
||||||
###########################################
|
###########################################
|
||||||
# shellcheck disable=SC2230
|
|
||||||
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
|
@ -545,21 +540,10 @@ function LintAnsibleFiles()
|
||||||
######################################################
|
######################################################
|
||||||
if [ -d "$ANSIBLE_DIRECTORY" ]; then
|
if [ -d "$ANSIBLE_DIRECTORY" ]; then
|
||||||
|
|
||||||
############################################################
|
|
||||||
# Check to see if we need to go through array or all files #
|
|
||||||
############################################################
|
|
||||||
if [ "$VALIDATE_ALL_CODEBASE" == "false" ]; then
|
|
||||||
# We need to only check the ansible playbooks that have updates
|
|
||||||
#LIST_FILES=("${ANSIBLE_ARRAY[@]}")
|
|
||||||
# shellcheck disable=SC2164,SC2010,SC2207
|
|
||||||
LIST_FILES=($(cd "$ANSIBLE_DIRECTORY"; ls | grep ".yml" 2>&1))
|
|
||||||
else
|
|
||||||
#################################
|
#################################
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2164,SC2010,SC2207
|
mapfile -t LIST_FILES < <(ls "$ANSIBLE_DIRECTORY/*.yml" 2>&1)
|
||||||
LIST_FILES=($(cd "$ANSIBLE_DIRECTORY"; ls | grep ".yml" 2>&1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
###############################################################
|
###############################################################
|
||||||
# Set the list to empty if only MD and TXT files were changed #
|
# Set the list to empty if only MD and TXT files were changed #
|
||||||
|
|
Loading…
Reference in a new issue