Skip to content

fix: propagate command exit code instead of swallowing failures - #11

Merged
turegjorup merged 4 commits into
developfrom
fix/propagate-command-exit-code
Jun 16, 2026
Merged

turegjorup merged 4 commits into
developfrom
fix/propagate-command-exit-code

Conversation

@turegjorup

@turegjorup turegjorup commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes: https://leantime.itkdev.dk/#/tickets/showTicket/6227

Failed docker compose commands were reported as successful, which is the root cause of Woodpecker deploys going green despite real failures (e.g. pre-up drush commands failing, or containers not coming online).

Changes

  • modules/docker.ts: on a non-zero exit from docker compose, exit with the underlying command's status code instead of catching the error and returning.
  • commands/docker.ts: exit non-zero when the env file is missing.
  • CHANGELOG entry under [Unreleased].

Why

execFileSync throws when the child exits non-zero, but the catch block only printed the message and returned, so the wrapper process exited 0. Ansible's shell/command tasks therefore saw rc=0, the play reported failed=0, and Woodpecker marked the job successful.

docker.exec() is the wrapper's only command-execution path — a passthrough for every docker compose subcommand (run, exec, up, pull, …) — so this single fix covers all commands the wrapper runs.

Note

The deployed assets/itkdev-docker-compose-server binary is rebuilt from source by the release workflow on tag push. After merge, a tagged release and a redeploy of the binary to the servers are required for the fix to take effect.

execFileSync throws on a non-zero exit, but the catch block printed the
error and returned, so the process exited 0 even when docker compose (and
the command it ran) failed. Callers such as Ansible and Woodpecker then
saw a successful run. Exit with the underlying command's status code, and
exit non-zero when the env file is missing.

This is the only command-execution path; it is a passthrough for all
docker compose subcommands (run, exec, up, pull, ...), so the fix covers
every command the wrapper runs.
@turegjorup turegjorup self-assigned this Jun 16, 2026
@turegjorup
turegjorup requested a review from cableman June 16, 2026 07:05
@turegjorup
turegjorup merged commit 95afa69 into develop Jun 16, 2026
1 check passed
@turegjorup
turegjorup deleted the fix/propagate-command-exit-code branch June 16, 2026 11:47
@turegjorup turegjorup mentioned this pull request Jun 16, 2026
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