dagger icon indicating copy to clipboard operation
dagger copied to clipboard

Global install

Open shykes opened this issue 2 years ago • 5 comments

It would be great if dagger install always worked, no matter the current working directory:

If... Then... Status
Workdir is inside a dagger module Install into the current module Implemented ✅
Workdir is NOT inside a dagger module Install into the home directory as if it were a module Not yet implemented ❌

I propose implementing the second row: when calling dagger install outside a module, use the home directory as a pseudo-module instead.

Benefits

  • Standardize best practices: "install first" is the recommended way.
  • First call of a module is faster
  • Example commands are shorter

shykes avatar Mar 14 '24 17:03 shykes

Rather than putting it in $HOME/dagger.json and rely on find up, I think it's better to look for it in a "global" place like:

~/.config/dagger/dagger.json

Other than not polluting the home dir, I'm thinking what happens if you add a "source": ".". This would upload the entire $HOME directory to the engine. We can also forbid sources for this module.

One other feature I'm dying to have in this global module is global excludes, like git!

helderco avatar Mar 14 '24 18:03 helderco

As part of #5583, I think we'll need some global state somewhere to track what compute drivers have been configured, and we'll need a place to put plugins.

I think it probably makes sense to use the XDG Base Directory Specification - this defaults to .config for config, .local/share for state (we can put downloaded plugins there). But then, users can also configure this to their preference.

jedevc avatar Mar 18 '24 15:03 jedevc

Yes, XDG was what I basically alluded to. We already use it in our SDKs to know where to download the cli (automatic provisioning).

helderco avatar Mar 18 '24 15:03 helderco

I've been trying to work around this by dropping a dagger.json at the root of my home directory, but I'm having trouble:

  1. Error: failed to generate code: input: blob.diff.export resolve: failed to export: error from receiver: open /Users/shykes/.Trash: operation not permitted
  2. Contents of my dagger.json gets randomly wiped by the Dagger CLI

Is there a way to have a reliable workaround?

shykes avatar Jun 17 '24 17:06 shykes

As discussed with @helderco yesterday. This is now a priority for the UX we want in the dagger shell: "always install a dependency before using it"

shykes avatar Jan 15 '25 00:01 shykes