From 8268b233a27ece84402ca63fd38d3488b7ffb60b Mon Sep 17 00:00:00 2001 From: turegjorup Date: Wed, 26 Mar 2025 10:16:29 +0100 Subject: [PATCH 1/7] 4126: Fix links in changelog --- CHANGELOG.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c739ca..619d86e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,27 +9,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.0.14] - 2025-03-26 -* [PR-10](https://github.com/itk-dev/economics/pull/1) +* [PR-10](https://github.com/itk-devops/devops_itkdev-docker-serverpull/1) Re-Update to node:18, re-update dependencies ## [0.0.13] - 2025-03-26 -* [PR-9](https://github.com/itk-dev/economics/pull/9) +* [PR-9](https://github.com/itk-devops/devops_itkdev-docker-serverpull/9) Roll back to node:16 and dependencies lock from 0.0.9. ## [0.0.12] - 2025-03-26 -* [PR-8](https://github.com/itk-dev/economics/pull/8) +* [PR-8](https://github.com/itk-devops/devops_itkdev-docker-serverpull/8) Fix binary non uploaded as release asset ## [0.0.11] - 2025-03-26 -* [PR-7](https://github.com/itk-dev/economics/pull/7) +* [PR-7](https://github.com/itk-devops/devops_itkdev-docker-serverpull/7) Fix path in build action ## [0.0.10] - 2025-03-26 -* [PR-5](https://github.com/itk-dev/economics/pull/5) +* [PR-5](https://github.com/itk-devops/devops_itkdev-docker-serverpull/5) Update to node:18, update dependencies Update docker setup Update github actions @@ -55,7 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.0.1] - 2022-04-22 -[Unreleased]: https://github.com/itk-dev/economics/compare/0.0.14...HEAD +[Unreleased]: https://github.com/itk-devops/devops_itkdev-docker-servercompare/0.0.14...HEAD [0.0.14]: https://github.com/itk-devops/devops_itkdev-docker-server/releases/tag/0.0.14 [0.0.13]: https://github.com/itk-devops/devops_itkdev-docker-server/releases/tag/0.0.13 [0.0.12]: https://github.com/itk-devops/devops_itkdev-docker-server/releases/tag/0.0.12 From d5ec7af1a0d1b6b549179f9de693ea2cc9140d17 Mon Sep 17 00:00:00 2001 From: turegjorup Date: Tue, 16 Jun 2026 08:49:13 +0200 Subject: [PATCH 2/7] fix: propagate command exit code instead of swallowing failures 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. --- CHANGELOG.md | 4 ++++ src/commands/docker.ts | 2 +- src/modules/docker.ts | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 619d86e..19885ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +* Propagate the exit code from failed `docker compose` commands instead of + exiting 0, so callers (CI, Ansible) detect failures instead of seeing a + false success. + ## [0.0.14] - 2025-03-26 * [PR-10](https://github.com/itk-devops/devops_itkdev-docker-serverpull/1) diff --git a/src/commands/docker.ts b/src/commands/docker.ts index dba5787..8265b9a 100644 --- a/src/commands/docker.ts +++ b/src/commands/docker.ts @@ -14,7 +14,7 @@ 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; + 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); } } } From 39f79c3c3cf1a079081b626758f4028afe01538b Mon Sep 17 00:00:00 2001 From: turegjorup Date: Tue, 16 Jun 2026 08:51:23 +0200 Subject: [PATCH 3/7] docs: add PR reference to changelog entry --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19885ba..a1cf845 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -* Propagate the exit code from failed `docker compose` commands instead of - exiting 0, so callers (CI, Ansible) detect failures instead of seeing a - false success. +* [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 From 95501f5ea60b13e2a5d17d4e038b9a2ce0b7352a Mon Sep 17 00:00:00 2001 From: turegjorup Date: Tue, 16 Jun 2026 08:56:47 +0200 Subject: [PATCH 4/7] fix: include env file name in not-found error message --- src/commands/docker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/docker.ts b/src/commands/docker.ts index 8265b9a..05850f0 100644 --- a/src/commands/docker.ts +++ b/src/commands/docker.ts @@ -13,7 +13,7 @@ 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!'); + console.error(`The env (${env}) file not found!`); process.exit(1); } From 494a92ff726c52246b0acbe2e4ee053c686d4090 Mon Sep 17 00:00:00 2001 From: turegjorup Date: Tue, 16 Jun 2026 09:01:11 +0200 Subject: [PATCH 5/7] chore: clean up Taskfile and dev tooling for docker compose The Taskfile still selected compose files via DOCKER_COMPOSE_FILES_OSX, which referenced docker-compose.mac-nfs.yml - a file already removed from develop - so dev:cli was broken on macOS. Drop the dead file-selection vars and call 'docker compose run' directly. Also: rename buildTest -> build:macos, make dev:build cache via sources/generates, switch task summaries to desc, ignore .task, and document the dev workflow in the README. Completes the docker-compose -> docker compose migration started in #4 (docker-compose.yml and docker-compose.mac-nfs.yml already landed on develop). --- .gitignore | 1 + README.md | 12 +++++++++++- Taskfile.yml | 23 +++++++++++------------ package.json | 2 +- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index d704bb4..ee1b67c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ itkdev-docker-compose-server node_modules dist .pkg-cache +.task diff --git a/README.md b/README.md index 6f51b0f..91688df 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,18 @@ # Docker compose server -Simple wrapper around docker compose + +Simple wrapper around `docker compose`. > [!WARNING] > ## Needs refactor > We depend on the archived and unmaintained [pkg](https://www.npmjs.com/package/pkg). Pkg recommends Node.js 21’s > support for [single executable applications](https://nodejs.org/api/single-executable-applications.html) as an > possible alternative. + +## Development + +``` shell +task dev:install +task dev:build +``` + +Run `task dev:build --force` to force a rebuild of the `itkdev-docker-compose-server` binary. diff --git a/Taskfile.yml b/Taskfile.yml index 441cac2..ad97071 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -2,15 +2,9 @@ version: '3' dotenv: [".task.env"] -vars: - # Docker file selection - DOCKER_COMPOSE_FILES_OSX: '{{if eq OS "darwin"}}-f docker-compose.mac-nfs.yml{{end}}' - DOCKER_COMPOSE_FILES_DEFAULT: '-f docker-compose.yml {{ .DOCKER_COMPOSE_FILES_OSX }}' - DOCKER_COMPOSE_FILES: '{{.DOCKER_COMPOSE_FILES | default .DOCKER_COMPOSE_FILES_DEFAULT }}' - tasks: dev:install: - summary: Install node packages + desc: Install node packages cmds: - task dev:cli -- npm install @@ -18,16 +12,21 @@ tasks: task dev:cli -- node_modules/.bin/tsc dev:build: - summary: Build MacOS-x64 test build + desc: Build itkdev-docker-compose-server binary for local testing cmds: - - task dev:cli -- npm run buildTest + - task dev:cli -- npm run build:macos + sources: + - '*.json' + - 'src/**/*.ts' + generates: + - itkdev-docker-compose-server dev:cli: - summary: Performs command inside container. Expects parameter(s). + desc: Performs command inside container. Expects parameter(s). cmds: - - docker compose {{ .DOCKER_COMPOSE_FILES }} run --rm node {{.CLI_ARGS}} + - docker compose run --rm node {{.CLI_ARGS}} build: - summary: Build linux-x64 + desc: Build linux-x64 for production cmds: - task dev:cli -- npm run build diff --git a/package.json b/package.json index e884f07..89772bf 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "scripts": { "build": "node_modules/.bin/tsc && node_modules/.bin/pkg --targets node18-linux-x64 --output assets/itkdev-docker-compose-server .", - "buildTest": "node_modules/.bin/tsc && node_modules/.bin/pkg --targets node18-macos-x64 --output itkdev-docker-compose-server ." + "build:macos": "node_modules/.bin/tsc && node_modules/.bin/pkg --targets node18-macos-x64 --output itkdev-docker-compose-server ." }, "devDependencies": { "@types/node": "^17.0.33", From 984ad133a5a511017ec395f22688aee4408a7805 Mon Sep 17 00:00:00 2001 From: turegjorup Date: Tue, 16 Jun 2026 09:02:03 +0200 Subject: [PATCH 6/7] docs: add changelog entry for Taskfile cleanup --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 619d86e..7d2f769 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +* [PR-12](https://github.com/itk-devops/devops_itkdev-docker-server/pull/12) + Clean up Taskfile and dev tooling for `docker compose`. + ## [0.0.14] - 2025-03-26 * [PR-10](https://github.com/itk-devops/devops_itkdev-docker-serverpull/1) From 07532c2042f0d1deb5f14cfe8653b7faa69b8fc1 Mon Sep 17 00:00:00 2001 From: turegjorup Date: Tue, 16 Jun 2026 13:54:40 +0200 Subject: [PATCH 7/7] chore: release 0.0.15 --- CHANGELOG.md | 5 ++++- package.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b05d370..f004159 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.0.15] - 2026-06-16 + * [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) @@ -61,7 +63,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.0.1] - 2022-04-22 -[Unreleased]: https://github.com/itk-devops/devops_itkdev-docker-servercompare/0.0.14...HEAD +[Unreleased]: https://github.com/itk-devops/devops_itkdev-docker-server/compare/0.0.15...HEAD +[0.0.15]: https://github.com/itk-devops/devops_itkdev-docker-server/releases/tag/0.0.15 [0.0.14]: https://github.com/itk-devops/devops_itkdev-docker-server/releases/tag/0.0.14 [0.0.13]: https://github.com/itk-devops/devops_itkdev-docker-server/releases/tag/0.0.13 [0.0.12]: https://github.com/itk-devops/devops_itkdev-docker-server/releases/tag/0.0.12 diff --git a/package.json b/package.json index 89772bf..d3f8b8e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "itkdev-docker-server", - "version": "0.0.14", + "version": "0.0.15", "description": "Docker compose server site helper", "bin": "dist/index.js", "main": "dist/index.js",