From 26f16f42cb4990ceb8b80a4ed6f3ba3add40c2b6 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Wed, 24 Jun 2020 07:45:11 -0500 Subject: [PATCH 1/3] fixed ansible and powershell --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index 9bad8c8b..9ed553f6 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1822,7 +1822,7 @@ LintCodebase() # Lint the file with the rules # ################################ # Need to append "'" to make the pwsh call syntax correct, also exit with exit code from inner subshell - LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; $LINTER_COMMAND "$FILE"; exit $? 2>&1) + LINT_CMD=$(cd "$GITHUB_WORKSPACE" || exit; $LINTER_COMMAND "$FILE"; exit $? 2>&1) else ################################ # Lint the file with the rules # From d9c21f2599a42f3ebaa18d5bca7aaaa2b7a9acbb Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Wed, 24 Jun 2020 07:58:27 -0500 Subject: [PATCH 2/3] Adding ansible --- lib/linter.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 9ed553f6..9716eaa0 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -78,7 +78,7 @@ GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the comm GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace DEFAULT_BRANCH="${DEFAULT_BRANCH:-master}" # Default Git Branch to use (master by default) -ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory +ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY:-ansible}" # Ansible Directory VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files VALIDATE_YAML="${VALIDATE_YAML}" # Boolean to validate language VALIDATE_JSON="${VALIDATE_JSON}" # Boolean to validate language @@ -114,16 +114,16 @@ ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG}" # Boolean to see even more info ################ # Default Vars # ################ -DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files -DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally -DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory -DEFAULT_RUN_LOCAL='false' # Default value for debugging locally -DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases -DEFAULT_ACTIONS_RUNNER_DEBUG='false' # Default value for debugging output -RAW_FILE_ARRAY=() # Array of all files that were changed -READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if files changed are not txt or md -TEST_CASE_FOLDER='.automation/test' # Folder for test cases we should always ignore -DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors +DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files +DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally +DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/$ANSIBLE_DIRECTORY" # Default Ansible Directory +DEFAULT_RUN_LOCAL='false' # Default value for debugging locally +DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases +DEFAULT_ACTIONS_RUNNER_DEBUG='false' # Default value for debugging output +RAW_FILE_ARRAY=() # Array of all files that were changed +READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if files changed are not txt or md +TEST_CASE_FOLDER='.automation/test' # Folder for test cases we should always ignore +DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors ########################## # Array of changed files # @@ -1922,7 +1922,7 @@ TestCodebase() # Get list of all files to lint # ################################# # shellcheck disable=SC2207,SC2086 - LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; find . -type f -regex "$FILE_EXTENSIONS" ! -path "*./ansible*" 2>&1)) + LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; find . -type f -regex "$FILE_EXTENSIONS" ! -path "*./$ANSIBLE_DIRECTORY*" 2>&1)) fi ################## @@ -1994,7 +1994,7 @@ TestCodebase() ################################ # 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/$ANSIBLE_DIRECTORY" || exit; $LINTER_COMMAND "$FILE" 2>&1) elif [[ "$FILE_TYPE" == "POWERSHELL" ]]; then ################################ # Lint the file with the rules # From 97612aab7eba9cf385024e71e6ee7cf74a3963dd Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Wed, 24 Jun 2020 08:12:53 -0500 Subject: [PATCH 3/3] put it back, its magic --- lib/linter.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 9716eaa0..9099b04b 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -78,7 +78,7 @@ GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the comm GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace DEFAULT_BRANCH="${DEFAULT_BRANCH:-master}" # Default Git Branch to use (master by default) -ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY:-ansible}" # Ansible Directory +ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files VALIDATE_YAML="${VALIDATE_YAML}" # Boolean to validate language VALIDATE_JSON="${VALIDATE_JSON}" # Boolean to validate language @@ -114,9 +114,9 @@ ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG}" # Boolean to see even more info ################ # Default Vars # ################ -DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files -DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally -DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/$ANSIBLE_DIRECTORY" # Default Ansible Directory +DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files +DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally +DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory DEFAULT_RUN_LOCAL='false' # Default value for debugging locally DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases DEFAULT_ACTIONS_RUNNER_DEBUG='false' # Default value for debugging output @@ -1922,7 +1922,7 @@ TestCodebase() # Get list of all files to lint # ################################# # shellcheck disable=SC2207,SC2086 - LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; find . -type f -regex "$FILE_EXTENSIONS" ! -path "*./$ANSIBLE_DIRECTORY*" 2>&1)) + LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; find . -type f -regex "$FILE_EXTENSIONS" ! -path "*./ansible*" 2>&1)) fi ################## @@ -1994,7 +1994,7 @@ TestCodebase() ################################ # Lint the file with the rules # ################################ - LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$ANSIBLE_DIRECTORY" || exit; $LINTER_COMMAND "$FILE" 2>&1) + LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/ansible" || exit; $LINTER_COMMAND "$FILE" 2>&1) elif [[ "$FILE_TYPE" == "POWERSHELL" ]]; then ################################ # Lint the file with the rules #