diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d2f769..b05d370 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [PR-12](https://github.com/itk-devops/devops_itkdev-docker-server/pull/12) Clean up Taskfile and dev tooling for `docker compose`. +* [PR-11](https://github.com/itk-devops/devops_itkdev-docker-server/pull/11) + Propagate command exit code instead of swallowing failed docker compose + commands. ## [0.0.14] - 2025-03-26 diff --git a/src/commands/docker.ts b/src/commands/docker.ts index dba5787..05850f0 100644 --- a/src/commands/docker.ts +++ b/src/commands/docker.ts @@ -13,8 +13,8 @@ exports.handler = function (argv: { [x: string]: any; base: string; debug: any; // Test env file exists. if (!utils.isFile(argv.base + '/' + env)) { - console.error('The env file not found!'); - return; + console.error(`The env (${env}) file not found!`); + process.exit(1); } // Hack to parse the commands that should be sendt to docker. diff --git a/src/modules/docker.ts b/src/modules/docker.ts index a937652..4867096 100644 --- a/src/modules/docker.ts +++ b/src/modules/docker.ts @@ -83,7 +83,11 @@ export default class Docker { if (err instanceof Error) { console.error(err.message); } - return null; + + // Propagate the failed command's exit code so callers (CI, Ansible) + // detect the failure instead of seeing a false success. + const status = (err as {status?: number | null}).status; + process.exit(typeof status === 'number' ? status : 1); } } }