#feat(sdk/elixir): relocate module runtim...

1 messages · Page 1 of 1 (latest)

haughty ledge
#

👋 Just saw your message. Let me take a look.

#

So, my understanding is the Directory(..) that I do call in the runtime/main.go is not related to the configuration defined in dagger.json. But I still need to do it because the engine use it to filter files during uploading it. right?

Then in dagger_sdk I still do need to manual excluding it in the runtime/main.go to exclude it all.

haughty ledge
#

@mint thistle I think I solved all of your suggestion on that PR. Please review it again. 🙏

mint thistle
#

It’s somewhat related. By default the engine adds the dagger.json and everything in the source directory to the include patterns. Since you moved dagger.json to the parent directory, you need to explicitly add more patterns to include from there. Paths in dagger.json are relative to that file.

The engine then combines all the include and exclude patterns and mounts the resulting files under /src, from the context directory. But the working directory is set to the source directory, which is what you get with dag.CurrentModule().Source(). In this case, your source directory is runtime so you need .. to access the parent directory.

I think it’s very useful to understand these diff directories:

  • context directory (git root or dagger root directory if not in a repo)
  • root directory (where dagger.json is, and is what we consider to be the path to the module)
  • source directory (where dagger.json points to in the "source" field).
  • working directory (it’s in the source directory)

Again, include/exclude paths are relative to the root directory, while CurrentModule.source is relative to the source directory.

#

So dagger.json influences what goes in CurrentModule().Source() but not the other way around.