New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow override to REMOVE elements by using x-null
#379
Conversation
706338c
to
185d0bf
Compare
null
x-null
c3899a0
to
687de8e
Compare
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
That is a good realization. The current behavior on I'll be honest, I'm not crazy about the Brainstorming ⬇️ Base services:
web:
build:
context: .
ssh:
- default
- mykey=~/.sshmykey.pem
ports:
- 8080:8000
environment:
FOO: 'bar' Goals:
Examples below are hypothetical overrides. (A) services:
web:
build:
ssh:
"unset:default":
environment:
"unset:FOO": Q: Should it be (B) services:
web:
build:
ssh:
_unset_: [ default ]
environment:
_unset_: [ FOO ] Q: Maybe (C) services:
web:
build:
ssh:
default: '_compose_:unset'
environment:
FOO: '_compose_:unset' Q: Do all k-v lists in Compose support map syntax? Similar to |
For reference, I think I'm leaning towards (B) and dunno if I like either (A) or (C) |
Without a major change to the json-schema, we have to stick with the two examples you described (remove element from list or environment map) is not covered by this PR. We could indeed support a custom value, or more easily use a custom yaml tag: services:
web:
build:
ssh:
!unset default:
environment:
!unset FOO: |
Oh! That's way better. I was looking at the YAML spec but did not realize you could use custom tags 😅 |
Oh, I misunderstood then 😅 I was thinking (using my same example as before) that you'd be able to do: services:
web:
build:
context: .
ssh:
default:
x-null:
environment:
FOO:
x-null: |
Doing so would fail during JSON-Schema validation :'(
|
Created #380 to explore the yaml tag approach |
Add support for special extension
x-null
to be used in override files. When set, during merge, source value is reset to empty/null.note: we can't just use
value: null
as I expected because this is used in a few places for a distinct purpose: environment variables to inherit local environment, or build.ssh key to be propagated by ssh-agentThis is an attempt to fix compose-spec/compose-spec#284