-
Notifications
You must be signed in to change notification settings - Fork 113
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
make extra_hosts values uniques #685
Conversation
override/uncity.go
Outdated
@@ -50,6 +50,7 @@ func init() { | |||
unique["services.*.environment"] = keyValueIndexer | |||
unique["services.*.env_file"] = envFileIndexer | |||
unique["services.*.expose"] = exposeIndexer | |||
unique["services.*.extra_hosts"] = keyValueIndexer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:-1
this was intentionally removed, as extra_hosts
can be set multiple time per host with distinct IPs
see docker/compose#12088
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one option could be to drop strictly equal lines, which somehow relax the json schema unicity rule, which doesn't bring any value here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll build a custom indexer
38f94a7
to
6523dd3
Compare
// Rewrite content of left slice to remove duplicate elements | ||
i := 0 | ||
for _, v := range left { | ||
if !slices.Contains(right, v) { | ||
left[i] = v | ||
i++ | ||
} | ||
} | ||
// keep only not duplicated elements from left slice | ||
left = left[:i] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use https://pkg.go.dev/slices#Compact to remove duplicates from a slice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope I tried it and it works only with consecutive values unfortunately
6523dd3
to
8231c19
Compare
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
8231c19
to
602e5ba
Compare
Thanks for the bugfix! Is there an estimated date for a new release? 😅 |
@Nek- We are not sure, but should be around in 1~2 weeks |
Issue occurred when you have an
extra_hosts
value defined in the main config file and you have anextends
of the service with the exact same name without any additionalextra_hosts
configFixes docker/compose#12155