You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
🐞 defaultPath cannot use files ignored by .gitignore on dagger call #10994
With the new dagger version v0.18.17, we are automatically applying .gitignore when calling host.Directory.
But that means you can't use an ignored file as a argument anymore:
changed the title [-]🐞 Cannot use files ignored by .gitignore on `dagger call`[/-][+]🐞 defaultPath cannot use files ignored by .gitignore on `dagger call`[/+]on Sep 5, 2025
Lol mine was 4 minutes later #10996. I guess I'll close it. Here is my original issue:
This erroneously affects files that are already added staged (for ex with git add --force, or added prior to .gitignore modifications), but would have fallen under .gitignore if they wouldn't.
I have a few small .mp4 files checked into the repo for testing purposes. My .gitignore also ignores **/.mp4. My tests in Dagger now started failing after an upgrade to 0.8.17.
Files explicitly added to git should not be excluded from COPY operations - that's valid source code!
Reacted by Attila Babo, Javier Gómez Rodríguez, Vasek - Tom C, Nathan Joslin and vpuri-anduril
I opened this PR to ensure we won't break old modules with the gitignore changes: #11011, I should have been done before the release but better later than never.
I also did some tests and it seems it's absolutely impossible to bypass the auto ignore from a dagger call.
But it's totally possible from dagger shell, here's an example:
@jedevc@TomChv should we narrow the scope of auto-gitignore to only module loading, and not default arguments? It seems like a reasonable short-term fix:
It appears it would fix all real-world regressions we know about
It leaves the door open to expanding it later (without rushing)
We still get a major benefit with faster module loading
wdyt?
Reacted by Michael Kirk, Justin Chadwell, Vasek - Tom C and Nadir
Again, how come files added to git are ignored as well?
It makes complete sense to auto-ignore random files that are not part of the source code (not added to git), but there may be legit source code files that overlap with .gitignore (git add --force, added before the .gitignore rule matching them was added)!
@danielgafni I wasn't sure, based on your issue, how exactly you consume those mp4 files. I assumed it was via an argument of type Directory or File, using +defaultPath. If that's the case, then the fix I propose would fix it, since .gitignore wouldn't apply to those files at all.
Again, how come files added to git are ignored as well?
It makes complete sense to auto-ignore random files that are not part of the source code (not added to git), but there may be legit source code files that overlap with .gitignore (git add --force, added before the .gitignore rule matching them was added)!
By the way, I find DefaultPath not working for me at all, I can't omit it in my commands. I still always have to pass --root-dir . Is something wrong with my code? 🤔
By the way, I find DefaultPath not working for me at all, I can't omit it in my commands. I still always have to pass --root-dir . Is something wrong with my code? 🤔
Default path is applied to function arguments, in your case it's seems that it's a field?
This snagged me yesterday as I tried to pass explicit paths that were in gitignore for post processing and encryption (.artifacts , .cache).
While I love that by default more filtering is done, I'm attempting to produce artifacts and process items I want to cache/reload in next dagger call, such as testing pgp certs, yaml artifacts to further process, and others.
The behavior I expected was letting me pass in a specific directory, and not filtering that. However, I think I'd be fine with it being filtered if I had some type of option that was something like // +no-auto-ignores so I could opt in to including files.
In general I do think the behavior of respecting gitignore is actually really good.
I corrupted a repo once because of a glitch because it was touching the .git directory and didn't end up copying the contents back out.
Knowing the ignored content like git directory is excluded without me having to specify on every directory mounting of the repo is a good thing to me, as long as I can still choose to pass in options explicitly.
This just broke me so I also want to throw in my upvote here :). I have intermediate steps in a pipeline that produce artifacts that I don't want to be pushed to git but are still needed for pipeline functionality.
Eg: lint reports and unit test coverage reports that I push to sonar. They are generated in separate dagger calls and written to local workspace. I need them to be loaded when my +defaultPath=. loads my workspace.
From what I understand with #11017, the autoGitIgnore is going to be opt in right? That would be sufficient for me.
I already agree with the change, but for the record, I got bit by this again today 😭 While testing our handling of .env, my test environments were mysteriously losing .env files, the reason was, of course: .env is in .gitignore 😭
Activity
[-]🐞 Cannot use files ignored by .gitignore on `dagger call`[/-][+]🐞 defaultPath cannot use files ignored by .gitignore on `dagger call`[/+]danielgafni commentedon Sep 5, 2025
Lol mine was 4 minutes later #10996. I guess I'll close it. Here is my original issue:
This erroneously affects files that are already added staged (for ex with
git add --force, or added prior to.gitignoremodifications), but would have fallen under .gitignore if they wouldn't.I have a few small .mp4 files checked into the repo for testing purposes. My .gitignore also ignores **/.mp4. My tests in Dagger now started failing after an upgrade to
0.8.17.Files explicitly added to git should not be excluded from COPY operations - that's valid source code!
TomChv commentedon Sep 8, 2025
I opened this PR to ensure we won't break old modules with the gitignore changes: #11011, I should have been done before the release but better later than never.
I also did some tests and it seems it's absolutely impossible to bypass the auto ignore from a
dagger call.But it's totally possible from dagger shell, here's an example:
🔴 FAIL:
dagger call repo --file=./LICENSE contents # failed to stat file /LICENSE: lstat /LICENSE: no such file or directory🟢 Work:
For a cleaner notation it's also possible to write it with variable directly from the CLI:
shykes commentedon Sep 8, 2025
@jedevc @TomChv should we narrow the scope of auto-gitignore to only module loading, and not default arguments? It seems like a reasonable short-term fix:
wdyt?
danielgafni commentedon Sep 9, 2025
@shykes it won't fix my issue: #10996
Again, how come files added to git are ignored as well?
It makes complete sense to auto-ignore random files that are not part of the source code (not added to git), but there may be legit source code files that overlap with
.gitignore(git add --force, added before the.gitignorerule matching them was added)!shykes commentedon Sep 9, 2025
@danielgafni I wasn't sure, based on your issue, how exactly you consume those mp4 files. I assumed it was via an argument of type
DirectoryorFile, using+defaultPath. If that's the case, then the fix I propose would fix it, since.gitignorewouldn't apply to those files at all.That makes sense to me as well.
danielgafni commentedon Sep 9, 2025
Oh sorry, I didn't pay attention, indeed I'm doing it with a
Directory:By the way, I find
DefaultPathnot working for me at all, I can't omit it in my commands. I still always have to pass--root-dir .Is something wrong with my code? 🤔TomChv commentedon Sep 9, 2025
Default path is applied to function arguments, in your case it's seems that it's a field?
danielgafni commentedon Sep 9, 2025
It's used as a function argument:
TomChv commentedon Sep 9, 2025
Try to inline it as a function argument instead of creating an external type, I'm not sure we support that kind of syntax.
danielgafni commentedon Sep 9, 2025
I've tried that, it doesn't work as well. Very strange.
From Python's perspective there shouldn't be a difference anyway, type annotations can be defined anywhere, there is no "inlining" concept.
Btw let me know if you think this problem shouldn't be discussed in this particular issue.
jedevc commentedon Sep 9, 2025
Yes, please open a separate issue to discuss the python defaultPath issue.
jedevc commentedon Sep 10, 2025
Agree with @shykes here: #10994 (comment)
There are fairly legitimate issues with the gitignore support right now, and I'm not sure applying them by default in all cases works.
We've found why it's hard to do, but for module loading itself, we should be safe.
sheldonhull commentedon Sep 10, 2025
This snagged me yesterday as I tried to pass explicit paths that were in gitignore for post processing and encryption (.artifacts , .cache).
While I love that by default more filtering is done, I'm attempting to produce artifacts and process items I want to cache/reload in next dagger call, such as testing pgp certs, yaml artifacts to further process, and others.
The behavior I expected was letting me pass in a specific directory, and not filtering that. However, I think I'd be fine with it being filtered if I had some type of option that was something like
// +no-auto-ignoresso I could opt in to including files.In general I do think the behavior of respecting gitignore is actually really good.
I corrupted a repo once because of a glitch because it was touching the
.gitdirectory and didn't end up copying the contents back out.Knowing the ignored content like git directory is excluded without me having to specify on every directory mounting of the repo is a good thing to me, as long as I can still choose to pass in options explicitly.
nipuna-perera commentedon Sep 15, 2025
This just broke me so I also want to throw in my upvote here :). I have intermediate steps in a pipeline that produce artifacts that I don't want to be pushed to git but are still needed for pipeline functionality.
Eg: lint reports and unit test coverage reports that I push to sonar. They are generated in separate
dagger calls and written to local workspace. I need them to be loaded when my+defaultPath=.loads my workspace.From what I understand with #11017, the autoGitIgnore is going to be opt in right? That would be sufficient for me.
shykes commentedon Sep 15, 2025
I already agree with the change, but for the record, I got bit by this again today 😭 While testing our handling of
.env, my test environments were mysteriously losing.envfiles, the reason was, of course:.envis in.gitignore😭