dagger icon indicating copy to clipboard operation
dagger copied to clipboard

cli: allow calling core functions directly

Open helderco opened this issue 1 year ago • 4 comments

Fixes https://github.com/dagger/dagger/issues/6947

Current implementation uses a boolean flag -c/--core (mutually exclusive with -m/--mod), to use core functions, instead of loading a module.

Can be run from anywhere as it doesn't require a module to load:

Screenshot 2024-06-27 at 10 49 50

Todo

helderco avatar May 07 '24 18:05 helderco

Update: based on discussion in https://github.com/dagger/dagger/issues/6947, may need to make some changes:

- dagger -m- container
+ dagger -m container

Check if what's in -m matches a field under Query first, and fallback to the usual module loading behavior if not.

helderco avatar May 22 '24 11:05 helderco

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jun 13 '24 01:06 github-actions[bot]

Update: changed implementation from -m flag to new -c,--core flag. PR this was based on was merged so taking out of draft.

helderco avatar Jun 29 '24 00:06 helderco

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jul 14 '24 01:07 github-actions[bot]

Reimplemented as dagger core after some discussions in Discord. See:

  • https://github.com/dagger/dagger/issues/6947#issuecomment-2245024282

helderco avatar Jul 23 '24 11:07 helderco

I also like call --core, but after discussing with @helderco, dagger core has a few advantages.

We can keep the refactoring that allows the stepping stone to dagger container. It's a very small change to turn this back into the call --core flag. The inverse wasn't true but that work is done and not lost. It would take around 5mins to switch to the flag.

Basically add the mutually exclusive flag (code already in a previous commit in this PR), and set fc.DisableModuleLoad = true dynamically if --core is set, instead of statically here:

https://github.com/dagger/dagger/blob/1d36e77d177a6c7d4614feb490dddd7c2f859ea2/cmd/dagger/call.go#L20-L29

Perhaps at least mark dagger core as experimental which shows a message in dagger core --help (the feature is still available, even though we're not using it in any command atm). That would signal to users that it could later change to something else, whether it's dagger call -c container or dagger container.

helderco avatar Aug 08 '24 20:08 helderco

Perhaps at least mark dagger core as experimental which shows a message in dagger core --help (the feature is still available, even though we're not using it in any command atm)

I think this is worth doing regardless.

I'd also be happier with a --core flag - but at this point, we've been discussing for so longer, I really really would just rather ship something in the next release. As you mention, if it's experimental, we can adjust with feedback later :tada:

I've added this to the next milestone, so we'll definitely get this for the next release - at least then we've got an upper limit on how long we're allowed to keep discussing this for :laughing:

jedevc avatar Aug 09 '24 09:08 jedevc

I added the "experimental" annotation. This way it's justifiable if we decide to change the DX. Just waiting for the checks to pass before merge.

helderco avatar Aug 09 '24 12:08 helderco