Skip to content

Multiple levels of wildcards not supported or not working properlyΒ #1900

@csMACnz

Description

@csMACnz

I used to be able to copy all files of a specific type from two-levels nested. This no longer works in BuildKit.

Why? To avoid cache busting. We want to restore our dependencies from all *.csproj files, and not invalidate that cache layer when a source file changes.

see https://stackoverflow.com/a/58697043 as the defacto approach most dotnet docker builds will be using.

If we just copy everything over first, that means any change triggers cache-busting and a full package restore is again required. Without wildcards, we have to manually maintain a long list of csproj file COPYs that is error-prone and unmaintainable across many solutions.

# These all worked without buildkit but now fail with buildkit
COPY src/*/*.csproj ./
COPY */*/*.csproj ./

This puts all found files into a single folder (which at least works for the goal we are trying to achieve)

I now get errors like:

error from sender: readdir: open *: The filename, directory name, or volume label syntax is incorrect.

or sometimes nothing is copied, so i get missing files errors later in the next RUN command.

As far as I an tell, COPY */*.csproj ./ still works as expected, when csproj files are only one-level nested, but doesn't work for the two-level nested case.

As a workaround, I might be able to move to a one-level nested structure, though ideally i wouldn't have to change my structure to fit docker for something that used to work?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions