-
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
watch: add tar sync implementation #10853
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## v2 #10853 +/- ##
==========================================
- Coverage 59.88% 58.37% -1.51%
==========================================
Files 118 119 +1
Lines 10064 10331 +267
==========================================
+ Hits 6027 6031 +4
- Misses 3440 3705 +265
+ Partials 597 595 -2
☔ View full report in Codecov by Sentry. |
Signed-off-by: Milas Bowman <[email protected]>
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.
LGTM 👍
@@ -0,0 +1,344 @@ | |||
/* | |||
Copyright 2018 The Tilt Dev Authors |
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.
I'm surprised the validation headers task doesn't complain about the Tilt line 🤔
Anyway this fine to have it 😉
if useTar, _ := strconv.ParseBool(os.Getenv("COMPOSE_EXPERIMENTAL_WATCH_TAR")); useTar { | ||
syncer = sync.NewTar(project.Name, tarDockerClient{s: s}) |
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.
Note: We'll need to discuss if we want to add a mode
, strategy
(or whatever the name) attribute to sync action or if we want Compose to automatically detect and choose the best sync option 🤔
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.
Yeah, for now I was doing this mostly so that I could incrementally add this and have an E2E run against both implementations while working.
Once things are merged in and look good, I think it might make sense to flip the default to enabled for one release so that watch
users automatically get the updated experience but can switch back temporarily if needed.
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.
Long-term, I think the docker cp
approach is "worse" in every scenario – the overhead of all the API calls is unavoidable (there's nothing actually wrong with the implementation). So I don't think we need to keep it.
But yes, considering we've discussed e.g. potential for daemon or alternative watch/sync implementations, it's probably worth thinking through what that might look like.
What I did
Add an alternative sync implementation based on the tilt-dev/tilt code:
rm -rf
on paths that have been deleted on the hosttar
command and write an archive tostdin
with the new/updated directories & filesFor now, this can be activated by setting
COMPOSE_EXPERIMENTAL_WATCH_TAR=1
in the environment. The E2E watch test now runs both against both implementations.There's further opportunity for optimization, e.g. we end up
stat
ing everything twice: once to determine if we should delete it upfront and once during thetar
.Note that the actual invocation of this is still serial, i.e. change-by-change.
A follow-up PR will add batching within the watch code that invokes the sync with a debounce, similar to how it handles rebuilds.
Related issue
https://docker.atlassian.net/browse/ENV-191
(not mandatory) A picture of a cute animal, if possible in relation to what you did