fix(run): stop double-warning unsupported attributes on the job fallback

The fallback reload runProject uses to detect a job target passed
warnUnsupportedAttributes, the same option as the first, selective
load right before it -- which had already fired every warning once.
For the common case where the target is neither a service nor a job
(a plain typo), every finding got logged twice before falling through
to the original, correct error anyway.

skipUnsupportedAttributesWarning already exists for exactly this
secondary-load case (see its other call sites in compose.go and
completion.go); use it here too.

Signed-off-by: Nicolas De Loof <[email protected]>
This commit is contained in:
Nicolas De Loof
2026-09-21 16:35:20 +02:00
committed by Nicolas De loof
parent f9cfe76a59
commit eedf9131b4
+4 -2
View File
@@ -291,8 +291,10 @@ func runProject(ctx context.Context, dockerCli command.Cli, backend api.Compose,
// it, so the env resolution below sees the job like any selected
// service (its env_file resolves; unrelated services' env_file still
// doesn't need to exist). A target that is not a declared job keeps
// the original, precise selection error.
unselected, _, uerr := p.ToProject(ctx, dockerCli, backend, nil, warnUnsupportedAttributes, composecli.WithoutEnvironmentResolution)
// the original, precise selection error. The first load above already
// warned about unsupported attributes; skip it here so a target that
// turns out to be a plain typo doesn't get the same warnings twice.
unselected, _, uerr := p.ToProject(ctx, dockerCli, backend, nil, skipUnsupportedAttributesWarning, composecli.WithoutEnvironmentResolution)
if uerr != nil {
return nil, err
}