#v0.12.4 dagger modules functioned under v0.13.0 but not v0.13.5

1 messages · Page 1 of 1 (latest)

clever sierra
#

I have multiple modules that have tests which no longer function in v0.13.5. Under artifactory I have:

{
  "name": "artifactory",
  "sdk": "go",
  "exclude": [
    "tests"
  ],
  "source": ".",
  "engineVersion": "v0.12.4"
}

And under artifactory/tests I have:

{
  "name": "tests",
  "sdk": "go",
  "dependencies": [
    {
      "name": "artifactory",
      "source": ".."
    }
  ],
  "source": ".",
  "engineVersion": "v0.12.4"
}

In v0.13.0, I get:

dagger -m artifactory/tests functions
✔ connect 13.2s
✔ initialize 49.2s

Name                   Description
all                    -
artifactory-download   -
artifactory-upload     -

In v0.13.5, I get:

dagger -m artifactory/tests functions
✔ connect 1.7s
✘ initialize 0.6s
! input: module.withSource.initialize resolve: module name and SDK must be set
  ✔ resolving module ref 0.4s
  ✘ installing module 0.2s
  ! input: module.withSource.initialize resolve: module name and SDK must be set
    ✔ ModuleSource.resolveFromCaller: ModuleSource! 0.2s
    ✘ Module.initialize: Module! 0.0s
    ! module name and SDK must be set

Error: input: module.withSource.initialize resolve: module name and SDK must be set

Please help 😭

pastel rover
#

Hey 👋 Ran into the same thing today as I use the exact same test patttern. The module loading logic seems to have changed, especially the exclude directive in your main module.
Basically when loading the test module, the exclude from the main module will be applied and your test module source code will not be there.
For now removing the exclude directive seems to be the way to fix this.

smoky pecan
stiff mason
#

When a module has dependencies, their include/exclude patterns are added to the module's own. There was a bug previously where the paths from dependency excludes weren't resolved correctly so in your case, loading artifactory/tests would add the following excludes:

(exclude: **/.git, tests)

Since you don’t have a artifactory/tests/tests, things were working. But it was a bug and now paths from dependency excludes are correctly prefixed by their relative path, so when loading artifactory/tests you should now see the following excludes being used:

(exclude: **/.git, artifactory/tests)

The way to fix this would be to negate the exclude in artifactory/tests:

    "exclude": ["!."]

This should produce the following excludes:

(exclude: **/.git, artifactory/tests, !artifactory/tests)

However, this doesn’t seem to be ordered in a useful way, so it won’t work:

(exclude: **/.git, !artifactory/tests, artifactory/tests)

I’m not sure if this is random, but it’s probably adding the excludes from dependencies after the module’s. We need to flip that order to allow overriding excludes from dependencies.

This is related to Change order of include/exclude patterns to allow overrides on module load - #8548, I just need to add the nuance about dependencies there.

#

We could probably also automatically not add any exclude that matches the path to the current module being loaded since it makes no sense. That way you wouldn't need to change anything. But for now, I suggest just removing that exclude.

smoky pecan
#

We've removed the exclude and that got everything working again.

We'll keep an eye on the open issue to be able to exclude again the tests submodules from the parent, so they are not shipped included when installing the parent module from contextual modules. ty