Repository navigation
Support full isolated sessions w/ dagger-in-dagger. - #3787
Conversation
|
Wrapping my head around it ... I think there's a bunch of pros, would get us closer to the "full" session architecture in a very incremental way A few comments / questions:
|
Not literally ( Honestly As we wrap buildkit more, then the fact that we are really just connecting to buildkit will become less and less true, which is a good thing I think. It basically just evolves cleanly as our architecture evolves. There's also still technically a difference in that
Yes this doesn't make router shared, it keeps router inside of Honestly, I'm starting to question what benefits we even get by making router multitenant. We absolutely get tons of benefits by making the runner (aka buildkitd right now) multitenant. But I'm less sure about router now. But I easily could be forgetting obvious things here.
Actually I think dagger listen still works at least the same as before. Either way, I'm not sure this change impacts the options there, but I again could be missing something.
Agree more or less, but I actually think that might just mean we should get rid of
Yeah when I re-run locally the engine tests are all fully cached every time until I actually make a change to them, it's pretty nice! |
Same. For me there's evidence that we want multiple or at least per-session routers (installing extensions) but I can't think of much evidence to the contrary. Especially if we're likely to need SDKs to run a helper binary either way (multitenant router + sessions service helper || bring-your-own-router) - this scheme seems much simpler. At least for now. |
b604cb7 to
d2a5d77
Compare
I think part of the confusion for me is we effectively have 2 DAGGER_HOST:
I assume, as an end client (e.g. graphiql, some validation tool, a random Python GraphQL library), I don't care about parsing |
|
@aluzzardi I made a few tweaks to the approach, updated the description of the PR with how it works now. There's some ugliness remaining that I call out there; I think it overall still is worth merging this as an incremental step since it seems like a net improvement and fixing all the ugliness will expand the scope too much. Also need to look into one flaky test, other than that it's ready to review.
Yes, I modified the approach a bit and ended up just leaving RE: 2 The upside is that |
There was a problem hiding this comment.
I'm missing one piece -- I don't understand how nesting works.
We're setting DAGGER_RUNNER_HOST (so the session can work), but not DAGGER_HOST -- this should trigger the provisioning of the session, but that can't be done without the docker socket.
Am I missing something?
EDIT: Got the answer from the PR description, I jumped into the code too quickly
There was a problem hiding this comment.
If I'm readying this correctly:
unixis the equivalent ofBUILDKIT_HOSTdocker-container://is the equivalent ofBUILDKIT_HOSTdocker-image://creates the container, then it's the equivalent ofdocker-container://as aBUILDKIT_HOST
There was a problem hiding this comment.
Yep that's all correct
There was a problem hiding this comment.
This is basically temporary until we rework extensions to use the same mechanism as nesting?
There was a problem hiding this comment.
Yes exactly. I think we should:
- Put the engine session functionality into shim (want that anyways)
- Have shim wrap extension execution the same as it does exec
With those two changes, extensions will work the same as exec and this can all be simplified.
There was a problem hiding this comment.
maybe nit: if you stop right here and don't do the ifs below, then bin://dagger-engine-session would work out of the box (cmd exec will look in PATH if it's not a relative/absolute path)
We'd lose early validation though of the binary being executable
There was a problem hiding this comment.
Yeah good call. I left in some early checks but fixed it up so that we can support bin://dagger-engine-session; did the same in Python too. NodeJS will support that now too afaict but without the early checks, which is fine I think.
There was a problem hiding this comment.
Is this for extensions (e.g. this is talking to the session, not buildkit)?
In that case, shouldn't this be http?
Otherwise no way to connect to dagger listen, and this can't be done in Python (at all) / TypeScript (without hacks)
There was a problem hiding this comment.
Oh yeah so this is needed to get extensions to work, but you're right that it means we'd need to add unix to the nodejs SDK, so I was very confused as to why tests were passing after reading your comment...
Then realized we removed the yarn extension test a few days ago: f745097
- This was just so we didn't have to waste time maintaining extensions in the midst of the release work, which makes total sense to me
So yeah, Python and NodeJS extensions won't work currently with this. I can see if there's any other updates possible in the short term, but I think no matter what the long term fix will be the same as elsewhere: include engine-session functionality with each extension exec (probably via the shim), at which time this will disappear.
I'm inclined to just accept that nodejs+python extensions are broken at the moment when using dagger-in-dagger and wait for that fix; given the test case was removed I think that is probably the state of them anyways. We at least still have Go extensions working to test the the project codepaths are basically in tact. Let me know if you disagree though.
This update currently results in users setting This is due the ugliness I mentioned in the description: we can't automatically mount dagger-engine-session yet until we merge that functionality into the shim (which is currently easier said than done I think, saving it for a follow up). New thought: we could set
Let me know what you think, that probably cleans up a little bit of ugliness in the short term and makes things overall more clear. Will update if you agree. |
Right. No easy way around that
Default provisioner would work outside of our very specific CI case, right? I think it's semi ugly, but it'll be needed eventually when wanting to run with a particular runner. |
Yes exactly, default will still work the same before. This is only needed in our very non-default use case of wanting to test dagger-in-dagger but have every individual test case be its own session.
True, in the long term we can choose to embrace this more too if the user need arises |
See other comment -- |
Good point, I'll check if nodejs has that behavior too |
5f0f86c to
96548e8
Compare
|
@aluzzardi Updated with:
cc @helderco I had to add a new connector to the Python SDK for this. I tried to use inheritance to minimize code dupe but let me know if there's any other cleanups or better approaches |
Among other things, this enables local dirs to work as expected when using dagger-in-dagger (they are the actual localdir of the container). Signed-off-by: Erik Sipsma <[email protected]>
The examples tests before this were accidentally passing. The workdir test was actually pulling the README.md from the host workdir, not the local one. Now that dagger-in-dagger uses the actual localdir of the test, we need to include the file that it was trying to read. Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Not totally sure but think this could be the cause of some flakiness of the TestPlatformCrossCompile test case (saw in the logs that failures happen when there is also an error from a registry indicating that port 5000 is already taken...) Also included a few tweaks to make test case failures slightly easier to debug. Signed-off-by: Erik Sipsma <[email protected]>
Otherwise running tests locally results in tons of rate limit errors eventually. Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
96548e8 to
0438f29
Compare
|
Thank you for rebasing, I'm 👀 now. |
helderco
left a comment
There was a problem hiding this comment.
I love the separation 👍
Give me a moment and I'll update the Python part.
Signed-off-by: Helder Correia <[email protected]>
Thank you @helderco! Appreciate it greatly! |
Thanks. What would be helpful is a summary of supported values for |
@shykes Yeah that makes total sense. I am going to merge this PR at this exact moment so it unblocks others but I will follow up today with a PR adding a more cohesive summary to a code comment as right now it exists but is scattered across comments in multiple files (made an issue for it here #3921) |
Signed-off-by: Erik Sipsma [email protected]
Goal
Get engine session nesting fully working, which enables tests of dagger-in-dagger that involve local dirs. Now, when running dagger-in-dagger a new engine session is started up (the same as when outside dagger) and local directories refer to directories local to the container (not the host).
Pros:
engine-session's ability to do that already.shimandengine-sessioncould become the same thing... but that might be too farengine-sessiontoo?Cons
Outline of solution
ExperimentalPrivilegedNestingnow results in the exposed API socket providing the runner API (aka buildkit api for now) instead of an endpoint to the current session.bin://engineconn, which can point to an existing binary (or ifbin://is empty, $PATH will be searched fordagger-engine-session)ExperimentalPrivilegedNestingis set. It has to be provided by the user right now and put somewhere in the PATH.bin://as the engineconn, the engine-session binary still needs to be told where the runner it should connect to is (default provisioner obviously doesn't work). This is done through a new env varDAGGER_RUNNER_HOST(which is essentially likeBUILDKIT_HOSTas of now)dagger execand wrap all the processes in the exec in a single session.bin://will still need to be used and we will still need to be able to tell the invoked binary that it should find the runner api atunix:///dagger-runner.sock.DAGGER_RUNNER_HOSTmay thus be a long-term feature, but it should only be needed for our test cases; users in general should not need to learn about it or use it./dagger.sockis just an endpoint to the current session.RunnerProxyis used for Execs w/ExperimentalPrivilegedNestingenabled andSessionProxyis used when running extensionsengine-sessionbinary automatically mounted in is too much work for this PR. Once that is possible, then extensions can just update to use the new SDKs and should be good to go.Path to cleaning up remaining ugliness
dagger execwhen nested dagger is enabled.dagger-engine-sessionbinary be mounted into these execs by the user/dagger.sock(RunnerProxy) rather than the current split where theres bothRunnerProxyfor execs andSessionProxyfor extensions.Remaining TODOs for this PR
TestPlatformCrossCompile. It's not clear whether/how this could be related to the changes here, but it's happened maybe 1-in-5 engine test runs, so it's too flaky to ignore. Need to look into it more