Skip to content

Lift all buildkit operations into dagger #10367

Closed

Description

@jedevc

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 llb inside 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/DagOpDirectoryWrapper for handlers that return Files/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 using DagOpWrapper.
  • 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/DagOp directly.
  • When inside a DagOp and returning a File/Directory you can directly return ImmutableRefs by attaching them as Results - 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:

Activity

  1. sipsma commented on Mar 1, 2026

    @sipsma
    Contributor

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions