Repository navigation
CLI: use engine.Start directly - #4119
Conversation
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
aluzzardi
left a comment
There was a problem hiding this comment.
Awesome! I was really looking forward to this
Left a few minor comments (all can be just dismissed, the only important one is /query)
There was a problem hiding this comment.
General note: we should keep an eye on router.Do, it's been used only internally so far, I don't 100% know the error reporting etc are on par with regular requests
There was a problem hiding this comment.
note for the future: This is probably better served as a http middleware rather than being in the handler itself. Typical patter of handlers doing handle-y stuff and http middlewares (through go chi or whatnot) handling auth, compression (note to self: we might want to enable gzip in the future, free latency boost), etc.
By doing so the entire auth stuff could live in cmd rather than being in core (and in the future, if we wanted and I'm not sure we will, we could have run --no-auth, --auth-basic <token>, etc without having to pollute the Router)
There was a problem hiding this comment.
why the switch from /query to /?
The goal of /query was for future proofing if we wanted to serve other endpoints (e.g. /ws/services/<id>/stdout). Still doable with / but slightly weird
There was a problem hiding this comment.
Mentioned in description: the main reason is that this results in the CLI being backwards compatible (it was serving / directly before and proxying it to /query, but now the router endpoint is being served directly).
If we leave this to be /query then we'll need to update the playground to use that instead, which is obviously totally possible but thought all else being equal that would be nice to avoid.
But sounds like all else is not equal (curious what weirdness is caused by having it be at /, that rings a bell but I forget) so I'm good with leaving /query instead. Will update
There was a problem hiding this comment.
Pushed a commit going back to /query (will squash it on merge).
There was a problem hiding this comment.
Also opened an issue for the playground here https://github.com/dagger/dagger.io/issues/1341
gerhard
left a comment
There was a problem hiding this comment.
I have eyeballed all changes and they look good to me. I appreciated the naming improvements - sessionToken in particular - and the removal of a few TODOs.
I'm all for merging this, and following up with other improvements in separate PRs. A few thoughts:
- Does this change anything in our docs? If yes, I would probably make those changes part of this PR - we should take advantage of docs being in the same repository.
- I would feel a lot more comfortable if we had one end-to-end CLI test which would exercise the happy path. That should catch any potential breakage that his PR might introduce (again, I just eyeballed it). Anymore than one end-to-end CLI test would be counter-productive at this point. FWIW, more than a few end-to-end integration tests in total would be counter-productive: 🎬 Integrated Tests Are A Scam
5b8d6a7 to
77c5787
Compare
|
Thanks @gerhard
No doc changes yet, the only backwards incompatible change will be to dagger listen. dagger run is unaffected by the change of endpoint because our docs tell users to just use DAGGER_SESSION_URL, which has been updated here.
Agreed, I added a e2e test in this other PR here: https://github.com/dagger/dagger/pull/4029/files#diff-743eff5a95cd3bba29eec3b8d54dfb365904b84d1aa3feec83ef7aa14d08af33 But yeah I'll see if I can backfill a little more coverage there too. |
Signed-off-by: Erik Sipsma <[email protected]>
77c5787 to
e1decc6
Compare
/cc @marcosnils Wasn't aware the playground sent queries to |
it doesn't? |
This is the first step of updating the session interface: #3830
We need to start by getting rid of the CLI's dependency on the Go SDK to cut that circular dependency. The follow ups after this will update the SDKs to download the CLI instead of using the engine-session binary. I'll be listing out the rest of the steps needed to get there in the other issue shortly.
This change was difficult to make completely on it's own, so there's a few other related changes bundled in as part of it:
docker-image://ghcr.io/dagger/engine:v<VERSION>, where version is the git tag burned into the CLI by go releaser.:main.go-containerregistrylibrary, which worked out well since it supports all the same auth mechanisms we already use as part of the session attachables.DAGGER_RUNNER_HOSTis updated to its new name of_EXPERIMENTAL_DAGGER_RUNNER_HOST, since that was all being modified as part of this anyways/querypath from the router http server, now you just send gql queries direct to/again./directly and proxying it to/querybefore, but now the router endpoint is being served directly)./querywas that it made the playground easier (which is no longer in the CLI). cc @aluzzardi in case I'm forgetting something here