From 51bcce6f9b77dc5e2fb3b3c40336f68437f6c03f Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 27 Aug 2026 09:35:24 +0200 Subject: [PATCH] Use the official hadolint action for linting (#4804) Replace the hand-rolled loop that pipes every Dockerfile into a hadolint container with hadolint/hadolint-action in recursive mode. The action lints **/Dockerfile in one run, reports real file paths instead of the stdin placeholder, and registers a problem matcher so findings are annotated inline on pull requests. Because the hadolint version now comes from the action, Dependabot keeps it up to date along with the other actions instead of the hand-maintained HADOLINT_VERSION variable, which is dropped. The bundled hadolint (v2.15.1) is much newer than the pinned v1.17.2 from 2019, so extend the ignore list with the style-level rules it reports on existing Dockerfiles: DL3025 (shell-form HEALTHCHECK CMDs, needed for the piped health probes), DL3029 (--platform in FROM, intentional in silabs-multiprotocol), DL3059 and DL3066 (info), and SC3010. Co-authored-by: Claude Fable 5 --- .github/workflows/lint.yml | 16 ++++------------ .hadolint.yaml | 5 +++++ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2652fdd13..1d4dce1b0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,9 +2,6 @@ # yamllint disable rule:comments rule:line-length rule:truthy name: Lint -env: - HADOLINT_VERSION: v1.17.2 - on: pull_request: branches: ["master"] @@ -25,15 +22,10 @@ jobs: persist-credentials: false - name: Run linter - id: changed_files - run: | - shopt -s globstar - for dockerfile in **/Dockerfile; do - echo "Linting: $dockerfile" - docker run --rm -i \ - -v $(pwd)/.hadolint.yaml:/.hadolint.yaml:ro \ - hadolint/hadolint:${{ env.HADOLINT_VERSION }} < "$dockerfile" - done + uses: hadolint/hadolint-action@06be81baf89a55ffd0e24b8f04a4185738dd3387 # v3.5.0 + with: + recursive: true + config: .hadolint.yaml yamllint: runs-on: ubuntu-latest diff --git a/.hadolint.yaml b/.hadolint.yaml index 99819b5cf..788091eb2 100644 --- a/.hadolint.yaml +++ b/.hadolint.yaml @@ -6,7 +6,12 @@ ignored: - DL3008 - DL3013 - DL3018 + - DL3025 + - DL3029 - DL3042 + - DL3059 + - DL3066 - DL4006 - SC2046 - SC2086 + - SC3010