Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dockerignore with globs creates empty folders #6393

Open
cl3m0 opened this issue Jun 12, 2024 · 3 comments
Open

dockerignore with globs creates empty folders #6393

cl3m0 opened this issue Jun 12, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@cl3m0
Copy link

cl3m0 commented Jun 12, 2024

Expected Behavior

Tilt should behave same as docker when using .dockerignore files. In particular it should be able to use the ** pattern to ignore all files and directories but allow the ! pattern to include specific files.

Current Behavior

When using the ** pattern of .dockerignore to exclude everything, including a folder containing some files, in combination with the ! pattern to include some files using a glob (*), the folder is not ignored but created without containing files.
i.e.

# exclude all files
**

# include only files matching pattern
!file*.txt

Steps to Reproduce

  1. Checkout project from https://github.com/bettermarks/tilt-dockerignore
  2. Run tilt up
  3. Check the logs for the output of ls -al

Context

tilt doctor Output

$ tilt doctor
Tilt: v0.33.16, built 2024-06-07
System: linux-amd64
---
Docker
- Host: unix:///var/run/docker.sock
- Server Version: 26.1.4
- API Version: 1.45
- Builder: 2
- Compose Version: v2.27.1
---
Kubernetes
- Env: kind
- Cluster Name: kind-bm-local
- Container Runtime: containerd
- Version: v1.27.3
- Cluster Local Registry: &RegistryHosting{Host:localhost:5002,HostFromClusterNetwork:ctlptl-registry:5000,HostFromContainerRuntime:,Help:https://github.com/tilt-dev/ctlptl,SingleName:,}
---

About Your Use Case

We were facing this issue when Tilt was copying a local python virtualenv folder to the image containing empty site-package folders which led to failures starting the python project.

@cl3m0 cl3m0 added the bug Something isn't working label Jun 12, 2024
@diefans
Copy link

diefans commented Jun 12, 2024

...also to mention: docker build works as expected

@nicks
Copy link
Member

nicks commented Jun 18, 2024

thanks for the report! ya, i can repro

@nicks
Copy link
Member

nicks commented Jun 18, 2024

ah, i remember this, this is related to docker/compose#11426. if you don't create the empty directory, buildkit explodes. we have to unwind some vendor deps to get the fix, and then we can remove the dir.

nicks added a commit to nicks/fsutil that referenced this issue Jun 26, 2024
if the Map() function excludes a directory,
but includes a file inside that directory,
then the walker must backtrack and include
the directory.

otherwise, buildkit gets confused and
sends "changes out of order" errors.

part of fixing
tilt-dev/tilt#6393

Signed-off-by: Nick Santos <nick.santos@docker.com>
nicks added a commit to nicks/fsutil that referenced this issue Jul 2, 2024
if the Map() function excludes a directory,
but includes a file inside that directory,
then the walker must backtrack and include
the directory.

otherwise, buildkit gets confused and
sends "changes out of order" errors.

part of fixing
tilt-dev/tilt#6393

Signed-off-by: Nick Santos <nick.santos@docker.com>
nicks added a commit to nicks/fsutil that referenced this issue Jul 2, 2024
if the Map() function excludes a directory,
but includes a file inside that directory,
then the walker must backtrack and include
the directory.

otherwise, buildkit gets confused and
sends "changes out of order" errors.

part of fixing
tilt-dev/tilt#6393

Signed-off-by: Nick Santos <nick.santos@docker.com>
nicks added a commit to nicks/fsutil that referenced this issue Jul 3, 2024
if the Map() function excludes a directory,
but includes a file inside that directory,
then the walker must backtrack and include
the directory.

otherwise, buildkit gets confused and
sends "changes out of order" errors.

part of fixing
tilt-dev/tilt#6393

Signed-off-by: Nick Santos <nick.santos@docker.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants