Repository navigation
Conversation
3339146 to
13c2745
Compare
There was a problem hiding this comment.
nit: could leave unexported from what I can tell?
There was a problem hiding this comment.
Yeah definitely. This was a bit of a hacky step because injecting it everywhere seemed like a huge pain; basically every object needs it. I'll just make it private for now.
There was a problem hiding this comment.
I think we'll want a defer to call gc.Release(context.Background()) in case we exit this func early due to an error
980fb4c to
9456f34
Compare
|
Current status: 9456f34 removed One option is to change the Project tests to use an external test repo instead of a self-served one. We would just need an external repo fixture. But instead of just ripping those APIs out and calling it a day, I'm going to try supporting them via upstream changes to Buildkit. More cross-pollination between our APIs makes for richer possibilities, rather than saying "services are for containers only." So far I've added Anyway it seems to be working for the most part, and now I'm just chasing down a handful of failing tests (13 by last count but there's some double-counting involved). Haven't pushed anything yet since I'm still hacking on things via local dependency bind-mounts/etc. to iterate more quickly. |
|
Update for today: ok, I think DNS is pretty hard to avoid with all of the crazy nesting things we do. The project tests in particular need to be able to pass a I pushed the old work to a branch and brought DNS back for this PR, with a twist: using search domains to namespace services. Each service container now has a hostname like Still a lot of cleanup to do, and TBD whether Buildkit will be OK merging these changes, but all the services tests are passing now. I'm not 100% sure how this will all work with nesting, but I have a rough idea to just propagate search domains from the parent to the child (with the child's domain taking precedence) if needed. |
|
Current status: all tests passing! 🎉 The linter is yelling at me for The last batch of changes add the aforementioned nesting behavior whereby the search domain from the outer session is propagated to the child, which appends it to its search domain list. This was necessary to get the project tests passing. I also had to make it selectively add the search domain for I'm going to try to do this a different way in Buildkit, though. Rather than passing SearchDomains to |
f09e213 to
5dda952
Compare
|
Buildkit Now we have a non-hacky way to pass dynamic DNS search domains to Exec, Git, and HTTP without busting the cache. No more abusing secrets. 🎉 |
de9bf0c to
ee8ad07
Compare
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
There were a few tricky parts to this. Problem A: It doesn't seem possible to take an arbitrary Container and run it via the Gateway instead. The Container already "bakes in" an LLB definition that refers to the _result_ of running the service. The only thing you can really do is try to Solve() it. Solution A: change the API such that Services are no longer just Containers. Instead, you call Container.Service which takes the exact same params as Container.WithExec, only it returns a Service instead of a Container. Problem B: it's harder to generate service hostnames. Previously we could just take the digest that WithExec baked in, but now that we're not doing that, we have to come up with our own content-addressing scheme. The naive thing to try is taking a digest of the Service, akin to a ContainerID, ContainerIDs aren't stable. Solution B: I implemented a helper to take a stable digest of an arbitrary struct. This works by recursing through structs, maps, slices, etc. and digesting types, with a special-case for *pb.Definition which was the source of unstable hashing as its inner Def field is topographically ordered. Problem C: bizarre behavior with running the same service across Dagger sessions (i.e. parallel test runs), causing each session to start the same service + hostname, and some of them to fail when resolving the host to an IP. Solution C: dedupe services within a session, but not across sessions. Maintain a global map of all services, keeping track of their starting/running state to handle parallelism, and injecting a "session ID" into each Service so that equivalent containers don't share hostnames across Dagger sessions. Signed-off-by: Alex Suraci <[email protected]>
The demos for running `hostname` should probably be removed, as regular containers no longer have a hostname. Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Collecting the container IP in this way doesn't work. Containers are one-time-use. Need to have the service container report its IP to the health-check container instead. Signed-off-by: Alex Suraci <[email protected]>
This reverts commit 1f17879. Bringing this back, going to try using search domains instead. Static host -> IP mapping is too difficult with all the fancy nesting strategies we tend to reach for. Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
This is needed so that llb.HTTP and llb.Git can respect custom DNS config without relying on /etc/resolv.conf. Technically we're already overriding /etc/resolv.conf, but something was causing Go to not attempt to reload the config without a sleep(5 seconds). Signed-off-by: Alex Suraci <[email protected]>
TODO cleanup, reword, rebase, add details Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Otherwise this causes failures with Dockerfile builds that use non-bleeding-edge frontends. Really should never need these domains without a service anyway, which was the original plan. Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
now better-tested Signed-off-by: Alex Suraci <[email protected]>
the Dagger CLI and shim depends on network now for some shared consts, so we need to keep its dependencies tidy and cross-platform Signed-off-by: Alex Suraci <[email protected]>
Previously you had to pass the same set of params to .service as you would to .withExec. Now you just call .withExec as before and call .service to return it as a Service. The previous approach was toilsome in client use because you had to use a different struct type with all the same params. Technically we don't need to change the API at all anymore, so a later might bring the old API back to maintain compatibility for now. Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
Lots of baggage here, so opening a new PR for clarity: #5557 |
based on #5297
Now that we're able to stream arbitrary progress to the frontend, it's possible to run services via the gateway instead.
There were a few tricky parts to this.
Problem A: It doesn't seem possible to take an arbitrary Container and run it via the Gateway instead. The Container already "bakes in" an LLB definition that refers to the result of running the service. The only thing you can really do is try to
Solve()it.Solution A: change the API such that Services are no longer just Containers. Instead, you call
Container.Servicewhich takes the exact same params asContainer.WithExec, only it returns a Service instead of a Container. Note: we now have to maintain two different ways to run containers (Container.WithExec+Service.Start).The new API is as follows (this is a BREAKING CHANGE):
Problem B: it's harder to generate service hostnames. Previously we could just take the digest that
WithExecbaked in, but now that we're not doing that, we have to come up with our own content-addressing scheme. The naive thing to try is taking a digest of theService, akin to aContainerID, butContainerIDsaren't stable because*pb.Definitioncontains fields that can change order while maintaining the same semantics.Solution B: I implemented a helper to take a stable digest of an arbitrary struct. This works by recursing through structs, maps, slices, etc. and digesting types, with a special-case for
*pb.Definitionwhich was the source of unstable hashing as its innerDeffield is topographically ordered.Problem C: bizarre behavior with running the same service across Dagger sessions (i.e. parallel test runs), causing each session to start the same service + hostname, and some of them to fail when resolving the host to an IP.
Solution C: dedupe services within a session, but not across sessions. Maintain a global map of all services, keeping track of their starting/running state to handle parallelism, and injecting a "session ID" into each Service so that equivalent containers don't share hostnames across Dagger sessions.
TODO: