Commit graph

3 commits

Author SHA1 Message Date
Nicolas De Loof
6ac9323ede Revert the Logger option: warnings go through the global logrus logger again
Routing the warnings to a logging.Logger given by the caller cannot be
complete without new variants of the exported functions that warn (dotenv,
types.Project, paths...), and doubling the exported API for it is a bigger
cost than the benefit. The warnings are written to the standard logrus
logger again, as they were before the Logger option.

This reverts, in order:
- 0a2be5d feat: route more warnings to the configured Logger
- 85a97c0 cli: add WithLogger to route project discovery and loading warnings
- 0481a82 loader: add Options.Logger to route loading warnings
- 414395c template: let callers route the unset variable warning to a logger

and e24266a template: WithoutLogging also silences nested substitutions,
which only made sense with the Logger option: template.go goes back to its
state before 414395c, and the fuzz test of the template package to its state
before e24266a. The version conformance test now reads the warning from the
standard logrus logger instead of Options.Logger.

The type casts of the interpolation stay built for each load, as they have been
while the Logger option existed, rather than shared again through a package
level map that a caller could alter for every other load.

None of these commits belongs to a release.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-25 14:08:20 +01:00
Nicolas De Loof
414395c352 template: let callers route the unset variable warning to a logger
Add a logging.Logger contract and a template.WithLogger option. Without
the option, the warning is still written through the standard logrus
logger, unchanged. Default values and error messages carried by a
substitution, as well as the text following a braced expression, report
to the same logger as the outer substitution.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-22 17:40:19 +02:00
Nicolas De Loof
11feead015 feat: resolve pre_start inheritance at load time
The pre_start hook specification used to be completed by the runtime
(docker/compose merged the service's container specification under the
hook's, through this module's own merge machinery). The resolution now
happens during loading, in the normalization phase: the loaded model
carries hooks already completed with every inherited attribute, so any
consumer — compose config included — sees the specification a hook
actually runs with.

The merge follows the compose rules, applied post-canonicalization by
wrapping the hook as a service entry so the per-attribute mergers
match: the hook's declarations win on conflicts, collections merge,
and the sequence merge's strictly-identical-entry dedup makes the
resolution idempotent — loading an already-resolved model resolves to
the same hooks, so config round-trips stay stable.

The inherited side is filtered to container-spec attributes (derived
from the ContainerSpec type by reflection, so the filter cannot drift
from the model), minus volumes: mounts inherit at runtime through
volumes_from, the only mechanism able to share the parent's anonymous
and image volumes. This subsumes the image-only inheritance of
compose-spec#647 (inheritPreStartImage).

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-09-10 17:44:16 +02:00