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 <zkoppert@github.com>
This commit is contained in:
Chris McIntosh 2023-11-14 23:44:46 -06:00 committed by GitHub
parent eda5b0d984
commit 6c7dc51cf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 #
################################