Skip to content

[BUG] Missing validation for watch causes watch to break #11507

@wmwmw

Description

@wmwmw

Description

Empty action in the watch definition can break watch, especially with path present.
This should at least fail on invalid definition.

Steps To Reproduce

I have this watch definition present:

    develop:
      watch:
        - action: sync
          path: ./src/
          target: /app
          ignore:
          - _build
        - path: ./src/

When running docker compose watch, the output for the configuration is:

Watch configuration for service "backend":
  - Action sync for path /home/...
  - Action  for path /home/...

When a file is changed, the end result is this, watch is completely broken:

Syncing "backend" after changes were detected:
  - /home/.../index.html
  - /home/.../index.html
,tar: Substituting `.' for empty member name
Ytar: .: Cannot open: File exists
tar: Exiting with failure status due to previous errors
WARN[0046] Error handling changed files for service backend: 1 error occurred:
        * copying files to a1624977dccf81a56273ab32ee4081137daa9e7b9c1689093ffc51e811364f6a: exit code 2

Compose Version

Docker Compose version 2.23.3

Docker Environment

Client:
 Version:    24.0.7
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.12.0
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  2.23.3
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions