Repository navigation
Closed
Labels
area/cliAll about go code on dagger CLI
Description
Overview
As part of the 0.3 engine release (codename cloak), the dagger CLI needs a redesign to replace the cloak binary used during development.
Task list
This issue is considered complete when consensus is reached on the 0.3 CLI design, and documented in a way that allows unambiguous implementation.
- Kickstart proposal
- Bikeshedding in comments
- Rough consensus
- Polish
- Start implementation
Function
The Dagger CLI is a client tool for interacting with the Dagger engine. It can be called from the terminal, a shell script, or a CI runner.
It has (or will have) the following features:
- User-friendly GraphQL client, comparable in features to gqurl
- Graphql proxy for compatibility with native graphql tools (graphiql)
- Auto-install the engine for zero-conf onboarding
- Interactive tty attach (for live pipeline debugging)
- Login to Dagger Cloud, and other interactions with Dagger Cloud
- TBD: management of a dagger project, its pipelines and extensions (possibly by editing one or more config files)
- TBD: support for multiple namespaces and engines (possibly by editing one or more config files)
- TBD: other development tasks common to all Dagger SDKs
Architecture
graph LR
term["Terminal"]
script["Shell script"]
ci["CI runner"]
cli(("Dagger CLI"))
go["Go SDK"]
python["Pyton SDK"]
nodejs["NodeJS SDK"]
term & script & ci --> cli
engine["Dagger Engine"]
runtime["OCI container runtime"]
cli & go & python & nodejs -..-> engine --> runtime
Sub-commands
GraphQL client
Subcommand name: query. See options below
Usage:
$ dagger query --help
Open a dagger engine session, and send graphql queries to it
Usage:
Send API queries to a dagger engine
When no document file, read query from standard input.
Usage:
dagger query [flags] [operation]
Flags:
--debug enable buildkit logs
--doc string document query file
-h, --help help for query
--var strings query variable
Examples:
dagger query <<EOF
{
container {
from(address:"hello-world") {
exec(args:["/hello"]) {
stdout {
contents
}
}
}
}
}
EOF
Global Flags:
--workdir string The host workdir loaded into dagger (default ".")
API router Listen command
Subcommand name: listen. See options below
Open a dagger engine session, and forward graphql queries to it.
Usage:
dagger listen [flags]
Flags:
--disable-host-read-write disable host read/write access
-h, --help help for listen
--listen string Listen on network address ADDR (default ":8080")
Global Flags:
--workdir string The host workdir loaded into dagger (default ".")
Exec wrapper command
Subcommand name: exec. See options below
// In progress
Interactive attach
TBD
Login to Dagger Cloud
TBD
$ dagger login$ dagger logoutOpen questions
- Should the
daggercmd live in thedagger/daggerrepository? @shykes had some observations that it feels strange that thedaggerCLI depends on thegoSDK from the engine repository. In his head, it makes more sense if the CLI lives in thego-sdkrepo instead of the engine one. @aluzzardi he told me he'll bring this to you for discussion.
Reacted by Joshua Sleeper and Sam Alba
Activity
mircubed commentedon Oct 13, 2022
shykes commentedon Oct 13, 2022
sipsma commentedon Oct 13, 2022
shykes commentedon Oct 13, 2022
shykes commentedon Oct 13, 2022
gerhard commentedon Oct 13, 2022
gerhard commentedon Oct 13, 2022
shykes commentedon Oct 13, 2022
shykes commentedon Oct 13, 2022
gerhard commentedon Oct 13, 2022
gerhard commentedon Oct 13, 2022
shykes commentedon Oct 13, 2022
11 remaining items
shykes commentedon Oct 14, 2022
shykes commentedon Oct 14, 2022
shykes commentedon Oct 14, 2022
shykes commentedon Oct 14, 2022
shykes commentedon Oct 14, 2022
gerhard commentedon Oct 17, 2022
marcosnils commentedon Nov 8, 2022
Additional items to be adressed:
My initial thought is that CLI SDLC should be able to evolve independently from the engine version while keeping API compatibility with the major version of the Engine. By this I'm suggesting that following the semver convention, the MAJOR version of the engine and the CLI should be kept in sync while the MINOR and PATCH versions could evolve independently.
Following Go SDK's approach should we use a separate repo and mirror the CLI code to handle releases? Particularly since using github releases in a single repo for both the engine and the CLI might become problematic.
@shykes now addressing your thoughts:
Ability to bootstrap projects in supported languages.
i.e:
dagger project init --language go. Inspired from CDK: https://docs.aws.amazon.com/cdk/v2/guide/hello_world.html#hello_world_tutorial_create_appRe
subcommandname: how aboutdagger gq? Name inspired from Hasura's graphql client (https://github.com/hasura/graphqurl). Also MongoDB uses this reference as well https://www.mongodb.com/docs/atlas/app-services/graphql/cli/Only thing that comes to my mind right now is to give the ability to generate shell auto-completion based on the graphQL schema. Similar to what
gql(https://github.com/graphql-editor/gql) does. Apart from that I don't why I couldn't be a top-level command.gerhard commentedon Nov 9, 2022
@marcosnils I would release both the engine & the CLI in lock-step for now (same version for both). Once both hit
1.0we should revise. Until then, I foresee unnecessary cycles spent on compatibility discussions & breaking changes. FWIW, this is the same approach that Concourse used, and it worked well from my end-user perspective cc @vito.Today we release everything from the same repository (this one). The only exception is the Go SDK since the repo is the package. I propose that we continue with this approach & continue releasing from this repository, otherwise our automation will spread and we will be forced to open multiple PRs, across multiple repositories, for the same changes.
The other reason for keeping a single repo is that we publish to various destinations: PyPI, NPM, container registries, etc. The tags are there for our convenience - single source of truth - but most of our users should come via their package source, and not via this repository. We get to keep all issues / PRs / discussions in the same place, and reap the benefits of everything in a single place (including docs!).
marcosnils commentedon Nov 9, 2022
we just had a quick sync between @aluzzardi and @gerhard and agreed on keeping the CLI and the engine withing the same bundle and release process for the moment since it simplifies the implementation and given the fast release cadence that we will have in the upcoming months, dealing with separate distributions doesn't make sense now.
shykes commentedon Nov 9, 2022
Makes sense. From an end-user perspective, it makes sense to make the CLI the "primary". So if you see a release called "0.4.2" on github and look at its contents, the primary thing you should see is the Dagger CLI. Since SDKs are primarily released elsewhere, and the engine can't be used on its own today (and when it is, it will be as a separate OCI image)