GoogleContainerTools / GoogleContainerTools/skaffold

Files watched in sibling directory don't trigger a reload when changed

Open
#8,144 0 comments 0 reactions 0 assignees View on GitHub
area/watch kind/bug needs-reproduction priority/p3
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

### Expected behavior

Because I work in a monorepo, I have a lot of projects side by side in the same repository, but for this example, I'll show you only relevant pieces, with `backend` and `lib`, so:

```
❯ tree -L 1
.
├── backend
└── lib

2 directories, 0 files
```

I work on both of them, and when I modify files from `backend` (the main app) or from `lib`, I would like their changes to trigger a reload.

With the following configuration, located in `./backend/skaffold.yaml`, the reload is not working (skaffold stays like if there is no change) for files located in `../lib/src` (but working for others in `/src/**`).

```yaml
apiVersion: skaffold/v4beta1
kind: Config
metadata:
name: app
build:
artifacts:
- image: backend
custom:
buildCommand: |
set -euo pipefail
./gradlew buildImage
docker tag backend:latest $IMAGE

if $PUSH_IMAGE; then
exit 1
fi
dependencies:
paths:
- src/docker/
- src/main
- src/ratpack
- ../lib/src/
manifests:
kustomize:
paths:
- src/kubernetes/overlays/local/k3d
deploy:
kubeContext: k3d-app
```

FYI, I ran the command `skaffold dev` within the `./backend/` folder.

I can confirm all folders to watch are correctly set up by skaffold, because if I replace `../lib/src` by `../lib/another-folder-which-doesnt-exist`, skaffold crashes saying this folder is not available.

To bypass this limitation, I had to put the `skaffold.yaml` file into the project root with the following configuration:

```yaml
apiVersion: skaffold/v4beta1
kind: Config
metadata:
name: backend
build:
artifacts:
- image: backend
custom:
buildCommand: |
set -euo pipefail
./gradlew backend:buildImage
docker tag backend:latest $IMAGE

if $PUSH_IMAGE; then
exit 1
fi
dependencies:
paths:
- backend/src/docker/
- backend/src/main
- backend/src/ratpack
- lib/src/
manifests:
kustomize:
paths:
- backend/src/kubernetes/overlays/local/k3d
deploy:
kubeContext: k3d-app
```

With this configuration, ran with `skaffold dev` from the `./` project root, file change detection is working and I'm able to use skaffold as expected.

Because I'm in a monorepo, I'm not able of course to use `./` as a location for `skaffold.yaml` because there is hundreds of projects in the same repo and root is not a location where we can place configuration file(s).

### Information

- Skaffold version: 2.0.2
- Operating system: MacOS 12.5
- Installed via: `brew`
- Contents of skaffold.yaml:

```yaml
apiVersion: skaffold/v4beta1
kind: Config
metadata:
name: app
build:
artifacts:
- image: backend
custom:
buildCommand: |
set -euo pipefail
./gradlew buildImage
docker tag backend:latest $IMAGE

if $PUSH_IMAGE; then
exit 1
fi
dependencies:
paths:
- src/docker/harbor
- src/main
- src/ratpack
- ../lib/src/
manifests:
kustomize:
paths:
- src/kubernetes/overlays/local/k3d
deploy:
kubeContext: k3d-app
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.