Skip to content

ci: Add lint to CI and fix the image version label #6

Closed

Description

@dan-petty

Problem

The last independent review of PR #3 (head aa9d707) approved it and left four small points:

  • No CI step runs hadolint, actionlint or shellcheck on the files of this repository. Issue feat: build and publish the devtools image from debian sid #1 says that the Dockerfile passes hadolint, but no check enforces it, so a later change can break it unseen. # check=error=true enforces only the BuildKit checks.
  • The push job's metadata step declares the latest and date tags but uses only the labels, so the org.opencontainers.image.version label of each platform image can show latest instead of the date tag that the publish job sets.
  • A comment in .github/workflows/image.yml (about line 52) gives an old image size.
  • One header comment line of Dockerfile (line 7) is 131 characters; the others wrap at about 100.

Change

  • Add a lint job to the workflow that runs on every pull request: hadolint on each Dockerfile, actionlint and zizmor on the workflows, and shellcheck on test/*.sh, with the tools from the devtools image or pinned actions, and a job timeout.
  • The push job's metadata step gives the version label the date tag.
  • Correct the size comment (or remove the number) and rewrap the Dockerfile comment.

Proof

  • The lint job fails on a pull request that adds a hadolint finding, and passes on main.
  • docker buildx imagetools inspect --raw of a pushed platform image shows the date tag in org.opencontainers.image.version.

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

Proposed design

Problem statement

PR #3 passed review and left four points open. No CI step runs hadolint, actionlint, zizmor or shellcheck on this repository, so a later change to the Dockerfile, a workflow or a test script can break a lint unseen. The push job's metadata step declares the latest tag before the date tag, so the org.opencontainers.image.version label of each platform image can show latest. A workflow comment gives a stale image size, and one Dockerfile comment line is 131 characters. The change adds a lint job, gives the version label the date tag, and fixes the two comments.

Acceptance criteria

Requirement: Lint job on pull requests and main

The image workflow SHALL run a lint job on every pull request and on every push to the default branch.

Scenario: The lint job runs on a pull request and on main

  • WHEN A live check opens a pull request and pushes to the default branch.
  • THEN Both runs show the lint job, and its hadolint, actionlint, zizmor and shellcheck steps each exit 0.

Requirement: hadolint checks every Dockerfile

The lint job SHALL run hadolint on each Dockerfile of the repository.

Scenario: A pull request adds a hadolint finding

  • WHEN A pull request adds the instruction RUN cd /tmp to Dockerfile and a live check runs the lint job.
  • THEN The lint job fails and its hadolint step prints rule DL3003 for Dockerfile.

Requirement: actionlint and zizmor check the workflows

The lint job SHALL run the maintained kjanat/actionlint fork and zizmor on every file under .github/workflows/.

Scenario: A pull request adds an unpinned action

  • WHEN A pull request adds a step with uses: actions/checkout@v4 to .github/workflows/image.yml and a live check runs the lint job.
  • THEN The lint job fails and its zizmor step reports an unpinned-uses finding for .github/workflows/image.yml.

Requirement: shellcheck checks the test scripts

The lint job SHALL run shellcheck on every test/*.sh script.

Scenario: A pull request adds a shellcheck finding

  • WHEN A pull request adds echo $UNQUOTED to test/tools.sh and a live check runs the lint job.
  • THEN The lint job fails and its shellcheck step prints SC2086 for test/tools.sh.

Requirement: Read-only lint job

The lint job MUST grant the workflow token read scope only.

Scenario: zizmor finds no excessive permission

  • WHEN A live check runs zizmor .github/workflows/image.yml.
  • THEN zizmor exits 0 and reports no excessive-permissions finding.

Requirement: Lint job timeout

The lint job MUST set timeout-minutes: 15.

Scenario: A hung lint step is cancelled after fifteen minutes

  • WHEN A live check runs the lint job with a step that sleeps for 16 minutes.
  • THEN GitHub Actions cancels the lint job, and the run shows that the job exceeded the maximum execution time of 15 minutes.

Requirement: Version label uses the date tag

The push job MUST set org.opencontainers.image.version to the date tag of each platform image.

Scenario: Inspect a pushed platform image

  • WHEN A live check pulls <image>@sha256:<platform digest> from main and runs docker image inspect --format '{{ index .Config.Labels "org.opencontainers.image.version" }}' <image>@sha256:<platform digest>.
  • THEN The command prints the date tag, not latest.

Requirement: Workflow comment states no image size

The image workflow MUST NOT state an image size in a comment.

Scenario: No size unit in a workflow comment

  • WHEN A live check runs grep -nE '^[[:space:]]*#.*[0-9]+ ?(MB|MiB|GB|GiB)' .github/workflows/image.yml.
  • THEN The command prints no line.

Requirement: Dockerfile comments wrap at 100 characters

The Dockerfile MUST wrap every explanatory comment line at 100 characters.

Scenario: No explanatory Dockerfile comment line exceeds 100 characters

  • WHEN A live check runs awk '/^[[:space:]]*#/ && !/^[[:space:]]*# (syntax|check)=/ && length > 100 { print FNR": "length }' Dockerfile.
  • THEN The command prints no line.

Existing Tool Considered

hadolint (each Dockerfile), the maintained kjanat/actionlint fork (GitHub Actions workflows), zizmor (workflow security) and shellcheck (shell scripts) are the open, maintained tools that cover the lint needs. mise.toml:14-16 records that upstream rhysd/actionlint has had no release since 1.7.12, so the fork is the maintained actionlint. The devtools image already installs hadolint, the fork and shellcheck (Dockerfile:32-33, Dockerfile:78, README.md:51-52), so their versions stay in mise.toml/mise.lock and apt; it holds no zizmor, whose documentation names the official image ghcr.io/zizmorcore/zizmor (https://docs.zizmor.sh/installation, fetched 2026-11-19). The tools lack the metadata version-label fix and the two comment fixes, which the change does in the workflow and the Dockerfile.

Key questions

  • Do the files that this issue edits exist at the refined commit?: Yes. The commit holds Dockerfile, .github/workflows/image.yml and test/tools.sh, so no other issue must land first. [sources: .github/workflows/image.yml, test/tools.sh]
  • Which workflow file holds the lint job?: .github/workflows/image.yml, because that workflow already runs on every pull request and on each push to main (.github/workflows/image.yml:4-6), so the job needs no new trigger. (best practice) [sources: .github/workflows/image.yml:4, .github/workflows/image.yml:5, .github/workflows/image.yml:6]
    • Chosen: Add the job to .github/workflows/image.yml. The workflow already runs on pull requests and on main, and it holds the image build and the test scripts.
    • Rejected: Add a new .github/workflows/lint.yml. It repeats the trigger block and the concurrency group of the image workflow.
  • Which open, maintained tools cover the lint needs?: hadolint for Dockerfiles, the maintained kjanat/actionlint fork for GitHub Actions workflows, zizmor for workflow security and shellcheck for shell scripts. mise.toml:14-16 records that upstream rhysd/actionlint has had no release since 1.7.12, so the fork is the maintained actionlint. (best practice) [sources: mise.toml:14, mise.toml:16, mise.lock:124, README.md:51, README.md:52]
    • Chosen: hadolint, the kjanat/actionlint fork, zizmor and shellcheck. Each tool targets one file type, and the fork is the maintained actionlint (mise.toml:14-16).
    • Rejected: Upstream rhysd/actionlint. It has had no release since 1.7.12 (mise.toml:14-16), so it does not know the current runner labels.
    • Rejected: One general-purpose linter. No single maintained tool covers Dockerfile, workflow and shell lint with the same rules.
    • Rejected: Custom scripts. The project would build and keep code that the tools already provide.
  • How does the lint job run the four tools?: One lint job on ubuntu-24.04 runs each tool in a container with the workspace mounted read-only. hadolint, actionlint and shellcheck come from the project's published devtools image ghcr.io/dan-petty/devtools:latest@sha256:<digest> (README.md:13-16), so their versions stay in mise.toml/mise.lock and apt and actionlint is the maintained kjanat/actionlint fork (mise.toml:14-16). zizmor comes from its official image ghcr.io/zizmorcore/zizmor@sha256:<digest> because the devtools image does not contain it (https://docs.zizmor.sh/installation, fetched 2026-11-19). The job sets permissions: contents: read. (best practice) [sources: README.md:13, README.md:16, mise.toml:16, https://docs.zizmor.sh/installation]
    • Chosen: Devtools image for hadolint, actionlint and shellcheck; zizmor's official image. The devtools image is the project's single source for the three tool versions and holds the maintained actionlint fork; zizmor is absent, and its documentation names the official image.
    • Rejected: Official images for all four. Upstream rhysd/actionlint is stale (mise.toml:14-16), the repository names no official image for the fork, and four digests copy three tool versions into the workflow against README.md:45.
    • Rejected: Install the tools at run time. The install is unpinned and slower than a pinned image.
    • Rejected: The devtools image alone. It holds no zizmor.
  • Which runner label does the lint job use?: ubuntu-24.04, the GitHub-hosted label that the image workflow and README.md:34 already use. (best practice) [sources: .github/workflows/image.yml:36, .github/workflows/image.yml:39, README.md:34]
    • Chosen: ubuntu-24.04. The jobs of the image workflow use this label, so the lint job follows the same pin.
    • Rejected: ubuntu-26.04. Only .github/workflows/clear-status.yml:16 uses it, not the image workflow.
    • Rejected: A self-hosted runner. The repository holds no runner setup.
  • How does the push job's metadata step give the version label the date tag?: Remove the latest tag from the push job's metadata tags list. The push job uses only steps.meta.outputs.labels and pushes by digest, and the publish job gives latest to the attested manifest list after the attestation, so the date tag becomes the only tag and the version label. (best practice) [sources: .github/workflows/image.yml:185, .github/workflows/image.yml:186, .github/workflows/image.yml:204, .github/workflows/image.yml:376, .github/workflows/image.yml:401]
    • Chosen: Remove the latest tag from the push job. The push job uses only the labels, so the latest tag there is dead weight and lowers the date tag.
    • Rejected: Give the date tag a higher priority. It keeps a dead tag and makes the label depend on the priority order.
    • Rejected: Set org.opencontainers.image.version in the labels input. It repeats the date expression in two places, so the two can diverge.
  • Should the workflow comment keep an image size?: Remove the size number from the comment. A corrected number goes stale after the next image change. (best practice) [sources: .github/workflows/image.yml:52]
    • Chosen: Remove the number. No number can go stale.
    • Rejected: Correct the number. A corrected number goes stale after the next image change.
  • What timeout does the lint job set?: timeout-minutes: 15. The devtools image is large (the workflow comment at line 52 gives 4.6 GB), so 15 minutes leaves room for the pull and four linters; the default is 360 minutes. (best practice) [sources: .github/workflows/image.yml:52, .github/workflows/image.yml:344]
    • Chosen: 15 minutes. Leaves room for the devtools image pull and four linters, and stops a hung job well short of the 360-minute default.
    • Rejected: 10 minutes. Tight for a pull of the large devtools image.
    • Rejected: 30 minutes. Holds a runner too long for a lint job.
    • Rejected: No timeout. The default is 360 minutes, which is too long.
  • At which column do the Dockerfile comment lines wrap?: 100 columns for the explanatory comment lines. The header comment lines at Dockerfile:4-9 wrap at about 100, and line 7 is the 131-character outlier. The # syntax= and # check= lines (Dockerfile:1-2) are parser directives and must stay on one line, so the check exempts them. (proposed)
    • Chosen: 100 characters for explanatory comments, parser directives exempt. The other header lines wrap at about 100, and the parser directives cannot wrap.
    • Rejected: 100 characters for every comment line. The # syntax= directive is longer than 100 characters and cannot wrap.
    • Rejected: 120 characters. The 131-character line would still fail and the limit would not match the other lines.
    • Rejected: Keep the 131-character line. The review asked for the rewrap.
  • Does hadolint check the test Dockerfiles too?: Yes. The lint job runs hadolint on Dockerfile, test/tools.Dockerfile and test/copy-probe.Dockerfile. (best practice) [sources: .github/workflows/image.yml:79, .github/workflows/image.yml:85, test/tools.Dockerfile, test/copy-probe.Dockerfile]
    • Chosen: Each Dockerfile. The issue says each Dockerfile, and the workflow builds the two test Dockerfiles.
    • Rejected: Only the root Dockerfile. It leaves test/tools.Dockerfile and test/copy-probe.Dockerfile unchecked.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/infra
    status/new
    value/medium
    effort/low
    on Nov 19, 2026
  2. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor
  3. changed the title [-]ci: lint the repository files in CI and fix the image version label[/-] [+]ci: Add lint to CI and fix the image version label[/+] on Nov 19, 2026
  4. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    The job shortened the title of this item. The summary had 63 characters, and the limit is 60. The type and the scope stay.

    • Before: ci: lint the repository files in CI and fix the image version label
    • After: ci: Add lint to CI and fix the image version label
    • Source of the summary: the background model
  5. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

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

    @devops-cli-service
    Contributor

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

  8. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 20, 2026
  9. removed
    status/in-review
    on Nov 20, 2026
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-mediumtype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions