compose/pkg
Nicolas De Loof 82a0ad9c44 watch: do not rebuild depends_on services on file change
`compose up --build` populates BuildOptions.Deps=true so the initial
startup also builds images for depends_on services. The watch rebuild
path reused the same BuildOptions pointer, only resetting Build.Services
to the watched service. Build.Deps stayed true, so s.build() switched
back to IncludeDependencies and rebuilt the upstream dependency too.

Fix it by working on a local copy of BuildOptions in rebuild() and
explicitly setting Deps=false. Using a local copy also removes the data
race on the shared pointer when concurrent file events fire.

Also fix a related leak in doBuildBake: the loop populating bake
configuration iterates over every service in the project (needed so
additional_contexts: service:xxx references can resolve), but it was
emitting the "Image X Building" progress event and tracking expected
images for services that were not part of serviceToBeBuild. Filter
those side-effects to the actual build set so the watch rebuild log
shows only the watched service.

Adds an e2e test reproducing the bug.

Fixes #13853

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-06-19 11:23:50 +02:00
..
api fix: provider output handling and watch rebuild re-invocation 2026-04-14 11:43:48 +02:00
bridge pkg/bridge: remove uses of go-connections 2026-02-11 12:32:37 +01:00
compose watch: do not rebuild depends_on services on file change 2026-06-19 11:23:50 +02:00
dryrun go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
e2e watch: do not rebuild depends_on services on file change 2026-06-19 11:23:50 +02:00
mocks go.mod: bump github.com/moby/moby/api v1.53.0, moby/client v0.2.2 2026-02-11 12:32:37 +01:00
remote chore: fix some comments to improve readability 2026-06-09 11:45:13 +02:00
utils fix: make e2e tests pass reliably locally with Docker Desktop 2026-05-18 10:55:41 +02:00
watch fix mixed assertion libraries in tests 2026-03-31 17:32:51 +02:00