fix(watch): exclude Dockerfile and compose files from the sync loop - #14217
Open
Orivital wants to merge 1 commit into
Open
fix(watch): exclude Dockerfile and compose files from the sync loop#14217Orivital wants to merge 1 commit into
Orivital wants to merge 1 commit into
Conversation
initialSync already skipped these after docker#14117, but getWatchRules never did. A later edit was still copied into the container. Anchor the shared ignore with **/ so it matches the watch loop's absolute paths, and apply it only to copy actions so rebuild still fires. Signed-off-by: orivital <orivital2924@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
#14117 restored the
initialSyncexclusion sodocker compose watchdoes not copy the Dockerfile or compose files into the container on first sync. That PR called out that the continuous loop (getWatchRules) never had the same ignore, and that it would need a differently-anchored matcher because it matches absolute host paths rather than basenames.Without that, a
develop.watchsync on the project root still copiesDockerfile/compose.yaml(and a custombuild.dockerfile) into the container when those files change after watch has started.Shared the ignore as
dockerFileIgnoreMatcherwith**/-anchored patterns so it works for bothinitialSync's basenames and the watch loop's full paths. Applied it only to copy actions (sync,sync+restart,sync+exec) so a rebuild trigger on the same tree still fires when those files change.Test plan
go test ./pkg/compose/ -run 'TestGetWatchRules|TestInitialSync'docker compose watchon a rootsyncto/work: editingDockerfileafter start copies it into the container/workstays emptyTestWatch*e2e cases do not cover this path; the full e2e suite was not runRelated issue
N/A