compose-go/loader/normalize.go
Nicolas De Loof 97477a39fe loader: carry deploy.restart_policy into restart and let it win over restart
restart and deploy.restart_policy are two spellings of one policy:
condition is its name and max_attempts its retry count. Each may complete
the other, and normalization writes the outcome in restart, so a
restart_policy made of a delay alone (docker/compose#14383) leaves restart
as it is instead of clobbering it.

Where both say something different, deploy.restart_policy wins, as the spec
has it and as Docker Compose applies it today: its policy is written into
restart (any is always, none is no) and a warning names the service and
both values. Nothing is rejected. A retry count only has a meaning for
on-failure and a max_attempts of zero is no limit, as for on-failure:0.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-11-16 17:12:57 +01:00

504 lines
14 KiB