Repository navigation
dagger project CLI - #5308
dagger project CLI#5308
dagger project CLI#5308Conversation
ac60794 to
f9518c6
Compare
There was a problem hiding this comment.
I love these changes, I think we shall merge this PR before #5305 because there will few things I need to update to make it compatible with these changes.
Overall LGTM, I left on comments about the coding style but it's definitely not blocking the merge
There was a problem hiding this comment.
I think the code can be cleaned up a bit to enhance maintainability but we shall do that later.
Few things that can be done:
- Some comments
- Some breaking line between code block
- Some formatting
There was a problem hiding this comment.
I did some renaming and added a couple more comments and doc strings to the parts that stuck out to me as potentially most confusing, but let me know what else you would like clarified. Happy to update here or in followups.
|
I created a UX PoC of an interactive UX for the CLI. This would accompany using flags. This approach could help make adopting Dagger by new users easier. This shows how we might use templates too. This example is from a few weeks ago, so it doesn't map up totally with the latest. For instance, this doesn't show setting up the project entrypoint. |
Signed-off-by: Erik Sipsma <[email protected]>
This simplifies dagger project and dagger do by getting rid of the --config flag and only asking for a --project flag. The previous need for the two was that project specified the "root" which needed to be loaded in order for the project to run, whereas config specified the path to the dagger.json. This is inherently confusing, but gets even more confusing when you start needing to deal with corner cases around whether the config path should be considered relative to the caller's workdir or relative to the project dir. Now, we have a new "root" field in dagger.json that, if set, will be loaded as the root context for the project. This allows us to get rid of the config flag and just use --project to point to dagger.json (or its parent dir). For git projects, we now consolidate all settings, including the newly added "subdir" as query parameters on the "git://" URI. Query params are not beautiful, but it's probably an upgrade from the previous use of fragments, which break shells due to interpretation of "#" as a comment. Signed-off-by: Erik Sipsma <[email protected]>
|
@d3rp3tt3 yeah I totally agree we should have some UX polish just like that! It could be very nice when integrated with the interactive TUI especially. I do think that we will want to also keep the "low-tech" solution of being able to just pass with flags like Do you want to create a Linear issue for what you are imagining here? Or I'm happy too also. I just think it's probably best left for a follow-up since it requires some design. |
Signed-off-by: Erik Sipsma <[email protected]>
|
This PR is a dependency on a few others, so I'm going to merge this as is for now since all the functionality is hidden away and not public yet anyways. Please feel free to provide more feedback though, happy to address in follow ups. |

This adds
dagger projectas a new CLI subcommand for managing a project (whereasdagger dois for invoking a command in a project).It's extremely barebones right now, but should also be the foundation for more interesting stuff like initializing projects from templates in the future.
Examples
After pulling down this PR, run ./hack/dev to build the new cli to
./bin/daggerReading project metadata
dagger project -p foo --sdk) if need arisesrootvalue if not set based on the sdk. E.g. for go it could autoset to the parent dir containinggo.mod.Initializing new project
Changes to
--projectand--configI realized as I started trying more corner cases that it got extremely confusing whether
--configshould be considered relative to--projector relative to the caller's workdir; there was no obvious way to always follow the intuitively desired behavior.I then realized the simplest way of fixing this is to just do the simplification I've been planning anyways:
--config. Only--projectis supported now and it should point to either adagger.jsonor a dir containingdagger.jsonrootfield to dagger.json which points to the root context that needs to be loaded in order to run the project (i.e. the dir containinggo.modor similar)This means that you now call
dagger doslightly differently, e.g../bin/dagger do --project core/integration/testdata/projects/go/basic testFile --prefix hi./bin/dagger do -p 'git://github.com/sipsma/dagger?ref=project-cli&subpath=core/integration/testdata/projects/go/basic' --output /tmp/subdir/hi.txt testFileTODO
initfor now to help create a new dagger.json)