fix(make): auto-detect docker/podman so Makefile works on either engine

- Makefile: introduce CONTAINER_CMD ?= $(shell command -v docker || echo podman),
  replace all 12 hardcoded `docker` invocations with $(CONTAINER_CMD). User can
  override with `make <target> CONTAINER_CMD=podman` or env export.
- e2e/tests/us1-bootstrap-admin.spec.ts: AC-1.4 regex updated to match the new
  variable form `$(CONTAINER_CMD) exec … flask create-admin` (was hardcoded
  `docker exec`). RUNTIME default also auto-detects (same logic as Makefile)
  so the test exec'es the right engine without a MIMIC_CONTAINER_CMD export.
- e2e/tests/us6-deployment.spec.ts: same RUNTIME auto-detect so the make-dry-run
  regex assertions on lines 75 + 77 match what the Makefile actually emits on
  a podman-only host.
- README + CHANGELOG document the new behavior.

Fixes the user-reported issue: "Le makefile ne fonctionne pas sur ma machine
qui n'a que podman."

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Knacky
2026-05-26 12:20:29 +02:00
parent 9ace9ac0d8
commit b3124ba4dd
5 changed files with 38 additions and 16 deletions

View File

@@ -19,7 +19,15 @@ import { adminToken, deleteUserByUsername, login, makeClient } from '../fixtures
const __dirname = dirname(fileURLToPath(import.meta.url));
const RUNTIME = process.env.MIMIC_CONTAINER_CMD ?? 'docker';
function detectRuntime(): string {
try {
execSync('command -v docker', { stdio: 'ignore' });
return 'docker';
} catch {
return 'podman';
}
}
const RUNTIME = process.env.MIMIC_CONTAINER_CMD ?? detectRuntime();
const CONTAINER = process.env.MIMIC_CONTAINER ?? 'mimic';
function runCreateAdmin(user: string, pass: string): {
@@ -100,10 +108,11 @@ test.describe('US-1 — bootstrap first admin', () => {
const token = await adminToken();
expect(token).toBeTruthy();
// Defence-in-depth: assert the Makefile target literally invokes
// `docker exec … flask create-admin`. This is a contract check.
// Defence-in-depth: assert the Makefile target wraps an `exec … flask create-admin`
// through the container engine. Sprint 2 made the engine configurable via
// $(CONTAINER_CMD) (auto-detects docker or podman), so we assert the variable form.
const makefilePath = resolve(__dirname, '../..', 'Makefile');
const content = readFileSync(makefilePath, 'utf8');
expect(content).toMatch(/docker exec .+ flask create-admin/);
expect(content).toMatch(/\$\(CONTAINER_CMD\) exec .+ flask create-admin/);
});
});