Skip to content

fix(lint-compose): validate against current compose, not the runner's - #420

Merged
CybotTM merged 1 commit into
mainfrom
fix/lint-compose-current-version
Sep 15, 2026
Merged

CybotTM merged 1 commit into
mainfrom
fix/lint-compose-current-version

Conversation

@CybotTM

@CybotTM CybotTM commented Sep 15, 2026

Copy link
Copy Markdown
Member

Merging this makes the compose lint validate against current Docker Compose instead of whatever version the runner image happens to ship. Files that current compose accepts stop being reported as broken.

Why

The job ran docker compose config with the runner's preinstalled version — v2.38 today, while compose is at v5.5.1. The gap is not cosmetic. v2.38 answers pre_start with services.<name> additional properties 'pre_start' not allowed, even though that is the documented way to model init containers and current compose accepts it.

The consequence showed up in netresearch/moodle-docker: an init container written as a pre_start hook failed this lint, and the fix was to remove the construct and go back to a one-shot service. The check made the code worse rather than better — it validated against an older parser than the one deployments actually run.

What changed

docker/setup-compose-action (SHA-pinned) installs the version to validate against, defaulting to latest. A compose-version input lets callers pin a specific one, and it is forwarded through docker-image-ci.yml.

Blast radius

Measured before touching this: two repositories reference lint-compose.yml directly, plus the callers of the docker-image-ci meta workflow. A newer compose accepts a superset of what v2.38 did, so files passing today keep passing; the change can only turn currently-failing valid files green.

Assisted by claude-code:claude-opus-5 — Session

The job ran `docker compose config` with whatever version the runner image
happens to ship. That is v2.38 today, while compose is at v5.5.1, and the
gap is not cosmetic: v2.38 rejects `pre_start` with "additional properties
not allowed", although it is the documented way to model init containers and
current compose accepts it.

So the lint reported a valid file as broken, and the repository it fired in
worked around the lint by removing the construct - the check made the code
worse rather than better. Validating against an older parser than the one
deployments actually run is the wrong way round.

docker/setup-compose-action now pins the version being validated against,
defaulting to latest, with a `compose-version` input for callers that want a
fixed one. The input is forwarded through docker-image-ci.yml.

Blast radius measured before changing this: two repositories reference the
workflow, plus callers of the docker-image-ci meta. A newer compose accepts
a superset of what the old one did, so files that pass today keep passing.

Assisted-by: claude-code:claude-opus-5
Agent-Session: https://claude.ai/code/session_01FRHeDxbgUnv868eNhVCCsr
Agent-Host: 32116e
Signed-off-by: Sebastian Mendel <sebastian.mendel@netresearch.de>
Copilot AI lite review requested due to automatic review settings September 15, 2026 14:59
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: ceea144b-68cc-4a97-855d-1b92d5356997

📥 Commits

Reviewing files that changed from the base of the PR and between 6f1243c and 95f7c46.

📒 Files selected for processing (2)
  • .github/workflows/docker-image-ci.yml
  • .github/workflows/lint-compose.yml

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The reusable workflows now define a compose-version string input with a default of "latest". docker-image-ci.yml forwards this input to lint-compose.yml. The lint workflow installs the selected Docker Compose version with docker/setup-compose-action before running configuration checks.

Changes

Workflow Change
docker-image-ci.yml Adds and forwards compose-version.
lint-compose.yml Adds compose-version and installs the selected version before validation.

Priority: ⬇️ Low

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 95f7c

The workflows now select and install the requested Compose version before linting, with no concrete merge-blocking risk established.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: linting now validates against the current Docker Compose version instead of the runner's preinstalled version.
Description check ✅ Passed The description is detailed and directly supports the pull request objective. It explains the problem, implementation, affected workflows, version-pinning option, and blast radius. It does not include…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/lint-compose-current-version
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/lint-compose-current-version

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CybotTM

CybotTM commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

The Copilot reviewer is out of quota account-wide, so no bot review can land here. CodeRabbit left no inline findings and SonarCloud's quality gate passed. I reviewed the diff myself.

It is additive: a compose-version input on both workflows, the SHA-pinned docker/setup-compose-action before the validation step, and the input forwarded through the meta workflow. Nothing existing changes behaviour except the compose version the validation runs against.

One deliberate choice worth stating: the default is latest rather than a fixed version. A lint that guards deployments should validate against what current compose accepts, and callers who want reproducibility can pin via the new input. The trade-off is that a future compose release could in principle turn a run red; that would be visible immediately and is preferable to validating against a parser older than the one deployments use, which is the bug being fixed here.

Self-review: 95f7c46

@CybotTM
CybotTM merged commit 18fc517 into main Sep 15, 2026
13 of 14 checks passed
@CybotTM
CybotTM deleted the fix/lint-compose-current-version branch September 15, 2026 15:03
CybotTM added a commit to netresearch/moodle-docker that referenced this pull request Sep 15, 2026
Both compose-using jobs inherited whatever version the runner image ships.
That version rejects `pre_start`, so the syntax check failed on a file that
is valid, and the stack test would have failed to start it at all.

docker/setup-compose-action, SHA-pinned, installs the current release in
both jobs. The org-wide lint got the same treatment in
netresearch/.github#420.

Assisted-by: claude-code:claude-opus-5
Agent-Session: https://claude.ai/code/session_01FRHeDxbgUnv868eNhVCCsr
Agent-Host: 32116e
Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
CybotTM added a commit to netresearch/moodle-docker that referenced this pull request Sep 15, 2026
…t hook (#79)

Merging this removes a container that existed only to be idle, and puts
the database bootstrap back where compose says it belongs. The stack
runs five containers instead of six, and both decisions finally carry a
written reason.

## The idle cron container

`moodle-cron` ran `sleep infinity` and nothing else. Ofelia's `job-exec`
needs a running container to exec into, so a service was added purely to
be that target — while the application container, which runs anyway, can
host the job. The labels move there and the service is gone.

`job-run` would also avoid the idle container, but it needs every
volume, network and environment variable repeated in labels: a second
copy of the service definition, free to drift from the first. `job-exec`
on a container that already exists has no such duplication.

## The pre_start hook

The bootstrap was written as a `pre_start` hook, which is how compose
models init containers, and then reverted to a one-shot service because
the compose on the CI runners rejected the key. That was the wrong
repair — it changed working code to suit an outdated linter.
netresearch/.github#420 makes the lint validate against current compose,
so the hook returns: the step stays subordinate to the service instead
of appearing as a peer in `compose ps`.

## Verified

On a full stack, not from the file: five containers instead of six,
`pre_start` creates database and user, the Moodle install completes,
ofelia registers `moodle.moodle-cron` and runs it to completion
(`failed: false, error: none`), **19 scheduled tasks show a
`lastruntime`** — so Moodle actually processed the runs — and the site
answers 200. yamllint and markdownlint report nothing.

## Note

Neither arrangement was documented anywhere before; the README described
*that* there was a dedicated cron container, never why. Both now carry
their reasoning inline, including why `job-run` was not chosen.

_Assisted by claude-code:claude-opus-5 —
[Session](https://claude.ai/code/session_01FRHeDxbgUnv868eNhVCCsr)_
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.

2 participants