Skip to content

ci(docker): lint the Dockerfiles with hadolint in pre-commit #6418

Done

Description

@dan-petty

Problem

No linter checks the two Dockerfiles (git grep -i hadolint finds only archived notes). hadolint finds the common Dockerfile mistakes.

Change

Renovate. The built-in pre-commit manager bumps the hook rev.

Risk. The DL3008 ignore records an owner decision for a new linter. It lowers no existing threshold. Before you pin the hook, check that a hadolint-py wheel exists for the runner platform.

Proof

  • uv run pre-commit run hadolint-py --all-files passes in the devcontainer.
  • Static Analysis runs it on a stock runner with no install step.

Depends on: #6414, #4361

Alternatives check of 2026-11-19: not-applicable.
Class: ci, no search.
Tool: none found.

Proposed design

Problem statement

No linter checks Dockerfile and .devcontainer/Dockerfile, so the common Dockerfile mistakes that hadolint reports go unreported. Static Analysis runs no pre-commit hook, so a hook alone would not gate a merge. The change adds the hadolint pre-commit hook, makes it a devops ci row that Static Analysis runs, ignores DL3008 only for the apt float that the owner decision of 2026-11-19 keeps, and fixes the other findings in the two Dockerfiles.

Acceptance criteria

Requirement: hadolint hook covers both Dockerfiles

The pre-commit configuration SHALL add the hadolint hook of shenxianpeng/hadolint-pre-commit at rev v2.15.1.3, so the hook runs on Dockerfile and .devcontainer/Dockerfile.

Scenario: Both Dockerfiles match the hook

  • WHEN uv run pre-commit run hadolint --files Dockerfile .devcontainer/Dockerfile --verbose runs
  • THEN The command exits 0 and prints Passed, not (no files to check).

Requirement: The two Dockerfiles pass hadolint

Both Dockerfiles SHALL pass the hadolint hook with every finding other than DL3008 fixed.

Scenario: The hook finds no other rule

  • WHEN uv run pre-commit run hadolint --all-files runs
  • THEN The command exits 0 and prints no finding.

Requirement: Only DL3008 is ignored

.hadolint.yaml SHALL ignore DL3008 only, with the reason that the apt packages float with the Debian security updates that the final stages take, by the owner decision of 2026-11-19 that devops-cli is not a package manager.

Scenario: A rule other than DL3008 still fails

  • WHEN uv run pre-commit run hadolint --all-files runs on the two Dockerfiles, and uv run pre-commit run hadolint --files .data/agent/scratch/Dockerfile runs on a scratch file that holds FROM debian:trixie-slim and RUN cd /tmp && true
  • THEN The first command exits 0 and the second exits 1 with a finding that names DL3003.

Requirement: hadolint is a devops ci row

devops ci SHALL hold a hadolint row whose command runs the hadolint pre-commit hook over all files.

Scenario: The row is the hook

  • WHEN uv run pytest tests/commands/test_ci_row_commands.py -k hadolint runs
  • THEN The test passes and asserts the row's command is uv run pre-commit run hadolint --all-files.

Requirement: The required gate runs the row

Static Analysis SHALL run the hadolint row through devops ci.

Scenario: The row passes in the gate

  • WHEN uv run devops ci --check --only hadolint runs
  • THEN The row passes and its output names hadolint.

Requirement: The runner image table names the row

RUNNER_TOOLS SHALL name ci:hadolint in the needed_by of the pre-commit tool, so the runner image check holds the hook.

Scenario: A held row program names the row

  • WHEN uv run pytest tests/roadmap/test_roadmap_runner_tools.py -k test_a_tool_that_a_row_starts_names_that_row_as_a_reason runs
  • THEN The test passes.

Existing Tool Considered

