Skip to content

Commit 32a22f2

Browse files
committed
Fix docker-lint job to use a better approach
The previous approach ended up with hadolint not printing file names. The new code works better and is simpler.
1 parent 1ef6621 commit 32a22f2

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,15 @@ jobs:
105105
fetch-depth: 0
106106

107107
- name: Run hadolint on Dockerfiles
108+
continue-on-error: ${{env.soft-linting == 'true'}}
108109
env:
109110
hadolint_version: 'sha256:e9dbf5113239ef2bf696d20c8f28d3019a47c26a38c98b89344d3e2846c4d5f8'
110111
run: |
111112
echo '::add-matcher::.github/problem-matchers/hadolint.json'
112-
find . -name Dockerfile | while IFS= read -r file; do
113-
echo "Checking ${file} ..."
114-
docker run --rm -i -v "${PWD}"/.hadolint.yaml:/.config/hadolint.yaml \
115-
ghcr.io/hadolint/hadolint@${{env.hadolint_version}} \
116-
${{env.soft-linting && '--no-fail'}} < "${file}"
117-
done
118-
echo 'Done ...'
113+
find . -name Dockerfile -print0 | \
114+
xargs -0 -r docker run --rm -i -v "${PWD}:/app" -w /app \
115+
--entrypoint /bin/hadolint \
116+
ghcr.io/hadolint/hadolint@${{env.hadolint_version}}
119117
120118
shell-lint:
121119
name: Shell script lint checks

0 commit comments

Comments
 (0)