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
Change order of include/exclude patterns to allow overrides on module load #8548
When loading a module, the engine compiles a list of include/exclude patterns in order to filter the files that need to be uploaded from the host to the engine.
This is how the engine joins include patterns:
<module root>/<dagger.json include...>
<module root>/dagger.json
<module root>/**/*
<sdk required paths>
Problem
Notice that a module’s dagger.json patterns are added before anything else so it doesn’t have a chance to override anything that’s more global like the entire root directory, or the SDK’s implicit includes (required paths).
The exclude patterns are simpler and already correctly ordered:
.git/**
<module root>/<dagger.json exclude>...
Solution
Reorder the patterns in the following way:
<sdk required paths>
<module root>/**/*
<module root>/<dagger.json include...>
<module root>/dagger.json
This allows a dagger.json file to override the implicit SDK includes, limit which files are included from the root directory without resorting to a more difficult to manage list of excludes, but also not negate the inclusion of dagger.json itself.
I’m aware that you can exclude something that was included instead of negating the include, I’m just trying to prove a point on the ability to override.
Activity
helderco commentedon Mar 13, 2025
This is no longer an issue since: