diff --git a/.automation/clean-code-base-for-tests.sh b/.automation/clean-code-base-for-tests.sh index c965f144..9a7fe328 100755 --- a/.automation/clean-code-base-for-tests.sh +++ b/.automation/clean-code-base-for-tests.sh @@ -8,6 +8,7 @@ # Globals # ########### GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace +GITHUB_SHA="${GITHUB_SHA}" # Sha used to create this branch TEST_FOLDER='.automation/test' # Folder where test are stored CLEAN_FOLDER='.automation/automation' # Folder to rename to prevent skip @@ -142,6 +143,31 @@ CleanTestDockerFiles() { done } ################################################################################ +#### Function CleanSHAFolder ################################################### +CleanSHAFolder() { + info "-------------------------------------------------------" + info "Cleaning folder named:[${GITHUB_SHA}] if it exists" + + ################## + # Find the files # + ################## + REMOVE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; rm -rf "${GITHUB_SHA}" 2>&1) + + ####################### + # Load the error code # + ####################### + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ $ERROR_CODE -ne 0 ]; then + # Error + error "ERROR! Failed to remove folder:[${GITHUB_SHA}]!" + fatal "ERROR:[${REMOVE_CMD}]" + fi +} +################################################################################ #### Function RenameTestFolder ################################################# RenameTestFolder() { info "-------------------------------------------------------" @@ -184,6 +210,11 @@ CleanTestFiles ############################### CleanTestDockerFiles +############################### +# Remove sha folder if exists # +############################### +CleanSHAFolder + ################## # Re Name folder # ################## diff --git a/lib/worker.sh b/lib/worker.sh index 300355c9..a4a50fd3 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -604,7 +604,7 @@ function RunTestCases() { TestCodebase "RUBY" "rubocop" "rubocop -c ${RUBY_LINTER_RULES}" ".*\.\(rb\)\$" "ruby" TestCodebase "STATES" "asl-validator" "asl-validator --json-path" ".*\.\(json\)\$" "states" TestCodebase "TERRAFORM" "tflint" "tflint -c ${TERRAFORM_LINTER_RULES}" ".*\.\(tf\)\$" "terraform" - TestCodebase "TERRAFORM_TERRASCAN" "terrascan" "terrascan -f " ".*\.\(tf\)\$" "terraform_terrascan" + TestCodebase "TERRAFORM_TERRASCAN" "terrascan" "terrascan -f" ".*\.\(tf\)\$" "terraform_terrascan" 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 "XML" "xmllint" "xmllint" ".*\.\(xml\)\$" "xml"