-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
[BUG] v2.24.7 multiple changes in config
output
#11589
Comments
I'll try to gather and share some simple outputs from both versions illustrating the issues (our stack yaml is about 6000 lines now). |
We see the same in DDEV (all our tests are failing) extra_hosts:
- host.docker.internal=host-gateway became extra_hosts:
- host.docker.internal:host-gateway I tracked it down to: |
@Re4zOon could you please retitle this to something like "[BUG] v2.24.7 extra_hosts is output with colon instead of equals sign" |
extra_hosts
uses colon instead of equals sign in config
output
Here you go: What I found:
|
extra_hosts
uses colon instead of equals sign in config
outputconfig
output
Well, today is a weekend day after all: https://github.com/dwmkerr/hacker-laws?tab=readme-ov-file#hyrums-law-the-law-of-implicit-interfaces |
Yes, thats true. Just like: https://xkcd.com/1172/ |
Ok, but what compatibility is broken? If I pipe its output through itself (with varius 2.2*.* versions that I keep around) again everything seems alright: |
This change indeed took place to follow docker engine preferred format after compose-spec/compose-go#499
in both case, this is not "breaking compatibility": I'm closing this issue as "won't fix" |
I can understand the other point, but:
Its either a list, or a dictionary and its dependent on other things. This means I get random behaviour and my parser will have to check if its a list, or a dictionary, as I can't anticipate which one it will be. Fun. |
There's this:
|
As I said, I can understand all other points. My main two problems:
My parser gets a 70+ service yaml with 6000+ lines. ONE of those services has a list, all other is dictionary due to a patch. |
maybe I'm wrong and this is not about swarm/stack, but if that's the case, why don't you just use |
oh. |
(there's also |
compose file format initially evolved organically, and offered flexibility to users. The spec defines the many ways things can be set, but there's no "single way", compared to kube.yaml which just reflect the internal API structs.
Indeed, this is the price to pay with the flexibility we offer in the compose file format. You should not try to parse such a file with a shell script or naive parser expecting a fixed format. If you need to transform the config output, you should better rely on compose-go library and write your own transformation as actual code |
@ndeloof did you notice that? $ docker compose -f - config <<-'EOF'
name: oh-no
services:
service:
image: image
networks:
net:
networks:
net:
EOF
name: oh-no
networks:
default:
name: oh-no_default
net:
name: oh-no_net
services:
service:
image: image
networks:
net: null
( |
indeed, we miss removal for unused resources - but that's a distinct issue then |
I've switched to |
and to take into account profiles: #11587 $ docker compose -f - config <<-'EOF'
name: hidden
services:
service:
image: image
profiles:
- hidden
EOF
name: hidden
networks:
default:
name: hidden_default
services:
service:
image: image
networks:
default: null
profiles:
- hidden
# although --services works
$ docker compose -f - config --services <<-'EOF'
name: hidden
services:
service:
image: image
profiles:
- hidden
EOF
|
https://github.com/search?q=repo%3Adocker%2Fcompose+mirantis&type=issues |
Should have been noted here that the problem behavior here was reverted in v2.25.0. DDEV's tests can now pass with v2.25.0 |
Well, but why rely on that? The relevant part of the change was to restore a case where config did "more" - to inline the content of env files (when found) ... and this change is already subject to ... change: #11627 Who knows ... maybe config will convert all lists to maps where possible ... that's kinda' more aligned with doing "more" (plain lists are mostly for "short" forms and "long" forms, where they exist, are ... kinda' preferred and that's what I meant by doing "more" - to have config "show" you what you meant writing those files). |
actually, the docker engine API uses |
maps also "just work": services:
s1:
image: image
environment:
- VAR=foo
s2:
extends: s1
environment:
- VAR=bar
But, being a weekend day after all, when it comes to extra hosts I find it funny that the long syntax is actually shorter that the short one :D |
How can I validate if this works or not?
|
Description
Hi,
Between Docker Compose version v2.24.6 and v2.24.7 some kind of change screwed up our stack build.
So far "extra_hosts" were a list separated by "=", not they are separated by ":" and labels changed from ":" to "=".
I guess its not intentional, as now our scripts (that loads the stack yaml to grab values for ansible) of course can't do that.
Also for some reason one of the services environment variables were switched to a list. I'm still trying to find the difference, why only that service gets parsed differently.
Steps To Reproduce
No response
Compose Version
No response
Docker Environment
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: