Skip to content

core(fix): error on modules include / exclude patterns conflict - #8045

Closed
grouville wants to merge 1 commit into
dagger:mainfrom
grouville:core-fix-conflicting-exclusion
Closed

grouville wants to merge 1 commit into
dagger:mainfrom
grouville:core-fix-conflicting-exclusion

Conversation

@grouville

@grouville grouville commented Jul 26, 2024 •

Copy link
Copy Markdown
Member

Current implementation of module inclusion / exclusion can easily lead to silent conflicts between glob patterns, during a dagger install: #8042 (comment).

For example, one submodule can exclude: **/sdk, whilst we try to install a module located at depth1/sdk/*

For BuildKit, this would lead to a priority for the exclusion, leading to a weird failure on dagger install

This commit ensures that Dagger fails with a readable explanation in case such occurence of conflict.

TODO:

  • add an integration test

@grouville grouville changed the title core(fix): ensure modules include / exclude patterns do not conflict core(fix): error on modules include / exclude patterns conflict Jul 26, 2024
Current implementation of module inclusion / exclusion can easily lead
to silent conflicts between the glob patterns:
- a module can exclude: **/sdk and include: depth1/sdk/*

For BuildKit, this would lead to a priority for the exclusion, but can
lead to weird Dagger behavior.

This commit ensures that Dagger fails in case such occurence of conflict
occurs

Signed-off-by: Guillaume de Rouville <[email protected]>
@grouville
grouville force-pushed the core-fix-conflicting-exclusion branch from 69840cd to 174fb5d Compare July 26, 2024 09:11
@helderco

Copy link
Copy Markdown
Contributor

I'm not sure we should prevent an exclude from overriding an include or vice versa. It can be used by the user to override a default pattern.

@grouville

Copy link
Copy Markdown
Member Author

This is a potential stopgap for #6902

I'm not sure we should prevent an exclude from overriding an include or vice versa. It can be used by the user to override a default pattern.

I am not sure either, thanks for that example🙏

Maybe shall we just provide intelligible warning to the user, showing that some of them might conflict (with the extension of the provenance: which module have which inclusion / exclusion ?) cc @sipsma @jedevc WDYT ?

@helderco

helderco commented Aug 9, 2024 •

Copy link
Copy Markdown
Contributor

This is not just about:

The problem you saw in:

Actually comes from a bug:

So that **/sdk pattern in sdk/python/dev/dagger.json should be excluding sdk/python/dev/**/sdk and not just **/sdk (these patterns are relative to the context directory, or repo root).

Without that bug, there would be no conflict here.

@grouville grouville closed this Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants