You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reserving core sounds fine to me - it's short and sweet, and I can't think of anything that would conflict with it (in a way that's legitimate and not misleading).
Just needs the name reservation and a bit of polish to reduce what's available:
❯ dagger-dev -m core functionsName Descriptionblob Retrieves a content-addressed blob.builtin-container Retrieves a container builtin to the engine.cache-volume Constructs a cache volume for a given cache key.check-version-compatibility Checks if the current Dagger Engine is compatible with an SDK's required version.container Creates a scratch container.current-function-call The FunctionCall context that the SDK caller is currently executing in.current-module The module currently being served in the session, if any.current-type-defs The TypeDef representations of the objects currently being served in the session.default-platform The default platform of the engine.directory Creates an empty directory.file -function Creates a function.generated-code Create a code generation result, given a directory containing the generated code.git Queries a Git repository.host Queries the host environment.http Returns a file containing an http remote url content.load-cache-volume-from-id Load a CacheVolume from its ID.load-container-from-id Load a Container from its ID.load-current-module-from-id Load a CurrentModule from its ID.load-directory-from-id Load a Directory from its ID.load-env-variable-from-id Load a EnvVariable from its ID.load-field-type-def-from-id Load a FieldTypeDef from its ID.load-file-from-id Load a File from its ID.load-function-arg-from-id Load a FunctionArg from its ID.load-function-call-arg-value-from-id Load a FunctionCallArgValue from its ID.load-function-call-from-id Load a FunctionCall from its ID.load-function-from-id Load a Function from its ID.load-generated-code-from-id Load a GeneratedCode from its ID.load-git-module-source-from-id Load a GitModuleSource from its ID.load-git-ref-from-id Load a GitRef from its ID.load-git-repository-from-id Load a GitRepository from its ID.load-host-from-id Load a Host from its ID.load-input-type-def-from-id Load a InputTypeDef from its ID.load-interface-type-def-from-id Load a InterfaceTypeDef from its ID.load-label-from-id Load a Label from its ID.load-list-type-def-from-id Load a ListTypeDef from its ID.load-local-module-source-from-id Load a LocalModuleSource from its ID.load-module-dependency-from-id Load a ModuleDependency from its ID.load-module-from-id Load a Module from its ID.load-module-source-from-id Load a ModuleSource from its ID.load-module-source-view-from-id Load a ModuleSourceView from its ID.load-object-type-def-from-id Load a ObjectTypeDef from its ID.load-port-from-id Load a Port from its ID.load-scalar-type-def-from-id Load a ScalarTypeDef from its ID.load-secret-from-id Load a Secret from its ID.load-service-from-id Load a Service from its ID.load-socket-from-id Load a Socket from its ID.load-terminal-from-id Load a Terminal from its ID.load-type-def-from-id Load a TypeDef from its ID.module Create a new module.module-dependency Create a new module dependency configuration from a module source and namemodule-source Create a new module source instance from a source ref string.pipeline Creates a named sub-pipeline.secret Reference a secret by name.set-secret Sets a secret given a user defined name to its plaintext and returns the secret.socket Loads a socket by its ID.type-def Create a new TypeDef.version Get the current Dagger Engine version.
Including skipping optional flags that aren't supported rather than error.
Actually it doesn't. Just need to choose a different name if installing so that you can't use -m core. Even if just checked out locally you could use -m ./core (or an absolute path).
Basically, only the exact -m core needs to be reserved, it's not about the module's name really. Or we can use something else that doesn't clash with anything like -m @. To be clear that syntax is just to prove a point, not an endorsement 😄
I think -m core is more straightforward than -m dag.
the downside of both options, is that the module name doesn't map to the codegen namespace.
install .../docker: dag.Docker()
install .../python: dag.Python()
install core: dag.Git(), dag.Container()... 🤔
I know that you don't actually have to install core, but conceptually it is preinstalled. So the mismatch is potentially confusing. Also if we ever want to support multiple -m in the same command , which seems a bit hard to do now, but I kind of wish we had discussed that ise case earlier...
Let’s see, the main difference when loading core vs a module named “core” is this:
-m ./core → preselects query{core{}}, available functions are from Core object
-m core → preselects query{}, available functions are from Query object
Just brain dumping here to make a point…
The default for -m is ".", so we could use an empty string to mean core. However that doesn’t look like good ergonomics, and defaulting to the current directory is still a better default than running core. Example:
dagger -m "" call container ...
dagger -m - call container ...
dagger -m _ call container ...
Those would avoid a naming conflict, but are they intuitive? The thing is, I don’t think anyone is going to “guess” to use -m core so you need documentation anyway. The question then is, do they have good ergonomics or do they feel weird? Is there something else that doesn’t feel weird, doesn’t cause a naming conflict and is better at conveying consistency? I think that -m "" fixes the last two but not the first (i.e., weird). If I had to pick one, it would probably be -m - as the - is sometimes used in CLIs to mean something special, although it’s usually for stdin.
End brain dump
As for using multiple -m, I remember us talking about it at some point but at the moment I’m not seeing how that could be used. You have a chain that has to start somewhere (ultimately from Query). If it’s because of multiple queries in one command, how would you separate the chains? With --?
Just trying to see if there’s value in trying to keep this as a possibility. But to be clear, I don’t think supporting calling core functions hurts this ability.
Throwing another option into the mix: -m query. That would bring it into alignment with regular module invocation, at least as far as the target type is concerned (Query).
Might be a little odd but it'd at least be leaning on pre-existing GraphQL terminology that we already have to reckon with, as opposed to "core" which makes sense but comes with the cost of claiming another word.
Maybe that could even work with multiple -m flags, assuming the first N modules are loaded and the last -m determines the target of the call:
Another problem with full parity: how much of the graphql API can I query without running any containers? For example, if I run the CLI on a mac without a working container runtime: how much of the CLI can I actually use?
Not an argument for or against, just sharing some (potential?) context.
I'm imagining in the near future the CLI exposing more features.
For example:
Run Garbage Collect (for storage drivers)
Other storage-related commands. No idea what but it's possible something will need to be exposed
Serve a "storage service". Don't know what it is, but if the storage architecture takes us somewhere centralized (e.g. database backed layer metadata storage), then we may need to run a service, and we may want to bake it into the CLI
Control Plane: maybe in the future the CLI will be able to listen to GitHub etc events directly. We may need a command to listen for such events
With that being said, is a 1:1 mapping going to help (easier to extend the CLI) or get in the way (trying to fit things into modules that shouldn't, making us slower), or neither?
One thing to be clear about up front: I don't think we should make some 100% set-in-stone rule that "Thou shalt only implement top-level CLI commands as API calls". It's a nice and appealing approach for a number of reasons but we would probably want to approach migrating existing commands iteratively and also leave the door open for pure CLI implementations if/when needed
But if we have a single binary this all becomes a bit more moot like @shykes said
Run Garbage Collect (for storage drivers)
Other storage-related commands. No idea what but it's possible something will need to be exposed
@aluzzardi Yes I've been thinking about the same recently alongside other refactoring work and these specifically are examples of commands that we almost certainly do want to be in the top-level graphql API, just due to the fact that they require close integration with all the solver+cache stuff that happens in the engine container. So I think it would align with this idea.
Serve a "storage service". Don't know what it is, but if the storage architecture takes us somewhere centralized (e.g. database backed layer metadata storage), then we may need to run a service, and we may want to bake it into the CLI
Control Plane: maybe in the future the CLI will be able to listen to GitHub etc events directly. We may need a command to listen for such events
Makes sense too, but at minimum the storage parts is also something where we almost certainly need close integration with the solver+cache in the engine container, so no matter what quite a bit of the logic needs to live there.
As for the "serve on the CLI-side" part, this is where all our existing functionality around sessions will help us out enormously. We already have the ability to tunnel traffic on arbitrary ports back and forth between the CLI and the engine container (was added for service proxying/tunneling, but @vito's implementation is very generic and can be re-used out-of-the-box for things like this).
We can also easily add variations on this that don't require localhost to be involved and instead just plumb e.g. github events to the CLI directly over a socket, which probably makes more sense for those specifically
With that being said, is a 1:1 mapping going to help (easier to extend the CLI) or get in the way (trying to fit things into modules that shouldn't, making us slower), or neither?
One thing, just to be extra clear, we don't have to implement all this as modules (though that's an option). They can be core API calls as desired, which reduces potential sources of overhead when that matters.
Also worth mentioning, in addition to the tunneling session functionality I mentioned above, we also already have the ability to read/write/stat arbitrary files on the CLI's host from the engine container, read auth, etc. It's straightforward to add more functionality as needed too. So I don't think it would get in our way in that sense.
The impact on performance is the main thing to look out for though I agree. There's a couple things that lessen my concern somewhat:
We already have to do all this "session callback to client" stuff for tons of really basic functionality, so if we do need to tune performance somewhere, it's likely going to benefit everything rather than just be a thorn to deal with to support the idea in this issue.
All the refactoring I've been doing has ended up entangling simplifications that reduce the overhead of all this (e.g. less layers of gRPC tunneling.), and it's also making it easier for us to iterate on all of this more as needed.
Another problem with full parity: how much of the graphql API can I query without running any containers? For example, if I run the CLI on a mac without a working container runtime: how much of the CLI can I actually use?
If you're asking about what parts of the current core API are "theoretically" usable if they were running directly on macos/windows w/out container support, then the main things hard excluded at the moment would be:
withExec + services
modules (since they currently rely on running in containers)
There's a lot of functionality around just pulling images, performing file operations on them, etc. that don't need any containers per-se, though it's going to be hit or miss which parts of some of those currently compile on non-Linux.
There has actually been a ton of work in buildkit on native windows support (and some on native mac os support), so it would mostly be a matter of whack-a-mole on using go build tags in the right places so code actually compiles such that it's using the right underlying syscalls.
But for other gql API calls that don't involve syscalls at all, or only minimally (e.g. checkVersionCompatibility comes to mind first) this shouldn't be a problem
Not sure if that answers your question, let me know.
@helderco Do I understand 1) correctly?
The long format would be dagger --core core container <...>
Does this mean there are more core modules than 'core'?
I do find @sipsma's idea of making core functions be top-level commands (like dagger container) interesting, in particular allowing us to implement some commands via the API. But rather than making the jump on that now, putting the core functions under core is a stepping stone, to flush out the design more.
Sharing my opinion a bit late (non-blocking, feel free to move forward with any option): dagger core ... breaks the semantic, it uses a noun (core) in place of a verb (call) for calling a function.
I'd vote for dagger call --core <func> to make it clear that you're calling a builtin function from the core, it's still a function call.
Activity
shykes commentedon Mar 26, 2024
FYI @sipsma, this may be a duplicate, after a quick search I couldn't find a direct equivalent, but may not have found it.
helderco commentedon May 3, 2024
Would you use
-m coreto select it? If so, we need to reserve that name:shykes commentedon May 3, 2024
Good question... any thoughts @sipsma @vito @aluzzardi @jedevc ?
jedevc commentedon May 7, 2024
Good point - I like the idea of needing to explicitly select it, so yes, we'd probably need to reserve this ASAP.
vito commentedon May 7, 2024
Reserving
coresounds fine to me - it's short and sweet, and I can't think of anything that would conflict with it (in a way that's legitimate and not misleading).helderco commentedon May 7, 2024
I have a working POC:
Just needs the name reservation and a bit of polish to reduce what's available:
Including skipping optional flags that aren't supported rather than error.
shykes commentedon May 7, 2024
Would it break
github.com/shykes/core? 😭helderco commentedon May 7, 2024
Actually it doesn't. Just need to choose a different name if installing so that you can't use
-m core. Even if just checked out locally you could use-m ./core(or an absolute path).Basically, only the exact
-m coreneeds to be reserved, it's not about the module's name really. Or we can use something else that doesn't clash with anything like-m @. To be clear that syntax is just to prove a point, not an endorsement 😄helderco commentedon May 7, 2024
Wdyt of
-m dag?shykes commentedon May 8, 2024
I think
-m coreis more straightforward than-m dag.the downside of both options, is that the module name doesn't map to the codegen namespace.
install .../docker:dag.Docker()install .../python:dag.Python()install core:dag.Git(),dag.Container()... 🤔I know that you don't actually have to install core, but conceptually it is preinstalled. So the mismatch is potentially confusing. Also if we ever want to support multiple
-min the same command , which seems a bit hard to do now, but I kind of wish we had discussed that ise case earlier...helderco commentedon May 8, 2024
Let’s see, the main difference when loading core vs a module named “core” is this:
-m ./core→ preselectsquery{core{}}, available functions are fromCoreobject-m core→ preselectsquery{}, available functions are fromQueryobjectJust brain dumping here to make a point…
The default for
-mis".", so we could use an empty string to mean core. However that doesn’t look like good ergonomics, and defaulting to the current directory is still a better default than running core. Example:dagger -m "" call container ...dagger -m - call container ...dagger -m _ call container ...Those would avoid a naming conflict, but are they intuitive? The thing is, I don’t think anyone is going to “guess” to use
-m coreso you need documentation anyway. The question then is, do they have good ergonomics or do they feel weird? Is there something else that doesn’t feel weird, doesn’t cause a naming conflict and is better at conveying consistency? I think that-m ""fixes the last two but not the first (i.e., weird). If I had to pick one, it would probably be-m -as the-is sometimes used in CLIs to mean something special, although it’s usually for stdin.End brain dump
As for using multiple
-m, I remember us talking about it at some point but at the moment I’m not seeing how that could be used. You have a chain that has to start somewhere (ultimately fromQuery). If it’s because of multiple queries in one command, how would you separate the chains? With--?Just trying to see if there’s value in trying to keep this as a possibility. But to be clear, I don’t think supporting calling core functions hurts this ability.
vito commentedon May 8, 2024
Throwing another option into the mix:
-m query. That would bring it into alignment with regular module invocation, at least as far as the target type is concerned (Query).Might be a little odd but it'd at least be leaning on pre-existing GraphQL terminology that we already have to reckon with, as opposed to "core" which makes sense but comes with the cost of claiming another word.
Maybe that could even work with multiple
-mflags, assuming the first N modules are loaded and the last-mdetermines the target of the call:dagger -m github.com/vito/daggerverse/apko -m query call apko --help # equivalent to: dagger -m github.com/vito/daggerverse/apko call --helpThough it's not obvious what utility that has, since it's not like modules can monkey-patch anymore.
shykes commentedon May 9, 2024
What about
-m git,-m container,-m http,-m directory? It would map to the top-level graphql namespace.26 remaining items
shykes commentedon May 29, 2024
Another problem with full parity: how much of the graphql API can I query without running any containers? For example, if I run the CLI on a mac without a working container runtime: how much of the CLI can I actually use?
aluzzardi commentedon May 30, 2024
Not an argument for or against, just sharing some (potential?) context.
I'm imagining in the near future the CLI exposing more features.
For example:
With that being said, is a 1:1 mapping going to help (easier to extend the CLI) or get in the way (trying to fit things into modules that shouldn't, making us slower), or neither?
sipsma commentedon May 30, 2024
One thing to be clear about up front: I don't think we should make some 100% set-in-stone rule that "Thou shalt only implement top-level CLI commands as API calls". It's a nice and appealing approach for a number of reasons but we would probably want to approach migrating existing commands iteratively and also leave the door open for pure CLI implementations if/when needed
@aluzzardi Yes I've been thinking about the same recently alongside other refactoring work and these specifically are examples of commands that we almost certainly do want to be in the top-level graphql API, just due to the fact that they require close integration with all the solver+cache stuff that happens in the engine container. So I think it would align with this idea.
Makes sense too, but at minimum the storage parts is also something where we almost certainly need close integration with the solver+cache in the engine container, so no matter what quite a bit of the logic needs to live there.
As for the "serve on the CLI-side" part, this is where all our existing functionality around sessions will help us out enormously. We already have the ability to tunnel traffic on arbitrary ports back and forth between the CLI and the engine container (was added for service proxying/tunneling, but @vito's implementation is very generic and can be re-used out-of-the-box for things like this).
One thing, just to be extra clear, we don't have to implement all this as modules (though that's an option). They can be core API calls as desired, which reduces potential sources of overhead when that matters.
Also worth mentioning, in addition to the tunneling session functionality I mentioned above, we also already have the ability to read/write/stat arbitrary files on the CLI's host from the engine container, read auth, etc. It's straightforward to add more functionality as needed too. So I don't think it would get in our way in that sense.
The impact on performance is the main thing to look out for though I agree. There's a couple things that lessen my concern somewhat:
If you're asking about what parts of the current core API are "theoretically" usable if they were running directly on macos/windows w/out container support, then the main things hard excluded at the moment would be:
withExec+ servicesThere's a lot of functionality around just pulling images, performing file operations on them, etc. that don't need any containers per-se, though it's going to be hit or miss which parts of some of those currently compile on non-Linux.
checkVersionCompatibilitycomes to mind first) this shouldn't be a problemNot sure if that answers your question, let me know.
helderco commentedon Jun 14, 2024
So, options are:
dagger call -c container ...(boolean-c, --coreflag, mutually exclusive with-m, --mod)dagger container ...(top-level commands; hand picked)dagger core container ...Do you mind voting with the emojis to see where everyone's at?
shykes commentedon Jun 14, 2024
@helderco there is an option 3 which is
dagger core ...MikaelElkiaer commentedon Jun 16, 2024
@helderco Do I understand 1) correctly?
The long format would be
dagger --core core container <...>Does this mean there are more core modules than 'core'?
helderco commentedon Jun 16, 2024
Appologies, that was edited while on phone. Fixed it. Long format:
dagger call --core container <...>.helderco commentedon Jul 23, 2024
After some discussions, I've reimplemented, to use the top level
dagger core:I do find @sipsma's idea of making core functions be top-level commands (like
dagger container) interesting, in particular allowing us to implement some commands via the API. But rather than making the jump on that now, putting the core functions undercoreis a stepping stone, to flush out the design more.aluzzardi commentedon Aug 1, 2024
To everyone that had opinions on this (@jedevc @sipsma @vito @MikaelElkiaer @wingyplus @shykes): are you ok with the syntax of #7310? Can we move forward and merge it?
samalba commentedon Aug 1, 2024
Sharing my opinion a bit late (non-blocking, feel free to move forward with any option):
dagger core ...breaks the semantic, it uses a noun (core) in place of a verb (call) for calling a function.I'd vote for
dagger call --core <func>to make it clear that you're calling a builtin function from the core, it's still a function call.helderco commentedon Aug 9, 2024
@samalba, @aluzzardi, @shykes. Since I'm going away on PTO, I left a quick PR to give you a little more time to consider the DX before next release:
dagger coretodagger call -c#8135So that decision is no longer blocking the feature. Feel free to merge or close.