llbtodagger

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package llbtodagger converts BuildKit LLB definitions into Dagger call IDs.

The conversion is intentionally strict: if an LLB operation cannot be mapped faithfully to Dagger API fields/arguments, conversion returns an error.

Non-goals:

  • Parsing Dockerfiles or any frontend input format directly.
  • Supporting BuildOp, blob://, or custom-op conversion paths.
  • Best-effort fallback when semantics are missing or lossy.

Index

Constants

View Source
const (
	// DockerfileMainContextSentinelLocalName is the deterministic local source
	// name used when dockerBuild injects a synthetic Dockerfile2LLB MainContext.
	DockerfileMainContextSentinelLocalName = "__dagger_dockerbuild_main_context_sentinel__"
	// DockerfileMainContextSentinelSharedKeyHint pairs with
	// DockerfileMainContextSentinelLocalName to avoid accidental matches.
	DockerfileMainContextSentinelSharedKeyHint = "__dagger_dockerbuild_main_context_sentinel__"
)

Variables

This section is empty.

Functions

func DefinitionToID

func DefinitionToID(def *pb.Definition, img *dockerspec.DockerOCIImage) (*call.ID, error)

DefinitionToID converts an LLB definition and image config metadata to a Dagger Container ID.

The conversion is strict and fail-fast: if any part of the definition cannot be represented faithfully as Dagger API calls, an error is returned.

func DefinitionToIDWithOptions

func DefinitionToIDWithOptions(def *pb.Definition, img *dockerspec.DockerOCIImage, opts DefinitionToIDOptions) (*call.ID, error)

DefinitionToIDWithOptions is DefinitionToID with optional conversion controls.

func DockerfileMainContextSentinelState

func DockerfileMainContextSentinelState() llb.State

DockerfileMainContextSentinelState returns the synthetic MainContext state used by dockerBuild before llbtodagger rebinding.

Types

type DefinitionToIDOptions

type DefinitionToIDOptions struct {
	// MainContextDirectoryID rebinding target for dockerBuild sentinel local
	// source vertices emitted by Dockerfile2LLB when MainContext is synthetic.
	MainContextDirectoryID *call.ID

	// SecretIDsByLLBID maps BuildKit LLB secret IDs (for example Dockerfile
	// secret mount ids) to Dagger Secret IDs used by withSecretVariable /
	// withMountedSecret conversion.
	SecretIDsByLLBID map[string]*call.ID

	// SSHSocketIDsByLLBID maps BuildKit LLB ssh IDs to Dagger Socket IDs used
	// by withUnixSocket conversion. A mapping for the empty key ("") acts as a
	// default fallback for any unmatched ssh ID.
	SSHSocketIDsByLLBID map[string]*call.ID

	// NoInit applies `withExec(noInit: true)` to converted ExecOps. This is
	// used by dockerBuild(noInit=true) cutover wiring.
	NoInit bool
}

DefinitionToIDOptions controls optional conversion behavior for specific callsites (for example dockerBuild context rebinding).

type UnsupportedOpError

type UnsupportedOpError struct {
	OpDigest digest.Digest
	OpType   string
	Reason   string
}

UnsupportedOpError is returned when an LLB op cannot be mapped faithfully to a Dagger API ID.

func (*UnsupportedOpError) Error

func (e *UnsupportedOpError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL