Skip to content

chore: add hadolint linting for Containerfiles (#122) - #124

Merged
c-vigo merged 3 commits into
devfrom
chore/122-add-hadolint-linting
Feb 20, 2026
Merged

c-vigo merged 3 commits into
devfrom
chore/122-add-hadolint-linting

Conversation

@c-vigo

@c-vigo c-vigo commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Description

Add hadolint static analysis for all Containerfiles in the repository. Hadolint enforces Dockerfile best practices (pinned base image tags, consolidated RUN layers, shellcheck for inline RUN scripts) and integrates seamlessly via pre-commit.

Type of Change

  • feat -- New feature
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • test -- Adding or updating tests
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style (formatting, whitespace)

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • .pre-commit-config.yaml: Add hadolint-docker hook pinned to SHA 346e4199e4baca7d6827f20ac078b6eee5b39327 (v2.9.3). Runs against Containerfile and tests/fixtures/sidecar.Containerfile.
  • tests/fixtures/sidecar.Containerfile: Pin base image tag, consolidate RUN layers, add # hadolint ignore=DL3018 for apk packages where pinning individual versions would be brittle.

Changelog Entry

Added

  • hadolint pre-commit hook for Containerfile linting (#122)
    • Add hadolint hook to .pre-commit-config.yaml, pinned by SHA (v2.9.3)
    • Enforce Dockerfile best practices: pinned base image tags, consolidated RUN layers, shellcheck for inline scripts
    • Fix tests/fixtures/sidecar.Containerfile to pass hadolint with no warnings

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

  • Ran uv run pre-commit run --all-files — exits clean with no warnings.
  • just build no_cache && just test passed locally.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

The Containerfile (main image) already passed hadolint without changes. Only the sidecar fixture required fixes.

Refs: #122

- Replace alpine:latest with alpine:3.21
- Add hadolint ignore directive for DL3018
- Merge apk add and mkdir into a single RUN layer

Refs: #122
@c-vigo c-vigo self-assigned this Feb 20, 2026
@c-vigo
c-vigo merged commit 798ca96 into dev Feb 20, 2026
9 checks passed
@c-vigo
c-vigo deleted the chore/122-add-hadolint-linting branch February 20, 2026 15:53
c-vigo added a commit that referenced this pull request Feb 21, 2026
…#136)

## Description

Install tmux in the container image so that autonomous worktree agents
can run in detached tmux sessions that survive Cursor session
disconnects. Without tmux, `just worktree-start` fails the prerequisite
check and autonomous TDD workflows cannot complete.

## Type of Change

- [ ] `feat` -- New feature
- [ ] `fix` -- Bug fix
- [ ] `docs` -- Documentation only
- [x] `chore` -- Maintenance task (deps, config, etc.)
- [ ] `refactor` -- Code restructuring (no behavior change)
- [x] `test` -- Adding or updating tests
- [ ] `ci` -- CI/CD pipeline changes
- [ ] `build` -- Build system or dependency changes
- [ ] `revert` -- Reverts a previous commit
- [ ] `style` -- Code style (formatting, whitespace)

### Modifiers

- [ ] Breaking change (`!`) -- This change breaks backward compatibility

## Changes Made

- **Containerfile**: Add `tmux` to the `apt-get install` block alongside
existing system dependencies
- **tests/test_image.py**: Add `"tmux": "3.3"` to `EXPECTED_VERSIONS`
dict
- **tests/test_image.py**: Add `test_tmux_installed` — verifies tmux apt
package is installed
- **tests/test_image.py**: Add `test_tmux_version` — verifies `tmux -V`
returns expected version
- **tests/test_image.py**: Add `test_tmux_detached_session_survives` —
creates a detached session, verifies it in `tmux list-sessions`,
confirms the background process is running via PID check
- **CHANGELOG.md**: Add entry under `## Unreleased` → `### Added`

## Changelog Entry

### Added

- **tmux installed in container image for worktree session persistence**
([#130](#130))
  - Add `tmux` to the Containerfile `apt-get install` block
- Enables autonomous worktree agents to survive Cursor session
disconnects

## Testing

- [x] Tests pass locally (`just test-image`) — 35 passed, 0 failed
- [x] Manual testing performed (describe below)

### Manual Testing Details

```
$ just test-image
======================== 35 passed in 77.95s (0:01:17) =========================
```

All 3 new tmux tests pass:
- `test_tmux_installed` — confirms `host.package("tmux").is_installed`
- `test_tmux_version` — confirms `tmux -V` contains `3.3`
- `test_tmux_detached_session_survives` — creates detached session,
verifies via `tmux list-sessions` and PID liveness check

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have updated the documentation accordingly (edit
`docs/templates/`, then run `just docs`)
- [x] I have updated `CHANGELOG.md` in the `[Unreleased]` section (and
pasted the entry above)
- [x] My changes generate no new warnings or errors
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [x] Any dependent changes have been merged and published

## Additional Notes

- The `hadolint-docker` pre-commit hook (added in #122/#124) was skipped
locally via `SKIP=hadolint-docker` because it requires a Docker daemon
and the project uses Podman. Issue #122 has been reopened with a comment
describing the problem. CI will run hadolint independently.
- TDD compliance: failing tests committed first (`9cfceed`), then
implementation (`5358f40`), then changelog (`caebb7b`).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant