-
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
Process multiple paths for watch config #12557
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Joana Hrotko <joana.hrotko@gmail.com>
go.mod
Outdated
@@ -198,3 +198,5 @@ require ( | |||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect | |||
sigs.k8s.io/yaml v1.4.0 // indirect | |||
) | |||
|
|||
replace github.com/compose-spec/compose-go/v2 v2.4.8 => ../compose-go |
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.
Hey @jhrotko 👋
You need to replace compose-go
with a version of your fork 😉
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.
Coucou @glours ! 😉
Done
Signed-off-by: Joana Hrotkó <joana.hrotko@gmail.com>
LGTM just as a side not, support for multiple paths in watch definition could also be implemented as some syntaxic sugar in compose-go, i.e. while parsing we translate multiple This would avoid changes to compose and keep logic simpler (especially to later introduce support for match patterns). wdyt? |
Hey @ndeloof :) Could you confirm that when you say sugar syntax do you mean to represent the
|
Nope, I mean i.e. develop:
watch:
- path: [api, other]
action: rebuild would be cannonical-ized into: develop:
watch:
- path: api
action: rebuild
- path: other
action: rebuild Actually I see more benefits in pattern support vs multiple paths, which sounds a corder case to me |
I see, I will make this changes. The pattern matching can translate into multiple files though so these features are actually related. And can be annoying to define multiple watch rules for the same action (rebuild and restart) |
I don't get this. A basic path matches multiple files (anything under folder matches). A pattern is just more restrictive. This is unrelated to multiple values in My initial thoughts to implement this feature was to introduce an
File
.. but with a more comprehensible syntax :P |
so imagine the case where the target is a file
in this case, we need to be careful and through some error. During validation, when target is a file, compose-go needs to assert the relation 1 to 1 is true or else it will have a weird behaviour in this case. That is why I was assuming path could be treated as a []string to be easier to validate this case. The presented example I would assume it should throw an error or show a warning at least as multiple files can overwrite one file in the container |
target can't be a file, MUST be a folder. If you want to sync with file Remember |
What I did
This PR introduces multiple paths in watch configuration (In []Trigger).
These changes adapt from the compose-spec change from compose-spec/compose-go#740. For more details please check this PR.
Related issue
This PoC is based on the request
(not mandatory) A picture of a cute animal, if possible in relation to what you did