diff --git a/Makefile b/Makefile index 5fc222ff..2050da56 100644 --- a/Makefile +++ b/Makefile @@ -31,8 +31,10 @@ generate-accounts: ALWAYS_RUN # `docker ps`: Remove any lingering test containers # `.gitignore`: Remove `test/duplicate_configs` and files copied via `make generate-accounts` clean: ALWAYS_RUN - -@ for CONTAINER in $$(docker ps -a --filter name='^dms-test_.*|^mail_.*|^hadolint$$|^eclint$$|^shellcheck$$' | sed 1d | cut -f 1-1 -d ' '); do docker rm -f $${CONTAINER}; done - -@ while read -r LINE; do [[ $${LINE} =~ test/.+ ]] && sudo rm -rf $${LINE}; done < .gitignore + -@ while read -r LINE; do CONTAINERS+=("$${LINE}"); done < <(docker ps -qaf name='^(dms-test|mail)_.*') ; \ + for CONTAINER in "$${CONTAINERS[@]}"; do docker rm -f "$${CONTAINER}"; done + -@ while read -r LINE; do [[ $${LINE} =~ test/.+ ]] && FILES+=("/mnt$${LINE#test}"); done < .gitignore ; \ + docker run --rm -v "$(REPOSITORY_ROOT)/test/:/mnt" alpine ash -c "rm -rf $${FILES[@]}" # ----------------------------------------------- # --- Tests ------------------------------------ diff --git a/test/linting/lint.sh b/test/linting/lint.sh index 3afb0cb0..bbb5d964 100755 --- a/test/linting/lint.sh +++ b/test/linting/lint.sh @@ -21,7 +21,7 @@ function _eclint if docker run --rm --tty \ --volume "${REPOSITORY_ROOT}:/ci:ro" \ --workdir "/ci" \ - --name eclint \ + --name dms-test_eclint \ "mstruebing/editorconfig-checker:${ECLINT_VERSION}" ec -config "/ci/test/linting/.ecrc.json" then _log 'info' 'ECLint succeeded' @@ -36,6 +36,7 @@ function _hadolint if docker run --rm --tty \ --volume "${REPOSITORY_ROOT}:/ci:ro" \ --workdir "/ci" \ + --name dms-test_hadolint \ "hadolint/hadolint:v${HADOLINT_VERSION}-alpine" hadolint --config "/ci/test/linting/.hadolint.yaml" Dockerfile then _log 'info' 'Hadolint succeeded' @@ -89,6 +90,7 @@ function _shellcheck if docker run --rm --tty \ --volume "${REPOSITORY_ROOT}:/ci:ro" \ --workdir "/ci" \ + --name dms-test_shellcheck \ "koalaman/shellcheck-alpine:v${SHELLCHECK_VERSION}" ${CMD_SHELLCHECK[@]} then _log 'info' 'ShellCheck succeeded'