tilt icon indicating copy to clipboard operation
tilt copied to clipboard

Tilt watches files which should be ignored

Open elliottsj opened this issue 4 years ago • 4 comments

Steps to Reproduce

Using:

  • Tilt v0.23.2
  • macOS v12.0.1
  • Docker Desktop v4.3.0
  • Kubernetes v1.22.4
  • Apple M1 Pro

Demonstration using https://github.com/tilt-dev/ignore-examples:

git clone https://github.com/tilt-dev/ignore-examples
cd ignore-examples
tilt up

Then edit service-a/ignored-by-tiltignore.txt.

Expected Behavior

service-a does not rebuild after editing the file.

Current Behavior

service-a rebuilds:

image

$ tilt get filewatches
NAME                              CREATED AT
configs:(Tiltfile)                2021-12-10T18:02:55Z
image:ignore-examples-service-a   2021-12-10T18:02:55Z
image:ignore-examples-service-b   2021-12-10T18:02:55Z
$ tilt get filewatches image:ignore-examples-service-a -o yaml
apiVersion: tilt.dev/v1alpha1
kind: FileWatch
metadata:
  annotations:
    tilt.dev/resource: ignore-examples-service-a
    tilt.dev/target-id: image:ignore-examples-service-a
  creationTimestamp: "2021-12-10T18:02:55Z"
  name: image:ignore-examples-service-a
  ownerReferences:
  - apiVersion: tilt.dev/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: Tiltfile
    name: (Tiltfile)
    uid: 868df0fa-e7ec-457d-b6cc-78cb7c8d2bed
  resourceVersion: "13"
  uid: f1d700dd-cd08-4f8f-8219-476d0a5028af
spec:
  disableSource:
    configMap:
      key: isDisabled
      name: ignore-examples-service-a-disable
  ignores:
  - basePath: /Users/spencerelliott/dev/tilt-dev/ignore-examples/Tiltfile
  - basePath: /Users/spencerelliott/dev/tilt-dev/ignore-examples/service-a
    patterns:
    - ignored-by-docker-build-ignore.txt
  - basePath: /Users/spencerelliott/dev/tilt-dev/ignore-examples/service-a
    patterns:
    - ignored-by-dockerignore.txt
  - basePath: /Users/spencerelliott/dev/tilt-dev/ignore-examples
    patterns:
    - '*/ignored-by-tiltignore.txt'
  watchedPaths:
  - /Users/spencerelliott/dev/tilt-dev/ignore-examples/service-a
status:
  disableStatus:
    disabled: false
    lastUpdateTime: "2021-12-10T18:04:00Z"
    reason: ConfigMap/key "ignore-examples-service-a-disable"/"isDisabled" is false
  fileEvents:
  - seenFiles:
    - /Users/spencerelliott/Dev/tilt-dev/ignore-examples/service-a/not-ignored.txt
    - /Users/spencerelliott/Dev/tilt-dev/ignore-examples/service-a/not-ignored.txt
    time: "2021-12-10T18:03:37.169397Z"
  - seenFiles:
    - /Users/spencerelliott/Dev/tilt-dev/ignore-examples/service-a/ignored-by-tiltignore.txt
    - /Users/spencerelliott/Dev/tilt-dev/ignore-examples/service-a/ignored-by-tiltignore.txt
    time: "2021-12-10T18:04:00.568557Z"
  lastEventTime: "2021-12-10T18:04:00.568557Z"
  monitorStartTime: "2021-12-10T18:02:55.686026Z"

Context

tilt doctor Output

$ tilt doctor
Tilt: v0.23.2, built 2021-12-03
System: darwin-arm64
---
Docker
- Host: [default]
- Server Version: 20.10.11
- API Version: 1.41
- Builder: 2
- Compose Version: v1.29.2 (build 5becea4c)
---
Kubernetes
- Env: docker-for-desktop
- Context: docker-desktop
- Cluster Name: docker-desktop
- Namespace: default
- Container Runtime: docker
- Version: v1.22.4
- Cluster Local Registry: none
---
Thanks for seeing the Tilt Doctor!
Please send the info above when filing bug reports. 💗

The info below helps us understand how you're using Tilt so we can improve,
but is not required to ask for help.
---
Analytics Settings
--> (These results reflect your personal opt in/out status and may be overridden by an `analytics_settings` call in your Tiltfile)
- User Mode: opt-in
- Machine: 938838b4a4ce47d9bf52a35bdddad34d
- Repo: c36Oy9zA0hHsxmvf2r+9jw==

About Your Use Case

This is a minimal repro of a problem which is affecting our main repo, which contains Kubernetes host path volumes in a directory (repo)/volumes. These files are configured to be ignored by Git, Docker, and Tilt, but Tilt is watching the files and triggering unnecessary rebuilds, causing errors and slowing down our development.

elliottsj avatar Dec 10 '21 18:12 elliottsj

Update: turns out it is due to file system casing, as caught by @nicks: https://kubernetes.slack.com/archives/CESBL84MV/p1639160045008300?thread_ts=1639158484.007900&cid=CESBL84MV

Tilt computed the ignore paths using the lowercase path /Users/spencerelliott/dev, however the actual path on disk is /Users/spencerelliott/Dev. This was due to using cd dev in my shell rather than cd Dev. With the correct cd Dev, the issue is gone.

elliottsj avatar Dec 10 '21 18:12 elliottsj

thanks! i'm pretty certain there's some bug here where tilt isn't doing the path normalization correctly, but not sure what it is yet... :thinking:

nicks avatar Dec 10 '21 20:12 nicks

@lizzthabet and i spent some time looking into this, and whew, case-sensitivity filepath canonicalization in Go is not great. there's some C and Rust code that we might need to port over

nicks avatar Dec 17 '21 20:12 nicks

Any update on this? We just got bit by this issue.

chase-miller avatar Mar 07 '24 20:03 chase-miller