#Module Directory Defaults to Remote Repo

1 messages Β· Page 1 of 1 (latest)

tribal lichen
#

I'm trying to create a module where the source directory is set in the New() constructor, similar to how it's done in the greetings-api example here: https://github.com/kpenfound/greetings-api/blob/main/.dagger/main.go#L27
However, if Source isn’t explicitly set after the struct is constructed, it defaults to the root of the remote repository the module was installed from, rather than the root of the repository it was installed into.

Is this the intended behavior?

wicked eagle
#

But, we just shipped a new feature called blueprints, which may be exactly what you're looking for

tribal lichen
#

Thanks, I'll have a look at that πŸ‘

tribal lichen
#

@wicked eagle Are there any docs on this. Apparently I am not smart enough to understand how blueprints work.

frank hawk
#

sorry for the lack of docs. We're working on that now so we can ship them as soon as possible

tribal lichen
#

That is very kind of you, but Im currently sitting in a rather noice pub atm πŸ™‚

wicked eagle
#

I'm checking discord from my bed πŸ˜›

frank hawk
tribal lichen
#

Still trying to wrap my head around it πŸ™‚
Im still not sure what the specific purpose for blueprints are.

frank hawk
#

the TL;DR about blueprint is that allow you to call a remote module like with dagger call -m but with the caveat that you can use your current working directory resources (files and folders) through defaultPath instead of manually having to specify them on each call

tribal lichen
#

Running the init --blueprint command in and existing directory with an module gives me Error: module already exists and running it in an empty dir just creates a dagger.json file πŸ™‚

frank hawk
#

which, before using blueprints, that required a lot of boilerplate since you need to init a module on your side and then wrap all the calls of the target module you were intending to use

frank hawk
tribal lichen
#

Oh.. so you can use the function that a remote module provides, without acutally creating any boilerplate code at all ?

frank hawk
#

that's the gist pretty much

tribal lichen
#

So you can either use one (or multiple) blueprint modules or you can use a boilerplate module?

frank hawk
#

using multiple blueprints (as long as they don't conflict each other) could potentially be a good use-case as well. Not sure if @wicked eagle considered that while working on the initial version. Would need to check the original proposal

tribal lichen
#

Ok cool.. Well thank you very much for clarifying πŸ™‚

frank hawk
#

πŸ™ sure, np

tribal lichen
#

Get well @wicked eagle

wicked eagle
tribal lichen
#

The blueprint feature is pretty cool. How do you update the blueprint module? Just delete the dagger.json file and run again ?

frank hawk
#

just guessing here, not sure if update was implemented for blueprints 😬

tribal lichen
#
dependency "confluence-updater" was requested to be updated, but it is not found in the dependencies list```
#

or

dependency "github.com/kerwood/dagger-modules/confluence-updater" was requested to be updated, but it is not found in the dependencies list
frank hawk
#

that should do it

tribal lichen
#
{
  "name": "dagger2",
  "engineVersion": "v0.18.14",
  "blueprint": {
    "name": "confluence-updater",
    "source": "github.com/kerwood/dagger-modules/confluence-updater@module/confluence-updater",
    "pin": "5844f7aabe0db969a4df3cb822b7a63b6ae1ff46"
  }
}
#

Im guessing that its pinned to a commit ?

frank hawk
#

you can just change that commit and it'll work

tribal lichen
#

So only way would be to delete dagger.json and init again ?

tribal lichen
frank hawk
tribal lichen
frank hawk
#

cc @wicked eagle

wicked eagle
#

The way blueprints work today, a module can only have one blueprint. I tried an earlier POC where you could have several, but it made the UX more complicated, and I got better feedback on this version

#

But, if you want to mix and match functionality from other modules, there's already a mechanism for that: dependencies

#
  • A blueprint can have dependencies
  • Your dependencies can have blueprints

Basically you can mix and match those two features (blueprints and dependencies) to get the result you want

tribal lichen
#

NIce, any examples on that ?

wicked eagle