Repository navigation
Closed
Description
Using DagOp (from #9395), we can lift buildkit operations into dagger-native code, while preserving most of the caching semantics that we rely on today. This is part of our efforts to rely more on our dagql caching (see efforts like #9682) - once dagql caching becomes more sophisticated we'd like to rely on it more completely, but we can't do that if all of the logic is defined in buildkit. The aim is to migrate as much of our code into github.com/dagger/dagger/core as possible, so that when we come to switch over, we're not dependent on lots of buildkit behavior.
I've already done a couple of conversions, and hopefully now, there's some prior art to be inspired by! 🎉 But to summarize:
- Today a lot of operations work by creating buildkit
llbinside of dagger operations (dagql -> llb -> buildkit ops -> snapshots). This is complicated - we want to directly do these operations in dagger (dagql->snapshots). - DagOp works by taking a dagql schema handler, and calling itself - but from inside a buildkit operation, which allows it to cache neatly 😁 (and get written to disk, and be lazified, and all that good stuff). Because of this, there's no underlying llb (or, there is, but it's magically hidden away).
- Some conversions are very simple: you just use
DagOpFileWrapper/DagOpDirectoryWrapperfor handlers that returnFiles/Directorys respectively, the implementation of the function doesn't change. You can also easily add caching for any handler that returns an arbitrary dagql type usingDagOpWrapper. - However, in a lot of cases you need to more carefully split what behavior gets done inside/outside the dagop, so you can use
DagOpFile/DagOpDirectory/DagOpdirectly. - When inside a DagOp and returning a
File/Directoryyou can directly returnImmutableRefs by attaching them asResults - this lets you manually create snapshots, and return them. Be careful, and immediately return these - these don't have corresponding LLB, so they don't chain super well, they need to be immediately returned from the handler.
The following components need to be migrated:
-
SourceOp-
GitSourcefeat: lift git logic out of buildkit into dagop #9980 -
HTTPSourcefeat: lift HTTP implementation to dagger #10317 -
LocalSourcefeat:Host.DirectorydagOp migration (localSource) #10995 -
ImageSource/OCISource -
BlobSource(this is custom)
-
-
FileOp-
Mkdir(becomeswithDirectory) -
Mkfile(becomeswithNewFile) -
Rm(becomeswithoutFile/withoutDirectory/etc) -
Copy(becomeswithDirectory) - We should also use dagop for less hacky implementations of:
-
Container.chown -
Directory.withTimestamps/File.withTimestamps - ...and anywhere else we use llb.
-
- We can also easily implement:
-
Container.link/Container.symlinkDirectory.withSymlink #8484
-
-
-
ExecOp(we pretty much already have our own implementation of this, we just need to remove the llb intermediary) feat: rewriteContainer.withExecto use DagOp #10457 -
MergeOp/DiffOp(kinda unclear how we'll do this) - Exporters
-
image/ociexporter -
docker/ocitarball exporter -
localexporter
-
Reacted by Đặng Minh Dũng
Metadata
Metadata
Assignees
Labels
No labels
Activity
sipsma commentedon Mar 1, 2026
The bridging with dag-op is done, final removal of buildkit solver + dag-op bridge in favor of fully dagger-native caching is here: #11856