Repository navigation
Conversation
|
While I understand the intent, I don't like we get the config content added into the service hash. This also only makes sense as the config content is inlined. |
why?
I don't get the idea, time it was created - do you mean config file? or docker-compose.yaml? but docker-compose can refer to external config file |
|
time container was created, so we can check it needs to be recreated if current config doesn't match |
|
Some poins:
|
|
@ndeloof thanks for the details. pushed changes:
Let me know if you have better idea for the label name, because I'm not fully satisfied with my name) |
284468c to
2aa70c0
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11931 +/- ##
==========================================
- Coverage 51.78% 51.69% -0.10%
==========================================
Files 156 157 +1
Lines 15697 15800 +103
==========================================
+ Hits 8129 8168 +39
- Misses 6763 6807 +44
- Partials 805 825 +20 ☔ View full report in Codecov by Sentry. |
cc14e73 to
309fd59
Compare
| data = append(data, b.Bytes()...) | ||
| } | ||
|
|
||
| return digest.SHA256.FromBytes(data).Encoded(), nil |
There was a problem hiding this comment.
I'd prefer we have one label per config/secret mount, so it makes it easier to track|debug changes and container being recreated.
Also need to consider config can be mounted from docker host, i.e. file is not available for compose to compute hash, and then must be excluded from label / no label created. createTarForConfig could return ErrNotFound and we would ignore it for this specific usage
There was a problem hiding this comment.
do you mean something like that:
com.docker.compose.service.configs-hash-{configName}={hash}
com.docker.compose.service.configs-hash-{serviceName}={hash}
?
There was a problem hiding this comment.
indeed, or maybe, to follow the dot-notation style used for labels, com.docker.compose.service.configs.{configName}.hash
There was a problem hiding this comment.
It seems to me that this will complicate the logic, first you need to generate a hash for each item separately, then you need to go through all labels whose names start with “com.docker.compose.service.configs.” to check if the hash has changed.
There was a problem hiding this comment.
Doesn't look such a pain to me, as this would allow to trace reason we recreate a container, and make it easier to diagnose potential regressions (this sometimes happened :P)
for c := range service.Configs {
hash := labels["com.docker.compose.configs."+c+".hash"]
expected := ConfigHash(project.Configs[c]
if hash := expected {
log.Debug("container has to be recreated after config %s has been updated", c)
return DIVERGED
}
}There was a problem hiding this comment.
@ndeloof, but we don't have a config/service name that we can use to create the label name. I pushed changes to create a hash of the config/secret of each service so it'll be easy to figure out what service's config/secret caused the change
|
This issue has been automatically marked as not stale anymore due to the recent activity. |
|
This would be a really great addition, anything I can help out with? |
no, thank you, waiting for @ndeloof response |
|
@idsulik Maybe it might make sense to fix the failing linting checks before another round of reviews? |
|
@ndeloof could you please check it? |
|
@glours hi! Maybe you can check it? otherwise, it can be stuck here for a long time |
|
@ndeloof Anything I can do to help move this forward? |
|
I have to resolve conflicts several times, could you please check it? @ndeloof |
Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
|
Would it be possible to get this in? I just ran into the problem it would fix. |
What I did
Fixed
hash.ServiceHash()to support config content changeRelated issue
#11900