The open shenxianpeng/hadolint-pre-commit project at rev v2.15.1.3 (PyPI hadolint-py 2.15.1.3) covers the need: its hadolint hook pip-installs the official hadolint binary as a platform wheel, so a stock runner needs no install step (https://github.com/shenxianpeng/hadolint-pre-commit, fetched 2026-11-22). It lacks a universal, offline wheel: setuptools-download fetches the hadolint 2.15.1 binary from its GitHub release, and the release publishes a wheel only for Linux x86_64/arm64, macOS x86_64/arm64 and Windows x86_64, so the first run needs PyPI and, on a platform without a wheel, github.com. The upstream hadolint/hadolint hook installs no binary and is language: system, so a stock runner fails with Executable hadolint not found.

Key questions

  • Does the required Static Analysis job run the pre-commit hooks?: No. Static Analysis runs uv run devops ci --check --no-cache --skip test,outdated,actionlint, and CHECK_ROW_NAMES holds no row that runs pre-commit. A hook alone would not gate a merge. [sources: .github/workflows/ci.yml:105, src/devops_cli/commands/ci.py:136, docs/SDLC.md:205, docs/adr/0004-ci-is-the-authoritative-gate.md:11]
  • How does the hadolint hook reach the required Static Analysis check?: Add a hadolint row to the devops ci registry that runs uv run pre-commit run hadolint --all-files. Static Analysis runs every row of devops ci except the three it skips, so the lint gates merges with no separate workflow step, and uv run devops ci runs it by hand too. (best practice) [sources: .github/workflows/ci.yml:105, docs/SDLC.md:205, src/devops_cli/commands/ci.py:136, src/devops_cli/commands/ci.py:1001, tests/commands/test_ci_row_commands.py:96]
    • Chosen: Add a hadolint row to devops ci. Static Analysis runs every row of devops ci, so the lint becomes part of the required check and of the local full gate.
    • Rejected: Add a step to the Static Analysis job only. uv run devops ci by hand would not run the lint, so the local full gate and CI would differ.
    • Rejected: Keep only the pre-commit hook. Static Analysis runs no pre-commit hook, so a Dockerfile finding could merge.
  • Which hadolint integration does the repository use?: Use the hadolint hook of shenxianpeng/hadolint-pre-commit at rev v2.15.1.3, which pip-installs hadolint-py and its platform wheel (https://github.com/shenxianpeng/hadolint-pre-commit, fetched 2026-11-22). The upstream hadolint/hadolint hook installs no binary, so a stock runner fails with Executable hadolint not found. A Docker-image hook needs a container engine on the runner and pulls an image on each run. (best practice) [sources: https://github.com/shenxianpeng/hadolint-pre-commit, .pre-commit-config.yaml, .github/renovate/base.json:54]
    • Chosen: shenxianpeng/hadolint-pre-commit v2.15.1.3. It installs the binary in the hook environment, so a stock runner needs no install step, and Renovate's pre-commit manager bumps the rev.
    • Rejected: hadolint/hadolint official hook. It is language: system and installs no binary, so it fails on a stock runner with Executable hadolint not found.
    • Rejected: Docker-image hook. It needs a container engine on the runner and pulls an image on each run.
  • What does .hadolint.yaml ignore, and why?: Ignore DL3008 only. The reason beside it: the apt packages float because the final stages take the Debian security updates with apt-get upgrade, and devops-cli is not a package manager (owner decision of 2026-11-19), so the Dockerfile pins no apt version. The root Dockerfile installs git and ca-certificates without a version in the service-deps stage, and the service and mcp-server stages run apt-get upgrade with no cache. The devcontainer image takes its apt packages from the devtools image, which is Debian sid and upgrades in its own build. (best practice) [sources: openspec/changes/archive/2026-11-20-4361-runner-from-devtools/proposal.md:4]
    • Chosen: Ignore DL3008 in .hadolint.yaml with the reason. One config line records the deliberate float and keeps the reason beside it; the final stages take the security updates, and the owner decision of 2026-11-19 keeps devops-cli out of package management.
    • Rejected: Pin every apt package version. A pin freezes the package that the final stages' apt-get upgrade updates, and it copies a Debian version into the Dockerfile, which the owner decision of 2026-11-19 forbids.
    • Rejected: An inline # hadolint ignore=DL3008 on each apt line. It repeats the reason at each apt-get, and a new apt line can miss it.
  • Does a hadolint-py wheel exist for the runner platform?: Yes. The hadolint-py release publishes a platform wheel, and the hook lists Linux x86_64, Linux arm64, macOS x86_64/arm64 and Windows x86_64 as supported (https://github.com/shenxianpeng/hadolint-pre-commit, fetched 2026-11-22). The required Static Analysis job runs on ubuntu-26.04, which is Linux x86_64, so a matching wheel exists. setuptools-download fetches the official hadolint 2.15.1 binary from its GitHub release for a platform that has no wheel. [sources: https://github.com/shenxianpeng/hadolint-pre-commit, .github/workflows/ci.yml:50]
  • Does Renovate bump the hook rev?: Yes. The pre-commit manager is enabled in .github/renovate/base.json. Non-major hook updates are grouped as pre-commit hooks, so a new hadolint-pre-commit release arrives as a dependency update. [sources: .github/renovate/base.json:54, .github/renovate/base.json:81]
  • Must RUNNER_TOOLS name the new row?: Yes. test_a_tool_that_a_row_starts_names_that_row_as_a_reason fails when a held program starts a row that does not name the row. pre-commit is a held checkout tool, so its needed_by must add ci:hadolint. [sources: tests/roadmap/test_roadmap_runner_tools.py:199, src/devops_cli/roadmap/runner_tools.py:148]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6414, #4361

Activity

  1. added
    type/infra
    on Nov 19, 2026
  2. dan-petty commented on Nov 19, 2026

    @dan-petty
    OwnerAuthor
  3. added
    source/agent
    status/new
    value/medium
    effort/low
    scope/docker
    priority/p2-medium
    on Nov 19, 2026
  4. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  5. added
    status/ready
    and removed
    status/new
    on Nov 22, 2026
  6. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  7. added
    owner/agent
    status/in-progress
    and removed
    status/ready
    on Nov 24, 2026
  8. added a commit that references this issue on Nov 24, 2026
    4d7daa2
  9. added
    status/in-review
    and removed
    status/in-progress
    on Nov 24, 2026
  10. removed
    status/in-review
    owner/agent
    on Nov 24, 2026
  11. devops-cli-service commented on Nov 24, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-24 13:45 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/dockersource/agenttype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions