#Hi there!
1 messages ยท Page 1 of 1 (latest)
Hey Andreas, merry Christmas! ๐
If I'm not mistaken, one thing you could do is put your dagger.json in the root of the repo, and set the source key value to the relative path where the implementation code is. (see the description of the source key)
dagger/dagger does this, by setting .dagger as the source dir., which is the default
In your case it would be foo/ci.
The dagger cli should then be in the context of the module when exec'd both in the root of the repo and in the implementation dir.
Let me know if this works for you!
If you prefer to not have the dagger.json in the root of the repo and change you current config, you can try the --source=.. flag to go up one level in the context of the dagger.json
You can always use the terminal command to jump into the created container and see the context it's running in!
My bad, the --source flag is specific to the dagger/dagger module
https://github.com/dagger/dagger/blob/main/.dagger/main.go#L37
@fringe silo dagger should be able to adapt to your repo layout, not the other way around. Just create your module anywhere in the repo. If your module needs to access a directory elsewhere in the repo, you can make that directory an argument, and set a default path to that argument. that way you can reach anywhere in the context directory for your module - in other words its git repo.
See https://docs.dagger.io/api/arguments/#directories-and-files
I can't really find a docs page that explains this clearly. Here's the blog post where we announced the feature. Look for "context directory access": https://dagger.io/blog/dagger-0-13
Aaah, it clicks for me now!! I was totally on the wrong track before, I didn't know of the dagger CLI tool or the dagger.json file! ๐ There is no reference for dagger.json in the docs, as far as I can find?
I was initially looking for a "Daggerfile", assuming it would follow the same pattern as Docker. And when I didn't find anything like that, I assumed I just had to build and run Dagger via the SDK, so I build a rust program that I thought I had to run using cargo run. It bugged me that this required Rust dependencies to run, but I didn't understand how to do it otherwise. A lot of the examples in the docs focus on building pipelines using code, so that's what I got going with. Running the pipelines using the CLI makes a ton of sense! It also helps me understand how I can "install" modules!
Now that I know that it exists, I'm happy to have it anywhere! ๐ Would you say it's most common to have it in the root of a Git repo or in the ci directory where my Dagger/CI code exists?
Honestly I would prefer to have it on the root, because it makes it easy to see that your app is a Dagger module (meaning, you configured Dagger in it)
It's similar to having a Dockerfile or a Makefile in that sense. By seeing the file there, you have an idea on what to do/expect regarding tests, builds, etc.
Yeah the root is better. Note that you can have the module at the root, but the source code of the module anywhere you want. By default dagger init will hide it under .dagger if there are other files present.
In a big monorepo, it's recommended to have one dagger module per logical component of your project. Eg. frontend, backend, different microservices, docs, etc
Turns out it's not possible to run the Rust SDK as a module yet. ๐ After struggling to get it working with dagger init, I checked with the guys over at #rust and unfortunately the Rust SDK does not support being run by the Dagger CLI yet, it seems. How unfortunate.
But thanks a lot anyway, for all the input and support! ๐
aw man, sorry about that. I feel like LLMs are now good enough that contributing a module-capable SDK should be a smaller lift than before ๐ค
Is there documentation for how to create an SDK? ๐ค
cc @sudden rover I believe there is one somewhere
But there's a lot of "oral transmission" from other SDK makers ๐ cc @low dew @fair lily @fathom bough @summer cosmos among others!
Its sneaky to find, https://github.com/dagger/dagger/blob/main/sdk/CONTRIBUTING.md
This page might also help to understand some parts of SDK/modules https://dagger-io.notion.site/sdk-modules-support
The link that @fathom bough shared is a good start. The another useful resource is dagger.gen.go, it contains how register, load and call a function.
Scanned it quickly but I'm not certain that completely covers his to add module support to an SDK, but will review it again tomorrow when I'm not awake
Also tagging in @main mulch who built a lot of the PHP SDK with me