buildkit

package
v0.19.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: Apache-2.0 Imports: 120 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// from buildkit, cannot change
	EntitlementsJobKey = "llb.entitlements"

	// OCIStoreName is the name of the OCI content store used for OCI tarball
	// imports.
	OCIStoreName = "dagger-oci"

	// BuiltinContentOCIStoreName is the name of the OCI content store used for
	// builtins like SDKs that we package with the engine container but still use
	// in LLB.
	BuiltinContentOCIStoreName = "dagger-builtin-content"
)
View Source
const (
	DaggerSessionIDEnv       = "_DAGGER_SESSION_ID"
	DaggerClientIDEnv        = "_DAGGER_NESTED_CLIENT_ID"
	DaggerCallDigestEnv      = "_DAGGER_CALL_DIGEST"
	DaggerEngineVersionEnv   = "_DAGGER_ENGINE_VERSION"
	DaggerRedirectStdinEnv   = "_DAGGER_REDIRECT_STDIN"
	DaggerRedirectStdoutEnv  = "_DAGGER_REDIRECT_STDOUT"
	DaggerRedirectStderrEnv  = "_DAGGER_REDIRECT_STDERR"
	DaggerHostnameAliasesEnv = "_DAGGER_HOSTNAME_ALIASES"
	DaggerNoInitEnv          = "_DAGGER_NOINIT"

	DaggerSessionPortEnv  = "DAGGER_SESSION_PORT"
	DaggerSessionTokenEnv = "DAGGER_SESSION_TOKEN"

	// this is set by buildkit, we cannot change
	BuildkitSessionIDHeader = "x-docker-expose-session-uuid"

	BuildkitQemuEmulatorMountPoint = "/dev/.buildkit_qemu_emulator"
)
View Source
const (
	// Exec errors will only include the last this number of bytes of output.
	MaxExecErrorOutputBytes = 100 * 1024

	// TruncationMessage is the message that will be prepended to truncated output.
	TruncationMessage = "[omitting %d bytes]..."

	// MaxFileContentsChunkSize sets the maximum chunk size for ReadFile calls
	// Equals around 95% of the max message size (4MB) in
	// order to keep space for any Protocol Buffers overhead:
	MaxFileContentsChunkSize = 3984588

	// MaxFileContentsSize sets the limit of the maximum file size
	// that can be retrieved using File.Contents, currently set to 128MB:
	MaxFileContentsSize = 128 << 20

	// MetaMountDestPath is the special path that the shim writes metadata to.
	MetaMountDestPath           = "/.dagger_meta_mount"
	MetaMountExitCodePath       = "exitCode"
	MetaMountStdoutPath         = "stdout"
	MetaMountStderrPath         = "stderr"
	MetaMountCombinedOutputPath = "combinedOutput"
	MetaMountClientIDPath       = "clientID"
)
View Source
const InstrumentationLibrary = "dagger.io/engine.buildkit"

Variables

View Source
var SkipInputs = fmt.Errorf("skip inputs") //nolint:staticcheck // Err prefix isn't convention for Walk control errors

Functions

func AddExecutionMetadataToDescription added in v0.18.3

func AddExecutionMetadataToDescription(desc map[string]string, md *ExecutionMetadata) error

func AsWorkerController added in v0.11.8

func AsWorkerController(w worker.Worker) (*worker.Controller, error)

Buildkit's worker.Controller is a bit odd; it exists to manage multiple workers because that was a planned feature years ago, but it never got implemented. So it exists to manage a single worker, which doesn't really add much.

We still need to provide a worker.Controller value to a few places though, which this method enables.

func ContextFromDescription added in v0.15.0

func ContextFromDescription(ctx context.Context, desc map[string]string) context.Context

func ConvertToWorkerCacheResult

func ConvertToWorkerCacheResult(ctx context.Context, res *solverresult.Result[*ref]) (*solverresult.Result[bkcache.ImmutableRef], error)

func CurrentBuildkitSessionGroup added in v0.18.11

func CurrentBuildkitSessionGroup(ctx context.Context) (bksession.Group, bool)

func DAGAttributes added in v0.15.0

func DAGAttributes(op *OpDAG) []attribute.KeyValue

func NewCustomLLB added in v0.16.3

func NewCustomLLB(ctx context.Context, op CustomOp, inputs []llb.State, opts ...llb.ConstraintsOpt) (llb.State, error)

func NewSecretScrubReader added in v0.11.5

func NewSecretScrubReader(
	r io.Reader,
	env []string,
	secretEnvs []string,
	secretFiles []string,
) (io.Reader, error)

func ReadSnapshotPath added in v0.15.0

func ReadSnapshotPath(ctx context.Context, c *Client, mntable snapshot.Mountable, filePath string, limit int) ([]byte, error)

func RegisterCustomOp added in v0.16.3

func RegisterCustomOp(op CustomOp)

func RunInNetNS added in v0.11.5

func RunInNetNS[T any](
	ctx context.Context,
	c *Client,
	ns Namespaced,
	fn func() (T, error),
) (T, error)

func ShutdownGlobalNamespaceWorkerPool added in v0.19.3

func ShutdownGlobalNamespaceWorkerPool()

ShutdownGlobalNamespaceWorkerPool gracefully shuts down the global namespace worker pool This should be called during application shutdown

func SpanContextFromDescription added in v0.15.0

func SpanContextFromDescription(desc map[string]string) trace.SpanContext

func StateIdx added in v0.18.10

func StateIdx(ctx context.Context, st llb.State, idx solverpb.OutputIndex, c *llb.Constraints) llb.State

func ToEntitlementStrings added in v0.11.8

func ToEntitlementStrings(ents entitlements.Set) []string

func Tracer added in v0.15.0

func Tracer(ctx context.Context) trace.Tracer

func WithPassthrough added in v0.15.0

func WithPassthrough() llb.ConstraintsOpt

func WithSecretTranslator added in v0.18.13

func WithSecretTranslator(ctx context.Context, s SecretTranslator) context.Context

func WithTracePropagation added in v0.15.0

func WithTracePropagation(ctx context.Context) llb.ConstraintsOpt

func WrapError added in v0.15.3

func WrapError(ctx context.Context, baseErr error, client *Client) error

Types

type BlobOp added in v0.8.8

type BlobOp struct {
	*OpDAG
	*pb.SourceOp
}

func (*BlobOp) Digest added in v0.15.0

func (op *BlobOp) Digest() (digest.Digest, error)

type Client

type Client struct {
	*Opts
	// contains filtered or unexported fields
}

Client is dagger's internal interface to buildkit APIs

func NewClient

func NewClient(ctx context.Context, opts *Opts) (*Client, error)

func (*Client) AbsPath added in v0.16.0

func (c *Client) AbsPath(ctx context.Context, path string) (string, error)

Return the absolute path of the given path as calculated by the caller's host using OS-specific rules.

func (*Client) CombinedResult

func (c *Client) CombinedResult(ctx context.Context) (*Result, error)

CombinedResult returns a buildkit result with all the refs solved by this client so far. This is useful for constructing a result for upstream remote caching.

func (*Client) ContainerImageToTarball added in v0.9.0

func (c *Client) ContainerImageToTarball(
	ctx context.Context,
	engineHostPlatform specs.Platform,
	destPath string,
	inputByPlatform map[string]ContainerExport,
	opts map[string]string,
) error

func (*Client) ExportContainerImage

func (c *Client) ExportContainerImage(
	ctx context.Context,
	inputByPlatform map[string]ContainerExport,
	destPath string,
	opts map[string]string,
) (map[string]string, error)

func (*Client) GetCredential added in v0.14.0

func (c *Client) GetCredential(ctx context.Context, protocol, host, path string) (*git.CredentialInfo, error)

func (*Client) GetGitConfig added in v0.17.0

func (c *Client) GetGitConfig(ctx context.Context) ([]*git.GitConfigEntry, error)

func (*Client) GetSessionCaller

func (c *Client) GetSessionCaller(ctx context.Context, wait bool) (_ bksession.Caller, rerr error)

func (*Client) ID

func (c *Client) ID() string

func (*Client) IOReaderExport added in v0.8.8

func (c *Client) IOReaderExport(ctx context.Context, r io.Reader, destPath string, destMode os.FileMode) (rerr error)

IOReaderExport exports the contents of an io.Reader to the caller's local fs as a file TODO: de-dupe this with the above method to extent possible

func (*Client) ListenHostToContainer added in v0.9.0

func (c *Client) ListenHostToContainer(
	ctx context.Context,
	hostListenAddr, proto, upstream string,
) (*h2c.ListenResponse, func() error, error)

