Repository navigation
replace shell command with chainable core api - #6390
Conversation
helderco
left a comment
There was a problem hiding this comment.
I love that this process reduces chances of conflict with extra flags in the CLI, moves the intention/verb to the end of the command and generally offloads more into core.
The TestModuleDaggerShell/args test failed due to a timeout, but tested the module locally and works well.
There was a problem hiding this comment.
Even though this is technically a breaking change it should only have been used by the CLI so no need to flag the break (change log), right?
There was a problem hiding this comment.
Sorry just realized I never got back on this comment, but yes exactly correct.
|
As you know, I'm fully on board with the idea of using chaining + core API to keep the number of CLI commands and flags as low as possible. My only note is on the specifics of how shykes:
sipsma:
shykes
How do you feel about the above @sipsma ? |
|
Updated to the |
|
@sipsma how do you feel about this small bikeshedding change:
That clarifies the meaning of "shell" in the API:
|
@shykes Yeah I considered the same thing but concluded that while it's more technically accurate, It's not that bad either way, really splitting hairs at this point. cc @helderco if you have any opinion either way. |
This is one part of our efforts to consolidate dagger CLI commands. It
removes `dagger shell` in favor of using a `shell` api chained from the
core `Container` type.
For example, previously you'd do:
`dagger shell my-ctr`
Now you do:
`dagger call my-ctr shell`
This required some adjustments in the core API:
1. `Container` has a new field `withDefaultShell(args: [String!])` that
can be used to configure the command to use for opening a shell with
the container
1. `shellEndpoint: String!` on `Container` is replaced with
`shell(args: [String!]) Terminal!`.
* If `args` are specified, they override the command to run in the
container's shell
* Otherwise, this defaults to the command specified via
`withDefaultShell`
* As a fallback, `sh` will be executed
---
Implementation details:
The new `Terminal` type currently only has a field for the existing
websocket endpoint, so same basic idea as before in terms of how its
implemented. However, because its an object now we have more leeway to
easily adjust it in the future if more fields are desired.
This felt like the best solution possible in the short term while keeping
options open in the long-term.
`args` is optional and allows specifying the exact command to run in the
interactive container. If not set, it first defaults to the entrypoint of
the container and falls back to `sh` if those aren't set.
Signed-off-by: Erik Sipsma <[email protected]>
|
@shykes the overhead of keeping the PR open and rebasing etc. across all the others is getting to be a bit too much so I'm going to merge this one as is w/ |
This is one part of our efforts to consolidate dagger CLI commands. It removes
dagger shellin favor of using ashellapi chained from the coreContainertype.For example, previously you'd do:
dagger shell my-ctrNow you do:
dagger call my-ctr shellThis required some adjustments in the core API:
Containerhas a new fieldwithDefaultShell(args: [String!])that can be used to configure the command to use for opening a shell with the containershellEndpoint: String!onContaineris replaced withshell(args: [String!]) Terminal!.argsare specified, they override the command to run in the container's shellwithDefaultShellshwill be executedImplementation details:
The new
Terminaltype currently only has a field for the existing websocket endpoint, so same basic idea as before in terms of how its implemented. However, because its an object now we have more leeway to easily adjust it in the future if more fields are desired.This felt like the best solution possible in the short term while keeping options open in the long-term.
argsis optional and allows specifying the exact command to run in the interactive container. If not set, it first defaults to the entrypoint of the container and falls back toshif those aren't set.