Repository navigation
Conversation
👷 Deploy request for cloak-docs pending review.Visit the deploys page to approve it
|
6c87140 to
f073cef
Compare
f073cef to
6a2692e
Compare
6a2692e to
dd0594a
Compare
sipsma
left a comment
There was a problem hiding this comment.
It looks really good so far! I just left a first pass of comments, mostly little things or follow-ups. I will take a look again after the update to check version before replacement
There was a problem hiding this comment.
Is this the buildkitd license? Makes sense if so, just checking. cc @aluzzardi, we have large chunks of code from buildkitd's main func here now, just want to double-check that including the license is all that's needed
dd0594a to
23b323b
Compare
sipsma
left a comment
There was a problem hiding this comment.
Looks good, I will try it out locally tomorrow. Few more minor comments in the mean time. Test failure is the only important one (seems like an easy fix).
BTW the platform issue you mentioned earlier should be fixed by this: #3226
3280acf to
0ee9151
Compare
|
@sipsma. Got it into a mergeable state.
|
|
I might have found decent workaround to my truly hackish |
What does this command do exactly? Do we want to show it to users, or hide it?
Does it run the graphql server also? If not, what command does that?
I know what a provisioner does, but what is the job of the "builder"? Is it to build a dagger binary, a dagger container image, or both? Why does it need to be pluggable? |
706dfb7 to
f72b558
Compare
It proxies the stdio stream to the daemon connection. It should not be invoked manually and only exists on Line 14 in f72b558
Not at the moment. It is, as a first step, a port of Buildkit. The aim is to have a solid, minimal integration of Buildkit, with a minimal
It can be for any of those. It needs to be pluggable, because the other options we tried seemed more complex:
We could also assemble images, by directly embedding the layers, but this could fit one of the option of the "builder" available. Some other context: #3250 (comment) |
👍 thanks
👍 thanks
I have several questions here:
I understand the value of pluggable backends for provisioning the dagger image. I don't understand the value of pluggable backends for building the binary or the image. Sorry if I'm missing something obvious. |
The intention is not to expose this to users in the same way we plan to expose the provisioner concept to users (sorry this probably wasn't clear); we are modelling this "builder" as an interface in our own internal code so we can retain flexibility in terms of switching from
There's tons of tradeoffs and branch points here, so it's really hard to say which one is "best". Some previous discussion here. Happy to discuss more on the individual possibilities too, but I guess the main point is that we will be choosing on behalf of users, not asking them. |
Ah! Now I understand. Thanks! |
|
[Opening up a discussion: I think there's something a bit funky going on with the architecture, it's worth to talk it through. Nothing to do with the PR itself]
Note: this is clashing with cloak's own commands (especially with #3265 which adds stdio support as well). The fact the commands are clashing is a symptom of some weirdness, I think. Basically we have:
Even though there's two I see buildkitd is rebranded as "daggerd", but in practice we end up with two daemons I suppose? From the user's point of view, this is the chain of processes going on:
I don't have really sketched out answers for this (and maybe @sipsma you already do?), but I was thinking:
|
|
@aluzzardi There's no goal to make any actual architecture changes in this PR, it's the same fundamental architecture before+after. The only goal here is to just swap out what used to be buildkitd and replace it with our own wrapper that is otherwise the same besides the fact that we control+build it. That's it though. I agree we have two daemons and that having two daemon is weird, but that's the exact same situation as before this PR. It's just that before the two daemons were Making this swap is the pre-req for any possible changes we may want to make in the future, which is why we're starting here. I completely agree we need to sort out all the weird overlapping commands, combine various servers, etc. It's just far too much to swap buildkitd with a wrapper (this PR) and also change a bunch of other things. I also agree though that the naming of For what we want to do in terms of next steps, it needs to be designed+discussed still but the general idea in my head has been that there's only one "daemon" component which includes both the router+buildkitd functionality. Let's say that's called SDKs would continue to work the same as today in that they rely on invoking the Our current "docker run" implementation is essentially a very primitive version of this much more general concept. The "provisioner" part will have reasonable defaults but also be configurable by users too. So, for instance, it will often be possible to use the "docker run" provisioner and the "fork/exec + ask for sudo" provisioner. We'll need to choose a default on behalf of the user (probably a list in order of preference) but it should be possible for users to override that choice too. I think something like this will give us the same base functionality as we have today but in a much more flexible+generic way. It also avoids the need to do things like "rewrite support for buildkit's localdir syncing in every language". There's no clear answer here of course and infinite variations on the above. But again this PR in particular is just the step needed to unlock all the other future possibilities. |
|
@grouville I gave it a try locally, looks great! I tried combining the Dockerfiles too and was able to get it to work with this commit: sipsma@22ebec4 The changes involving Stdout/Stderr are unrelated. The changes to the Dockerfile are also rough (should be less duplication between stages), but I think it should be possible unless I'm missing something. |
Following's dagger#3187 (comment) and to avoid confusion in the naming of CLI subcommands, all the references of daggerd in the context of dagger-buildkitd have been changed Signed-off-by: Guillaume de Rouville <[email protected]>
Thanks. All of above is now fixed. FYI, to follow your naming convention, I had to import the docker connhelper package. Adding the podman one also won't be that hard I did not rebase with latest cloak yet, will do on Monday. Regarding the In our new docs regarding tests, we would show an example for each major shells/distributions. So, instead of doing |
0e16f95 to
4d4dc1e
Compare
|
Had to squash all the commits, for easier rebase |
sipsma
left a comment
There was a problem hiding this comment.
Really minor things at this point, @aluzzardi please take a look if you'd like, otherwise I think this is pretty much mergeable!
There was a problem hiding this comment.
If we keep this, would need to update this and all the other cloak occurrences to dagger. But in reference to your other comment:
Regarding the StartGoModDaggerBuildkitd, after a lot of thought/experimentation, the easier would be to rely on an env var generating a random number: $RANDOM, and fail if this env var is not set (when running go tests).
In our new docs regarding tests, we would show an example for each major shells/distributions.
So, instead of doing go tests ..., it would become DAGGER_SALT=$RANDOM go tests .... This would help generating new container images everytime people run go tests with few collision probabilities. This has the best tradeoffs, as it could also be easily sustained in the future dogfooding of dagger
I agree something along these lines might be a better approach. What about a variation on that idea that allows callers to continue just using go test as before:
- When the tests start, generate a single global random ID in go code (probably in the init func in
suite_test.go) - Use that ID to identify buildkitd (and thus replace it every time the tests run)
Like you were getting at, this is probably a better approach in general since it reduces the chance of tests being impacted by cached results of previous runs+tests.
If possible, let's try to do that before merging (just realized the tests currently don't run for me locally from this branch due to the fact that I set dagger to be a wrapper script). But if it's a ton of effort then it can be a follow up.
There was a problem hiding this comment.
I implemented something as above, however, there is still one downside: go test ./... seems to build a dagger binary for each subpackage's test, and run all those tests in parallel. Meaning that the init() function doesn't share the same state between test runs, builds dagger images and run them in parallel --> leads to unwanted stop of the container
Given this constraint, queries tests need to be excluded from this recursive/parallel invocation (for now):
Until we dogfood and run those tests in a controlled environment, this is the least constraining solution. However, the env var with the random key still looks like the simplest implementation: generate a random key (exterior to dagger's execution). This random key will only live during the execution of all go tests: SALT=$RANDOM go tests ./.... We have a shared token state between all runs, and it's easy to implement. In multiplatform though, it might be trickier
47febe4 to
e9297ea
Compare
d681b92 to
8b31b7a
Compare
First baby-steps towards the buildkit bundling: 1. Integrate Buildkit's main function. It currently builds only on Linux (GOOS=linux) 2. Integrate it into Dagger's CLI fix: update NewDockerAuthProvider according to Buildkit's new API CI always starts a new build environment. To run the go tests in CI, we do not need to be sure that the version of daggerd is different from previous one. It will always build a new one between PRs fix: add comment, implement DaggerdState, fix host bug when container not set - Comment vcs.revision logic for the compilation of daggerd - Regroup GetBuildkitInformation and GetHost under DaggerdState - Remove last buidlkit naming references - Fix host return value bug, from DaggerdState, when container not set yet test: Add Integration tests to CheckDaggerd - Protect core/integration tests by buildtags to avoid race with internal/buildkitd test - Add a step to integration test in Github CI, with dedicated tag - Refactor revision function in its own package - Integration tests of CheckDaggerd Signed-off-by: Guillaume de Rouville <[email protected]> Co-authored-by: Tanguy ⧓ Herrmann <[email protected]> Bump all source code to official buildkit v0.10.4 release Comment added to `engine/engine.go`, for a fix to be implemented when bumping to buildkit's next release - create dagger buildkitd subcommand - create dagger buildkitd-stdio - Add dockercontainer package to not rely on `buildctl serve` but `dagger buildkitd-stdio` chore: remove buildkit progress debug chore: rename cloak invocation to dagger Rebase cloak to dagger CLI Signed-off-by: Guillaume de Rouville <[email protected]> feat(goModDaggerBuildkitd): change go test version logic - Change version check of `dagger-buildkitd` to rely on `identity.NewID()`. Not perfect, as `go test ./...` generates go binaries for each test / package and runs them in parallel. `queries` test suite might conflict with some others. - Change Action() to ProxyIO() - Move ProxyIO addr as const chore(rebase): update embeding + rebase StartGoModDaggerBuildkitd - update embeding to include new pkg - use StartGoModDaggerBuildkitd and SetupDaggerBuildkitd Signed-off-by: Guillaume de Rouville <[email protected]>
- print errors on stderr - rely on git to retrieve latest dagger version Signed-off-by: Guillaume de Rouville <[email protected]>
8b31b7a to
d3d5789
Compare
|
Closing PR, as #3058 got closed and a new architecture is yet to be defined |
This is the first advanced draft regarding the bundling of buildkit as a daemon. Almost ready to be merged with current state of cloak codebase.
2 new commands have been added
Cloak stdio
Cloak stdio is the port of the stdio command that Buildkit relies on
Cloak serve
Cloak serve embeds Buildkit's main function, currently only implemented on linux architectures. It also contains all the dependencies/tweaks/utilities necessary to make it work.
A builder/provisioner architecture has been implemented, with an interface permitting to add any new provisioner / builder in the codebase. The only provisioner / builder currently implemented is Docker.
WARNING: The current implementation rebuilds everytime the image. A new way to handle that part could be added as a future improvement.
UPDATE: Will fix the
rebuildpart, as it currently leads to race conditions@samalba Fixes at the same time #3015. May conflict with your PR #3185
cc @sipsma