compose/pkg/e2e/testdata/TestFileReferenceOverridesWarning/compose.yaml
Nicolas De Loof 228bb9738c fix(config): warn about ignored uid/gid/mode at creation, not at load
uid, gid and mode on a service-level configs:/secrets: reference are applied
when the object is copied into the container (content: and environment:
sources) and dropped when it is bind-mounted (file: sources). That is a
property of how the container is created, not of the compose file, and an
engine able to set ownership on bind mounts would change the answer.

Report them from create(), next to the other creation-time warnings, once
per requested service, instead of from the load-time unsupported-attribute
check. The false positive on inline and environment sources goes away
without post-filtering findings against the loaded project.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-11-05 09:47:51 +01:00

38 lines
763 B
YAML

services:
# `file:` sources are bind-mounted as-is: uid/gid/mode are ignored.
file-refs:
image: alpine
configs:
- source: fileconfig
uid: "1000"
gid: "1000"
mode: 0o440
secrets:
- source: filesecret
uid: "1000"
mode: 0o440
# `content:` / `environment:` sources are copied in: uid/gid/mode are applied.
inline-refs:
image: alpine
configs:
- source: inlineconfig
uid: "1000"
gid: "1000"
mode: 0o440
secrets:
- source: envsecret
uid: "1000"
mode: 0o440
configs:
fileconfig:
file: ./myconfig.txt
inlineconfig:
content: hello
secrets:
filesecret:
file: ./mysecret.txt
envsecret:
environment: SECRET_VALUE