From 6c7dc51cf8e690718a2687090b865111c70ad7d4 Mon Sep 17 00:00:00 2001 From: Chris McIntosh Date: Tue, 14 Nov 2023 23:44:46 -0600 Subject: [PATCH] Fixes Regex to match only container files more strictly (#4867) * #4846 fixes regex to be more strict with filenames that container Dockerfile but that are not actually dockerfiles * Debug print for ANSIBLE_DIRECTORY to see if tests exist * Trying out the =~ operator * rm echo cmd * catch the i-am-containerfile case * rm extra space * Remove quotes for shell format linter --------- Co-authored-by: Zack Koppert --- lib/functions/buildFileList.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/functions/buildFileList.sh b/lib/functions/buildFileList.sh index e527a4a7..e7ba1361 100755 --- a/lib/functions/buildFileList.sh +++ b/lib/functions/buildFileList.sh @@ -428,7 +428,10 @@ function BuildFileList() { ######################## # Use BASE_FILE here because FILE_TYPE is not reliable when there is no file extension elif [[ "${FILE_TYPE}" != "tap" ]] && [[ "${FILE_TYPE}" != "yml" ]] && - [[ "${FILE_TYPE}" != "yaml" ]] && [[ "${FILE_TYPE}" != "json" ]] && [[ "${FILE_TYPE}" != "xml" ]] && [[ "${BASE_FILE}" =~ .*(contain|dock)erfile.* ]]; then + [[ "${FILE_TYPE}" != "yaml" ]] && [[ "${FILE_TYPE}" != "json" ]] && + [[ "${FILE_TYPE}" != "xml" ]] && + [[ "${BASE_FILE}" =~ ^(.+\.)?(contain|dock)erfile$ ]]; then + ################################ # Append the file to the array # ################################