func (*Client) LocalDirExport

func (c *Client) LocalDirExport(
	ctx context.Context,
	def *bksolverpb.Definition,
	destPath string,
	merge bool,
	removePaths []string,
) (rerr error)

func (*Client) LocalFileExport

func (c *Client) LocalFileExport(
	ctx context.Context,
	def *bksolverpb.Definition,
	destPath string,
	filePath string,
	allowParentDirPath bool,
) (rerr error)

func (*Client) LookupOp added in v0.15.0

func (c *Client) LookupOp(vertex digest.Digest) (*OpDAG, trace.SpanContext, bool)

func (*Client) NewNetworkNamespace added in v0.11.5

func (c *Client) NewNetworkNamespace(ctx context.Context, hostname string) (Namespaced, error)

func (*Client) OpenPipe added in v0.18.0

func (c *Client) OpenPipe(
	ctx context.Context,
) (io.ReadWriteCloser, error)

func (*Client) OpenTerminal added in v0.12.0

func (c *Client) OpenTerminal(
	ctx context.Context,
) (*TerminalClient, error)

func (*Client) PromptAllowLLM added in v0.17.1

func (c *Client) PromptAllowLLM(ctx context.Context, moduleRepoURL string) error

func (*Client) PromptHumanHelp added in v0.18.2

func (c *Client) PromptHumanHelp(ctx context.Context, title, question string) (string, error)

func (*Client) PublishContainerImage

func (c *Client) PublishContainerImage(
	ctx context.Context,
	inputByPlatform map[string]ContainerExport,
	opts map[string]string,
) (map[string]string, error)

func (*Client) ReadCallerHostFile

func (c *Client) ReadCallerHostFile(ctx context.Context, path string) ([]byte, error)

func (*Client) ReadImage added in v0.18.17

func (c *Client) ReadImage(
	ctx context.Context,
	name string,
) (*ImageReader, error)

func (*Client) ResolveImageConfig

func (c *Client) ResolveImageConfig(ctx context.Context, ref string, opt sourceresolver.Opt) (string, digest.Digest, []byte, error)

func (*Client) ResolveSourceMetadata added in v0.11.1

func (c *Client) ResolveSourceMetadata(ctx context.Context, op *bksolverpb.SourceOp, opt sourceresolver.Opt) (*sourceresolver.MetaResponse, error)

func (*Client) Solve

func (c *Client) Solve(ctx context.Context, req bkgw.SolveRequest) (_ *Result, rerr error)

func (*Client) StatCallerHostPath added in v0.9.9

func (c *Client) StatCallerHostPath(ctx context.Context, path string, returnAbsPath bool) (*fsutiltypes.Stat, error)

func (*Client) UpstreamCacheExport

func (c *Client) UpstreamCacheExport(ctx context.Context, cacheExportFuncs []ResolveCacheExporterFunc) error

func (*Client) WriteImage added in v0.18.17

func (c *Client) WriteImage(
	ctx context.Context,
	name string,
) (*ImageWriter, error)

type ContainerExport

type ContainerExport struct {
	Definition *bksolverpb.Definition
	Config     specs.ImageConfig
}

type CustomOp added in v0.16.3

type CustomOp interface {
	Name() string
	Backend() CustomOpBackend
}

type CustomOpBackend added in v0.16.3

type CustomOpBackend interface {
	Digest() (digest.Digest, error)
	CacheMap(ctx context.Context, cm *solver.CacheMap) (*solver.CacheMap, error)
	Exec(ctx context.Context, g bksession.Group, inputs []solver.Result, opts OpOpts) (outputs []solver.Result, err error)
}

type CustomOpWrapper added in v0.16.3

type CustomOpWrapper struct {
	Name    string
	Backend CustomOpBackend

	ClientMetadata engine.ClientMetadata
	// contains filtered or unexported fields
}

func (*CustomOpWrapper) Acquire added in v0.16.3

func (op *CustomOpWrapper) Acquire(ctx context.Context) (release solver.ReleaseFunc, err error)

func (CustomOpWrapper) AsConstraintsOpt added in v0.16.3

func (op CustomOpWrapper) AsConstraintsOpt() (llb.ConstraintsOpt, error)

func (*CustomOpWrapper) CacheMap added in v0.16.3

func (op *CustomOpWrapper) CacheMap(ctx context.Context, g bksession.Group, index int) (*solver.CacheMap, bool, error)

func (CustomOpWrapper) Digest added in v0.16.3

func (op CustomOpWrapper) Digest() (digest.Digest, error)

func (*CustomOpWrapper) Exec added in v0.16.3

func (op *CustomOpWrapper) Exec(ctx context.Context, g bksession.Group, inputs []solver.Result) (outputs []solver.Result, err error)

type DiffOp added in v0.8.8

type DiffOp struct {
	*OpDAG
	*pb.DiffOp
}

type ExecError

type ExecError struct {
	Err      error
	Origin   trace.SpanContext
	Cmd      []string
	ExitCode int
	Stdout   string
	Stderr   string
}

ExecError is a custom dagger error that occurs during a `withExec` execution.

It supports being serialized/deserialized through graphql.

func (*ExecError) Error

func (e *ExecError) Error() string

func (*ExecError) Extensions

func (e *ExecError) Extensions() map[string]any

func (*ExecError) Unwrap

func (e *ExecError) Unwrap() error

type ExecOp added in v0.8.8

type ExecOp struct {
	*OpDAG
	*pb.ExecOp
}

func (*ExecOp) Input added in v0.8.8

func (exec *ExecOp) Input(i pb.InputIndex) *OpDAG

func (*ExecOp) OutputMount added in v0.8.8

func (exec *ExecOp) OutputMount() *pb.Mount

func (*ExecOp) OutputMountBase added in v0.8.8

func (exec *ExecOp) OutputMountBase() *OpDAG

type ExecutionMetadata added in v0.11.3

type ExecutionMetadata struct {
	ClientID    string
	SessionID   string
	SecretToken string
	Hostname    string

	// The "stable" ID of the client that is used to identify filesync cache refs
	// across different clients running on the same host.
	// For now, nested execs are just always given a random unique ID each exec (as
	// opposed to clients running on the host which re-use a persisted ID).
	ClientStableID string

	// Unique (random) ID for this execution.
	// This is used to deduplicate the same execution that gets evaluated multiple times.
	ExecID string

	// Internal execution initiated by dagger and not the user.
	// Used when executing the module runtime itself.
	Internal bool

	CallID              *call.ID
	EncodedModuleID     string
	EncodedFunctionCall json.RawMessage
	CallerClientID      string

	// Client resource IDs passed to this client from parent object fields.
	// Needed to handle finding any secrets, sockets or other client resources
	// that this client should have access to due to being set in the parent
	// object.
	ParentIDs map[digest.Digest]*resource.ID

	// Arbitrary to mixin to the cache key for this operation.
	CacheMixin digest.Digest

	// hostname -> list of aliases
	HostAliases map[string][]string
	// search domains to install prior to the session's domain
	ExtraSearchDomains []string

	RedirectStdinPath  string
	RedirectStdoutPath string
	RedirectStderrPath string

	SecretEnvNames  []string
	SecretFilePaths []string

	SystemEnvNames []string

	EnabledGPUs []string

	// Path to the SSH auth socket. Used for Dagger-in-Dagger support.
	SSHAuthSocketPath string

	// If true, skip injecting dagger-init into the container.
	NoInit bool

	// list of remote modules allowed to access LLM APIs
	// any value of "all" bypasses restrictions, a nil slice imposes them
	AllowedLLMModules []string

	// If set (typically via "_EXPERIMENTAL_DAGGER_VERSION" env var), this forces the client
	// to be at the specified version. Currently only used for integ testing.
	ClientVersionOverride string
}

func ExecutionMetadataFromDescription added in v0.11.5

func ExecutionMetadataFromDescription(desc map[string]string) (*ExecutionMetadata, bool, error)

func (ExecutionMetadata) AsConstraintsOpt added in v0.11.3

func (md ExecutionMetadata) AsConstraintsOpt() (llb.ConstraintsOpt, error)

type FileOp added in v0.8.8

type FileOp struct {
	*OpDAG
	*pb.FileOp
}

type GitOp added in v0.8.8

type GitOp struct {
	*OpDAG
	*pb.SourceOp
}

type GlobalNamespaceWorkerPool added in v0.19.3

type GlobalNamespaceWorkerPool struct {
	// contains filtered or unexported fields
}

GlobalNamespaceWorkerPool manages a global pool of workers that can enter different namespace contexts based on PID and namespace type

func GetGlobalNamespaceWorkerPool added in v0.19.3

func GetGlobalNamespaceWorkerPool() *GlobalNamespaceWorkerPool

GetGlobalNamespaceWorkerPool returns the singleton global namespace worker pool

func (*GlobalNamespaceWorkerPool) RunInNamespaces added in v0.19.3

func (gwp *GlobalNamespaceWorkerPool) RunInNamespaces(ctx context.Context, containerID string, namespaces []specs.LinuxNamespace, fn func() error) error

RunInNamespaces executes a function in the context of specific namespaces for a given PID

func (*GlobalNamespaceWorkerPool) Start added in v0.19.3

func (gwp *GlobalNamespaceWorkerPool) Start()

Start initializes and starts the global worker pool

func (*GlobalNamespaceWorkerPool) Stop added in v0.19.3

func (gwp *GlobalNamespaceWorkerPool) Stop()

Stop gracefully shuts down the global worker pool

func (*GlobalNamespaceWorkerPool) SubmitJob added in v0.19.3

func (gwp *GlobalNamespaceWorkerPool) SubmitJob(ctx context.Context, job *NamespaceJob) error

SubmitJob submits a job to be executed in the specified namespace context

type HTTPOp added in v0.8.8

type HTTPOp struct {
	*OpDAG
	*pb.SourceOp
}

type ImageOp added in v0.8.8

type ImageOp struct {
	*OpDAG
	*pb.SourceOp
}

type ImageReader added in v0.18.17

type ImageReader struct {
	Tarball io.ReadCloser

	ContentStore content.Store
	ImagesStore  images.Store
	LeaseManager leases.Manager
}

type ImageWriter added in v0.18.17

type ImageWriter struct {
	Tarball io.WriteCloser

	ContentStore content.Store
	ImagesStore  images.Store
	LeaseManager leases.Manager
}

type LocalOp added in v0.8.8

type LocalOp struct {
	*OpDAG
	*pb.SourceOp
}

type MergeOp added in v0.8.8

type MergeOp struct {
	*OpDAG
	*pb.MergeOp
}

type NamespaceJob added in v0.19.3

type NamespaceJob struct {
	Container  string                 // Container whose namespaces to enter
	Namespaces []specs.LinuxNamespace // Namespaces to enter (e.g., network, mount, etc.)
	Fn         func() error           // Function to execute
	ResultCh   chan error             // Channel to send result back
}

NamespaceJob represents a job to be executed in a specific namespace context

type Namespaced added in v0.11.5

type Namespaced interface {
	NamespaceID() string
	Release(context.Context) error
}

Namespaced is something that has Linux namespaces set up. Currently this is either a full-blown container or just a raw network namespace that's setns'd into to support service tunneling and similar.

func NewDirectNS added in v0.18.17

func NewDirectNS(id string) Namespaced

NewDirectNS creates a namespace, that's externally managed.

type NewWorkerOpts added in v0.11.3

type NewWorkerOpts struct {
	WorkerRoot       string
	ExecutorRoot     string
	BaseWorker       *base.Worker
	TelemetryPubSub  http.Handler
	BKSessionManager *bksession.Manager
	SessionHandler   sessionHandler
	DagqlServer      dagqlServer

	Runc                *runc.Runc
	DefaultCgroupParent string
	ProcessMode         oci.ProcessMode
	IDMapping           *idtools.IdentityMapping
	DNSConfig           *oci.DNSConfig
	ApparmorProfile     string
	SELinux             bool
	Entitlements        entitlements.Set
	NetworkProviders    map[pb.NetMode]network.Provider
	ParallelismSem      *semaphore.Weighted
	WorkerCache         bkcache.Manager
}

type OCIOp added in v0.8.8

type OCIOp struct {
	*OpDAG
	*pb.SourceOp
}

type OpDAG added in v0.8.8

type OpDAG struct {
	*pb.Op                  // the root of the DAG
	OpDigest *digest.Digest // the digest of this root, common across all outputIndexes for this root
	Metadata *pb.OpMetadata // metadata for the root
	Inputs   []*OpDAG       // the inputs to the root
	// contains filtered or unexported fields
}

func DefToDAG added in v0.8.8

func DefToDAG(def *pb.Definition) (*OpDAG, error)

func (*OpDAG) AsBlob added in v0.8.8

func (dag *OpDAG) AsBlob() (*BlobOp, bool)

func (*OpDAG) AsDiff added in v0.8.8

func (dag *OpDAG) AsDiff() (*DiffOp, bool)

func (*OpDAG) AsExec added in v0.8.8

func (dag *OpDAG) AsExec() (*ExecOp, bool)

func (*OpDAG) AsFile added in v0.8.8

func (dag *OpDAG) AsFile() (*FileOp, bool)

func (*OpDAG) AsGit added in v0.8.8

func (dag *OpDAG) AsGit() (*GitOp, bool)

func (*OpDAG) AsHTTP added in v0.8.8

func (dag *OpDAG) AsHTTP() (*HTTPOp, bool)

func (*OpDAG) AsImage added in v0.8.8

func (dag *OpDAG) AsImage() (*ImageOp, bool)

func (*OpDAG) AsLocal added in v0.8.8

func (dag *OpDAG) AsLocal() (*LocalOp, bool)

func (*OpDAG) AsMerge added in v0.8.8

func (dag *OpDAG) AsMerge() (*MergeOp, bool)

func (*OpDAG) AsOCI added in v0.8.8

func (dag *OpDAG) AsOCI() (*OCIOp, bool)

func (*OpDAG) Marshal added in v0.8.8

func (dag *OpDAG) Marshal() (*pb.Definition, error)

Marshal will convert the dag back to a flat pb.Definition, updating all digests based on any modifications made to the dag.

func (*OpDAG) String added in v0.8.8

func (dag *OpDAG) String() string

func (*OpDAG) Walk added in v0.8.8

func (dag *OpDAG) Walk(f func(*OpDAG) error) error

type OpOpts added in v0.16.3

type OpOpts struct {
	CauseCtx trace.SpanContext
	Server   *dagql.Server
	Worker   worker.Worker
}

func CurrentOpOpts added in v0.18.13

func CurrentOpOpts(ctx context.Context) (OpOpts, bool)

type Opts

type Opts struct {
	Worker               *Worker
	SessionManager       *bksession.Manager
	BkSession            *bksession.Session
	LLBBridge            bkfrontend.FrontendLLBBridge
	Dialer               *net.Dialer
	GetClientCaller      func(string) (bksession.Caller, error)
	GetMainClientCaller  func() (bksession.Caller, error)
	Entitlements         entitlements.Set
	UpstreamCacheImports []bkgw.CacheOptionsEntry
	Frontends            map[string]bkfrontend.Frontend

	Refs   map[Reference]struct{}
	RefsMu *sync.Mutex

	Interactive        bool
	InteractiveCommand []string

	ParentClient *Client
}

Opts for a Client that are shared across all instances for a given DaggerServer

type Reference added in v0.11.8

type Reference interface {
	bkgw.Reference
	Release(context.Context) error
}

type ResolveCacheExporterFunc

type ResolveCacheExporterFunc func(ctx context.Context, g bksession.Group) (remotecache.Exporter, error)

type Result

type Result = solverresult.Result[*ref]

type RichError added in v0.18.13

type RichError struct {
	// HACK: wrap the buildkit exec error, which tracks inputs/mounts. This is
	// required because buildkit has *special* tracking of this type in the
	// solver (that handles gc).
	*errdefs.ExecError

	Origin trace.SpanContext

	// Mounts tracks how the refs are mounted.
	Mounts []*bksolverpb.Mount

	// optional info about the execution that failed
	ExecMD *ExecutionMetadata
	Meta   *bkexecutor.Meta

	Terminal func(ctx context.Context, richErr *RichError) error
}

RichError is an error that can occur while processing a container. It contains functionality to allow launching a debug terminal in it, and unwrapping more interesting metadata.

TODO: this should be capable of handling other DagOp errors

func (RichError) AsExecErr added in v0.18.13

func (e RichError) AsExecErr(ctx context.Context, client *Client) (*ExecError, bool, error)

func (RichError) DebugTerminal added in v0.18.13

func (e RichError) DebugTerminal(ctx context.Context, client *Client) error

func (RichError) Unwrap added in v0.18.13

func (e RichError) Unwrap() error

type SecretTranslator added in v0.18.13

type SecretTranslator func(name string, optional bool) (string, error)

func SecretTranslatorFromContext added in v0.18.13

func SecretTranslatorFromContext(ctx context.Context) SecretTranslator

type SpanProcessor added in v0.12.0

type SpanProcessor struct {
	Client *Client
}

SpanProcessor modifies spans coming from the Buildkit component to integrate them with Dagger's telemetry stack.

It must be used in combination with the buildkitTraceProvider.

func NewSpanProcessor added in v0.15.0

func NewSpanProcessor(client *Client) *SpanProcessor

func (*SpanProcessor) ForceFlush added in v0.12.0

func (*SpanProcessor) ForceFlush(context.Context) error

func (*SpanProcessor) OnEnd added in v0.12.0

func (*SpanProcessor) OnStart added in v0.12.0

func (sp *SpanProcessor) OnStart(ctx context.Context, span sdktrace.ReadWriteSpan)

func (*SpanProcessor) Shutdown added in v0.12.0

func (*SpanProcessor) Shutdown(context.Context) error

type TerminalClient added in v0.12.0

type TerminalClient struct {
	Stdin    io.ReadCloser
	Stdout   io.WriteCloser
	Stderr   io.WriteCloser
	ResizeCh chan bkgw.WinSize
	ErrCh    chan error
	Close    func(exitCode int) error
}

type Trie added in v0.11.5

type Trie struct {
	// contains filtered or unexported fields
}

Trie is a simple implementation of a compressed trie (or radix tree). In essence, it's a key-value store that allows easily selecting all entries that have a given prefix.

Why not an off-the-shelf implementation? Well, most of those don't allow navigating character-by-character through the tree, like we do with Step.

func (*Trie) Insert added in v0.11.5

func (t *Trie) Insert(key []byte, value []byte)

func (*Trie) Iter added in v0.12.4

func (t *Trie) Iter() *TrieIter

func (*Trie) Step added in v0.11.5

func (t *Trie) Step(ch byte) *TrieIter

func (Trie) String added in v0.11.5

func (t Trie) String() string

String prints a debuggable representation of the trie.

type TrieIter added in v0.12.4

type TrieIter struct {
	*Trie
	// contains filtered or unexported fields
}

TrieIter is an iterator that allows navigating through a Trie.

This is used so that we can navigate through the compressed Trie structure easily - not every node "exists", but the TrieIter handles this case. For example, a node might have a direct of `foo`, so the node `fo` is virtual.

func (*TrieIter) Step added in v0.12.4

func (t *TrieIter) Step(ch byte) *TrieIter

Step selects a node that was previously inserted.

func (*TrieIter) Value added in v0.12.4

func (t *TrieIter) Value() []byte

Value gets the value previously inserted at this node.

type WalkDirRequest added in v0.12.5

type WalkDirRequest struct {
	Path           string
	IncludePattern string
	Callback       func(path string, info os.FileInfo) error
}

type Worker added in v0.11.3

type Worker struct {
	// contains filtered or unexported fields
}

Worker is Dagger's custom worker. Most of the buildkit Worker interface methods are just inherited from buildkit's base.Worker, with the exception of methods involving executor.Executor (most importantly ResolveOp).

We need a custom Executor implementation for setting up containers (currently, just for providing SessionID, but in the future everything the shim does will be migrated here). For simplicity, this Worker struct also implements that Executor interface (in executor.go) since Worker+Executor are so tightly bound together anyways.

func NewWorker added in v0.11.3

func NewWorker(opts *NewWorkerOpts) *Worker

func (*Worker) Exec added in v0.11.3

func (w *Worker) Exec(ctx context.Context, id string, process executor.ProcessInfo) (err error)

func (*Worker) ExecWorker added in v0.18.13

func (w *Worker) ExecWorker(causeCtx trace.SpanContext, execMD ExecutionMetadata) *Worker

func (*Worker) Executor added in v0.11.3

func (w *Worker) Executor() executor.Executor

func (*Worker) ResolveOp added in v0.11.3

func (*Worker) Run added in v0.11.3

func (w *Worker) Run(
	ctx context.Context,
	id string,
	rootMount executor.Mount,
	mounts []executor.Mount,
	procInfo executor.ProcessInfo,
	started chan<- struct{},
) (_ bkresourcestypes.Recorder, rerr error)

Directories

Path Synopsis
exporter
oci

Jump to

Keyboard shortcuts

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