Skip to content

fix(restart): map deploy.restart_policy condition 'any' to 'always'#422

Merged
Jaro-c merged 1 commit into
developfrom
fix/restart-policy-any
Jun 17, 2026
Merged

fix(restart): map deploy.restart_policy condition 'any' to 'always'#422
Jaro-c merged 1 commit into
developfrom
fix/restart-policy-any

Conversation

@Jaro-c

@Jaro-c Jaro-c commented Jun 17, 2026

Copy link
Copy Markdown
Member

Addresses item 1 of #418.

Problem

deploy.restart_policy.condition: any (and the unset default) means "restart under any circumstance" per the compose spec — docker-compose maps it to always. podup mapped it to unless-stopped, which silently skips restarts after an explicit stop. Behavioral divergence.

Fix

Map any (and the unset default) → always. Unknown conditions still fall back to unless-stopped. One-line change in build_restart_policy + 2 unit tests (condition: any and unset default both → always).

cargo test --lib restart_policy green (13 tests); fmt + clippy clean.

Scope

#418 bundles three divergences; this PR handles only the restart mapping (clean, safe, unit-testable). The other two are deliberately deferred:

Refs #418 (keep open for the remaining two items).

The compose spec defines restart_policy.condition: any (also the default
when unset) as 'restart under any circumstance', which docker-compose maps
to the 'always' Podman policy. podup mapped it to 'unless-stopped', which
silently skips restarts after an explicit stop — a behavioral divergence
from docker-compose.

Map 'any' (and the unset default) to 'always'; unknown conditions still
fall back to 'unless-stopped'.

Refs #418

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
@Jaro-c Jaro-c added type:bug Something broken prio:P2 Medium area:engine labels Jun 17, 2026
@Jaro-c Jaro-c merged commit 02cbd2a into develop Jun 17, 2026
13 checks passed
@Jaro-c Jaro-c deleted the fix/restart-policy-any branch June 17, 2026 10:49
Jaro-c added a commit that referenced this pull request Jun 17, 2026
…CPU/tmpfs, NOTICE) (#425)

Promote verified develop fixes to main (merge, **no tag** — not a
release; tag is cut later when releasing).

Brings to main:
- #421 (closes #417, P1): synthesize `<project>_default` network so
services with no `networks:` block resolve each other by name.
Real-Podman verified.
- #422 (#418 item 1): `deploy.restart_policy.condition: any` → `always`.
- #423 (closes #408): quadlet emits CPU limits via `PodmanArgs=`.
- #424 (#419 item 1): quadlet long-form tmpfs → `Tmpfs=`.
- #409: NOTICE `podman-compose` → `podup`.

All merged to develop individually with CI green + unit/integration
tests. No public API change (bug fixes); no version bump, no release.
Jaro-c added a commit that referenced this pull request Jun 17, 2026
…it (#436)

Closes #418 (the remaining items; item 1 — restart `any`→`always` —
shipped in #422).

## Item 2 — healthcheck timing
`wait_healthy` polled a hard-coded 2s for `retries` probes, ignoring the
compose `interval` and `start_period`. A service with a long
`start_period` could be declared timed-out before it had a chance to
boot — diverging from docker-compose `depends_on: { condition:
service_healthy }`. Now polls at the `interval` (>=1s, else 2s) and adds
probes spanning `start_period`. **Defaults unchanged** (2s × 30 = 60s)
so existing behaviour is preserved. Logic extracted to a pure
`health_poll_plan` with unit tests; `depends_on_service_healthy`
integration test passes on real Podman.

## Item 3 — container naming
Documented (not changed): a single-replica service is
`<project>-<service>`; docker-compose v2 always appends `-1`. Added to
`docs/docker-migration.md` so migrating users know. Changing the scheme
would rename/recreate every existing container, so it stays documented
rather than altered.

Closes #418.

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:engine prio:P2 Medium type:bug Something broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant