Documentation
¶
Index ¶
- Constants
- Variables
- func NewSecretScrubReader(r io.Reader, env []string, secretEnvs []string, secretFiles []string) (io.Reader, error)
- func ReadSnapshotPath(ctx context.Context, c *Client, mntable bkcache.MountableRef, filePath string, ...) ([]byte, error)
- func RunInNetNS[T any](ctx context.Context, c *Client, ns Namespaced, fn func() (T, error)) (T, error)
- func ShutdownGlobalNamespaceWorkerPool()
- func StateIdx(ctx context.Context, st llb.State, idx solverpb.OutputIndex, ...) llb.State
- func Tracer(ctx context.Context) trace.Tracer
- type BlobOp
- type Client
- func (c *Client) AbsPath(ctx context.Context, path string) (string, error)
- func (c *Client) Exec(ctx context.Context, id string, process executor.ProcessInfo) (err error)
- func (c *Client) ExportContainerImage(ctx context.Context, destPath string, ...) (*imageexport.ExportResponse, error)
- func (c *Client) GetCredential(ctx context.Context, protocol, host, path string) (*git.CredentialInfo, error)
- func (c *Client) GetGitConfig(ctx context.Context) ([]*git.GitConfigEntry, error)
- func (c *Client) GetSessionCaller(ctx context.Context) (_ SessionCaller, rerr error)
- func (c *Client) IOReaderExport(ctx context.Context, r io.Reader, destPath string, destMode os.FileMode) (rerr error)
- func (c *Client) ListenHostToContainer(ctx context.Context, hostListenAddr, proto, upstream string) (*h2c.ListenResponse, func() error, error)
- func (c *Client) LocalDirExport(ctx context.Context, srcPath string, destPath string, merge bool, ...) (rerr error)
- func (c *Client) LocalFileExport(ctx context.Context, srcPath string, filePath string, destPath string, ...) (rerr error)
- func (c *Client) NewNetworkNamespace(ctx context.Context, hostname string) (Namespaced, error)
- func (c *Client) OpenPipe(ctx context.Context) (io.ReadWriteCloser, error)
- func (c *Client) OpenTerminal(ctx context.Context) (*TerminalClient, error)
- func (c *Client) PromptAllowLLM(ctx context.Context, moduleRepoURL string) error
- func (c *Client) PromptHumanHelp(ctx context.Context, title, question string) (string, error)
- func (c *Client) PublishContainerImage(ctx context.Context, inputByPlatform map[string]ContainerExport, ...) (*imageexport.ExportResponse, error)
- func (c *Client) ReadCallerHostFile(ctx context.Context, path string) ([]byte, error)
- func (c *Client) ReadImage(ctx context.Context, name string) (*ImageReader, error)
- func (c *Client) Run(ctx context.Context, id string, rootMount executor.Mount, ...) (rerr error)
- func (c *Client) StatCallerHostPath(ctx context.Context, path string, returnAbsPath bool) (*fsutiltypes.Stat, error)
- func (c *Client) WriteContainerImageTarball(ctx context.Context, w io.Writer, inputByPlatform map[string]ContainerExport, ...) error
- func (c *Client) WriteImage(ctx context.Context, name string) (*ImageWriter, error)
- type ContainerExport
- type DiffOp
- type ExecOp
- type ExecutionMetadata
- type FileOp
- type GitOp
- type GlobalNamespaceWorkerPool
- func (gwp *GlobalNamespaceWorkerPool) RunInNamespaces(ctx context.Context, containerID string, namespaces []specs.LinuxNamespace, ...) error
- func (gwp *GlobalNamespaceWorkerPool) Start()
- func (gwp *GlobalNamespaceWorkerPool) Stop()
- func (gwp *GlobalNamespaceWorkerPool) SubmitJob(ctx context.Context, job *NamespaceJob) error
- type HTTPOp
- type ImageOp
- type ImageReader
- type ImageWriter
- type LocalOp
- type MergeOp
- type NamespaceJob
- type Namespaced
- type OCIOp
- type OpDAG
- func (dag *OpDAG) AsBlob() (*BlobOp, bool)
- func (dag *OpDAG) AsDiff() (*DiffOp, bool)
- func (dag *OpDAG) AsExec() (*ExecOp, bool)
- func (dag *OpDAG) AsFile() (*FileOp, bool)
- func (dag *OpDAG) AsGit() (*GitOp, bool)
- func (dag *OpDAG) AsHTTP() (*HTTPOp, bool)
- func (dag *OpDAG) AsImage() (*ImageOp, bool)
- func (dag *OpDAG) AsLocal() (*LocalOp, bool)
- func (dag *OpDAG) AsMerge() (*MergeOp, bool)
- func (dag *OpDAG) AsOCI() (*OCIOp, bool)
- func (dag *OpDAG) EffectID() string
- func (dag *OpDAG) Marshal() (*pb.Definition, error)
- func (dag *OpDAG) OutputIndex() pb.OutputIndex
- func (dag *OpDAG) String() string
- func (dag *OpDAG) Walk(f func(*OpDAG) error) error
- type Opts
- type SessionCaller
- type TerminalClient
- type Trie
- type TrieIter
Constants ¶
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" DaggerEngineNumCPUEnv = "DAGGER_ENGINE_NUM_CPU" DaggerQemuEmulatorMountPoint = "/dev/.dagger_qemu_emulator" )
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" )
const InstrumentationLibrary = "dagger.io/engine.buildkit"
Variables ¶
var SkipInputs = fmt.Errorf("skip inputs") //nolint:staticcheck // Err prefix isn't convention for Walk control errors
Functions ¶
func NewSecretScrubReader ¶
func ReadSnapshotPath ¶
func RunInNetNS ¶
func ShutdownGlobalNamespaceWorkerPool ¶
func ShutdownGlobalNamespaceWorkerPool()
ShutdownGlobalNamespaceWorkerPool gracefully shuts down the global namespace worker pool This should be called during application shutdown
Types ¶
type Client ¶
type Client struct {
*Opts
// contains filtered or unexported fields
}
Client is dagger's internal engine utility client
func (*Client) AbsPath ¶
Return the absolute path of the given path as calculated by the caller's host using OS-specific rules.
func (*Client) ExportContainerImage ¶
func (c *Client) ExportContainerImage( ctx context.Context, destPath string, inputByPlatform map[string]ContainerExport, forceCompression string, tarExport bool, _ string, useOCIMediaTypes bool, ) (*imageexport.ExportResponse, error)
func (*Client) GetCredential ¶
func (*Client) GetGitConfig ¶
func (*Client) GetSessionCaller ¶
func (c *Client) GetSessionCaller(ctx context.Context) (_ SessionCaller, rerr error)
func (*Client) IOReaderExport ¶
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 ¶
func (*Client) LocalDirExport ¶
func (*Client) LocalFileExport ¶
func (*Client) NewNetworkNamespace ¶
func (*Client) OpenTerminal ¶
func (c *Client) OpenTerminal( ctx context.Context, ) (*TerminalClient, error)
func (*Client) PromptAllowLLM ¶
func (*Client) PromptHumanHelp ¶
func (*Client) PublishContainerImage ¶
func (c *Client) PublishContainerImage( ctx context.Context, inputByPlatform map[string]ContainerExport, refName string, useOCIMediaTypes bool, forceCompression string, ) (*imageexport.ExportResponse, error)
func (*Client) ReadCallerHostFile ¶
func (*Client) Run ¶
func (c *Client) Run( ctx context.Context, id string, rootMount executor.Mount, mounts []executor.Mount, procInfo executor.ProcessInfo, started chan<- struct{}, causeCtx trace.SpanContext, execMD *ExecutionMetadata, sessionID string, callerClientID string, nestedClientMetadata *engine.ClientMetadata, nestedClientModule dagql.AnyObjectResult, nestedClientFunctionCall dagql.Typed, nestedClientEnv dagql.AnyObjectResult, ) (rerr error)
func (*Client) StatCallerHostPath ¶
func (*Client) WriteContainerImageTarball ¶
func (*Client) WriteImage ¶
type ContainerExport ¶
type ContainerExport struct {
Ref bkcache.ImmutableRef
Config dockerspec.DockerOCIImageConfig
Annotations []containerutil.ContainerAnnotation
}
type ExecutionMetadata ¶
type ExecutionMetadata struct {
// Internal execution initiated by dagger and not the user.
// Used when executing the module runtime itself.
Internal bool
// UseRecipeIDsByDefault configures nested clients started by this exec to
// resolve id() as recipe-form IDs unless explicitly requested otherwise.
UseRecipeIDsByDefault bool
CallDigest 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
// If true, skip injecting dagger-init into the container.
NoInit bool
}
type GlobalNamespaceWorkerPool ¶
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 ¶
func GetGlobalNamespaceWorkerPool() *GlobalNamespaceWorkerPool
GetGlobalNamespaceWorkerPool returns the singleton global namespace worker pool
func (*GlobalNamespaceWorkerPool) RunInNamespaces ¶
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 ¶
func (gwp *GlobalNamespaceWorkerPool) Start()
Start initializes and starts the global worker pool
func (*GlobalNamespaceWorkerPool) Stop ¶
func (gwp *GlobalNamespaceWorkerPool) Stop()
Stop gracefully shuts down the global worker pool
func (*GlobalNamespaceWorkerPool) SubmitJob ¶
func (gwp *GlobalNamespaceWorkerPool) SubmitJob(ctx context.Context, job *NamespaceJob) error
SubmitJob submits a job to be executed in the specified namespace context
type ImageReader ¶
type ImageWriter ¶
type NamespaceJob ¶
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 ¶
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 ¶
func NewDirectNS(id string) Namespaced
NewDirectNS creates a namespace, that's externally managed.
type OpDAG ¶
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 (*OpDAG) Marshal ¶
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) OutputIndex ¶
func (dag *OpDAG) OutputIndex() pb.OutputIndex
OutputIndex returns the specific output of this op represented by this OpDAG instance.
type Opts ¶
type Opts struct {
ID string
Labels map[string]string
Platforms []ocispecs.Platform
NetworkProviders map[pb.NetMode]network.Provider
Snapshotter bkcache.Snapshotter
ContentStore *containerdsnapshot.Store
Applier diff.Applier
Differ diff.Comparer
IdentityMapping *idtools.IdentityMapping
ExecutorRoot string
TelemetryPubSub http.Handler
SessionHandler sessionHandler
Runc *runc.Runc
DefaultCgroupParent string
ProcessMode oci.ProcessMode
DNSConfig *oci.DNSConfig
ApparmorProfile string
SELinux bool
Entitlements entitlements.Set
HostMntNS *os.File
CleanMntNS *os.File
Dialer *net.Dialer
GetClientCaller func(context.Context, string) (SessionCaller, error)
GetHostServiceCaller func(context.Context, string) (SessionCaller, error)
GetMainClientCaller func(context.Context) (SessionCaller, error)
GetRegistryResolver func(context.Context) (*serverresolver.Resolver, error)
Interactive bool
InteractiveCommand []string
// contains filtered or unexported fields
}
Opts combines server-scoped runtime dependencies with per-client session plumbing. Server-scoped fields are initialized once with NewOpts and shallow-copied for each client.
type SessionCaller ¶
type SessionCaller interface {
Conn() *grpc.ClientConn
Supports(method string) bool
}
type TerminalClient ¶
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 ¶
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.
type TrieIter ¶
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.