Documentation
¶
Index ¶
- Constants
- Variables
- func WithServices[T any](ctx context.Context, gw bkgw.Client, svcs ServiceBindings, ...) (T, error)
- type AliasSet
- type BuildArg
- type CacheID
- type CacheSharingMode
- type CacheVolume
- type Container
- func (container *Container) Build(ctx context.Context, gw bkgw.Client, context *Directory, dockerfile string, ...) (*Container, error)
- func (container *Container) Directory(ctx context.Context, gw bkgw.Client, dirPath string) (*Directory, error)
- func (container *Container) Endpoint(port int, scheme string) (string, error)
- func (container *Container) Evaluate(ctx context.Context, gw bkgw.Client, pipelineOverride *pipeline.Path) error
- func (container *Container) ExitCode(ctx context.Context, gw bkgw.Client) (int, error)
- func (container *Container) Export(ctx context.Context, host *Host, dest string, platformVariants []ContainerID, ...) error
- func (container *Container) ExposedPorts() ([]ContainerPort, error)
- func (container *Container) File(ctx context.Context, gw bkgw.Client, filePath string) (*File, error)
- func (container *Container) From(ctx context.Context, gw bkgw.Client, addr string) (*Container, error)
- func (container *Container) Hostname() (string, error)
- func (container *Container) ImageConfig(ctx context.Context) (specs.ImageConfig, error)
- func (container *Container) ImageRef(ctx context.Context, gw bkgw.Client) (string, error)
- func (container *Container) Import(ctx context.Context, host *Host, source io.Reader, tag string, ...) (*Container, error)
- func (container *Container) MetaFileContents(ctx context.Context, gw bkgw.Client, filePath string) (string, error)
- func (container *Container) Mounts(ctx context.Context) ([]string, error)
- func (container *Container) Pipeline(ctx context.Context, name, description string, labels []pipeline.Label) (*Container, error)
- func (container *Container) Platform() (specs.Platform, error)
- func (container *Container) Publish(ctx context.Context, ref string, platformVariants []ContainerID, ...) (string, error)
- func (container *Container) RootFS(ctx context.Context) (*Directory, error)
- func (container *Container) Start(ctx context.Context, gw bkgw.Client) (*Service, error)
- func (container *Container) UpdateImageConfig(ctx context.Context, updateFn func(specs.ImageConfig) specs.ImageConfig) (*Container, error)
- func (container *Container) WithDirectory(ctx context.Context, gw bkgw.Client, subdir string, src *Directory, ...) (*Container, error)
- func (container *Container) WithExec(ctx context.Context, gw bkgw.Client, defaultPlatform specs.Platform, ...) (*Container, error)
- func (container *Container) WithExposedPort(port ContainerPort) (*Container, error)
- func (container *Container) WithFile(ctx context.Context, gw bkgw.Client, subdir string, src *File, ...) (*Container, error)
- func (container *Container) WithMountedCache(ctx context.Context, target string, cache CacheID, source *Directory, ...) (*Container, error)
- func (container *Container) WithMountedDirectory(ctx context.Context, target string, source *Directory) (*Container, error)
- func (container *Container) WithMountedFile(ctx context.Context, target string, source *File) (*Container, error)
- func (container *Container) WithMountedSecret(ctx context.Context, target string, source *Secret) (*Container, error)
- func (container *Container) WithMountedTemp(ctx context.Context, target string) (*Container, error)
- func (container *Container) WithNewFile(ctx context.Context, gw bkgw.Client, dest string, content []byte, ...) (*Container, error)
- func (container *Container) WithRootFS(ctx context.Context, dir *Directory) (*Container, error)
- func (container *Container) WithSecretVariable(ctx context.Context, name string, secret *Secret) (*Container, error)
- func (container *Container) WithServiceBinding(svc *Container, alias string) (*Container, error)
- func (container *Container) WithUnixSocket(ctx context.Context, target string, source *Socket) (*Container, error)
- func (container *Container) WithoutExposedPort(port int, protocol NetworkProtocol) (*Container, error)
- func (container *Container) WithoutMount(ctx context.Context, target string) (*Container, error)
- func (container *Container) WithoutUnixSocket(ctx context.Context, target string) (*Container, error)
- type ContainerExecOpts
- type ContainerID
- type ContainerMount
- type ContainerMounts
- type ContainerPort
- type ContainerSecret
- type ContainerSocket
- type CopyFilter
- type Directory
- func (dir *Directory) Diff(ctx context.Context, other *Directory) (*Directory, error)
- func (dir *Directory) Directory(ctx context.Context, subdir string) (*Directory, error)
- func (dir *Directory) Entries(ctx context.Context, gw bkgw.Client, src string) ([]string, error)
- func (dir *Directory) Export(ctx context.Context, host *Host, dest string, bkClient *bkclient.Client, ...) error
- func (dir *Directory) File(ctx context.Context, file string) (*File, error)
- func (dir *Directory) Pipeline(ctx context.Context, name, description string, labels []pipeline.Label) (*Directory, error)
- func (dir *Directory) Stat(ctx context.Context, gw bkgw.Client, src string) (*fstypes.Stat, error)
- func (dir *Directory) WithDirectory(ctx context.Context, subdir string, src *Directory, filter CopyFilter) (*Directory, error)
- func (dir *Directory) WithFile(ctx context.Context, subdir string, src *File, permissions fs.FileMode) (*Directory, error)
- func (dir *Directory) WithNewDirectory(ctx context.Context, dest string, permissions fs.FileMode) (*Directory, error)
- func (dir *Directory) WithNewFile(ctx context.Context, dest string, content []byte, permissions fs.FileMode) (*Directory, error)
- func (dir *Directory) WithTimestamps(ctx context.Context, unix int) (*Directory, error)
- func (dir *Directory) Without(ctx context.Context, path string) (*Directory, error)
- type DirectoryID
- type File
- func (file *File) Contents(ctx context.Context, gw bkgw.Client) ([]byte, error)
- func (file *File) Export(ctx context.Context, host *Host, dest string, bkClient *bkclient.Client, ...) error
- func (file *File) Open(ctx context.Context, host *Host, gw bkgw.Client) (io.ReadCloser, error)
- func (file *File) Secret(ctx context.Context) (*Secret, error)
- func (file *File) Stat(ctx context.Context, gw bkgw.Client) (*fstypes.Stat, error)
- func (file *File) WithTimestamps(ctx context.Context, unix int) (*File, error)
- type FileID
- type GatewayClient
- type Host
- func (host *Host) Directory(ctx context.Context, dirPath string, p pipeline.Path, platform specs.Platform, ...) (*Directory, error)
- func (host *Host) Export(ctx context.Context, export bkclient.ExportEntry, bkClient *bkclient.Client, ...) error
- func (host *Host) NormalizeDest(dest string) (string, error)
- func (host *Host) Socket(ctx context.Context, sockPath string) (*Socket, error)
- type HostAlias
- type HostVariable
- type NetworkProtocol
- type PipelineMetaResolver
- type Query
- type QueryContext
- type Secret
- type SecretID
- type SecretToScrubInfo
- type Service
- type ServiceBindings
- type Socket
- type SocketID
Constants ¶
const ( // A magic env var that's interpreted by the shim, telling it to just output // the stdout/stderr contents rather than actually execute anything. DebugFailedExecEnv = "_DAGGER_SHIM_DEBUG_FAILED_EXEC" )
const OCIStoreName = "dagger-oci"
Variables ¶
var ErrContainerNoExec = errors.New("no command has been executed")
var ErrHostRWDisabled = errors.New("host read/write is disabled")
var ErrInvalidCacheID = errors.New("invalid cache ID; create one using cacheVolume")
Functions ¶
func WithServices ¶ added in v0.3.13
func WithServices[T any](ctx context.Context, gw bkgw.Client, svcs ServiceBindings, fn func() (T, error)) (T, error)
WithServices runs the given function with the given services started, detaching from each of them after the function completes.
Types ¶
type CacheID ¶
type CacheID string
CacheID is an arbitrary string typically derived from a set of token strings acting as the cache's "key" or "scope".
type CacheSharingMode ¶ added in v0.3.12
type CacheSharingMode string
CacheSharingMode is a string deriving from CacheSharingMode enum it can take values: SHARED, PRIVATE, LOCKED
const ( CacheSharingModePrivate CacheSharingMode = "PRIVATE" CacheSharingModeLocked CacheSharingMode = "LOCKED" )
type CacheVolume ¶
type CacheVolume struct {
ID CacheID `json:"id"`
}
CacheVolume is a persistent volume with a globally scoped identifier.
func NewCache ¶
func NewCache(keys ...string) (*CacheVolume, error)
func NewCacheFromID ¶
func NewCacheFromID(id CacheID) (*CacheVolume, error)
func (*CacheVolume) WithKey ¶
func (cache *CacheVolume) WithKey(key string) (*CacheVolume, error)
type Container ¶
type Container struct {
ID ContainerID `json:"id"`
}
Container is a content-addressed container.
func NewContainer ¶ added in v0.3.3
func (*Container) ExposedPorts ¶ added in v0.3.13
func (container *Container) ExposedPorts() ([]ContainerPort, error)
func (*Container) ImageConfig ¶
func (*Container) MetaFileContents ¶ added in v0.3.5
func (*Container) UpdateImageConfig ¶
func (container *Container) UpdateImageConfig(ctx context.Context, updateFn func(specs.ImageConfig) specs.ImageConfig) (*Container, error)
func (*Container) WithDirectory ¶ added in v0.3.7
func (*Container) WithExposedPort ¶ added in v0.3.13
func (container *Container) WithExposedPort(port ContainerPort) (*Container, error)
func (*Container) WithMountedCache ¶
func (*Container) WithMountedDirectory ¶
func (*Container) WithMountedFile ¶
func (*Container) WithMountedSecret ¶
func (*Container) WithMountedTemp ¶
func (*Container) WithNewFile ¶ added in v0.3.7
func (*Container) WithRootFS ¶ added in v0.3.5
func (*Container) WithSecretVariable ¶
func (*Container) WithServiceBinding ¶ added in v0.5.0
func (*Container) WithUnixSocket ¶ added in v0.3.7
func (*Container) WithoutExposedPort ¶ added in v0.3.13
func (container *Container) WithoutExposedPort(port int, protocol NetworkProtocol) (*Container, error)
func (*Container) WithoutMount ¶
type ContainerExecOpts ¶
type ContainerExecOpts struct { // Command to run instead of the container's default command Args []string // Content to write to the command's standard input before closing Stdin string // Redirect the command's standard output to a file in the container RedirectStdout string // Redirect the command's standard error to a file in the container RedirectStderr string // Provide dagger access to the executed command // Do not use this option unless you trust the command being executed. // The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM ExperimentalPrivilegedNesting bool // Grant the process all root capabilities InsecureRootCapabilities bool }
type ContainerID ¶
type ContainerID string
ContainerID is an opaque value representing a content-addressed container.
func (ContainerID) String ¶ added in v0.3.13
func (id ContainerID) String() string
type ContainerMount ¶
type ContainerMount struct { // The source of the mount. Source *pb.Definition `json:"source,omitempty"` // A path beneath the source to scope the mount to. SourcePath string `json:"source_path,omitempty"` // The path of the mount within the container. Target string `json:"target"` // Persist changes to the mount under this cache ID. CacheID string `json:"cache_id,omitempty"` // How to share the cache across concurrent runs. CacheSharingMode string `json:"cache_sharing,omitempty"` // Configure the mount as a tmpfs. Tmpfs bool `json:"tmpfs,omitempty"` }
ContainerMount is a mount point configured in a container.
func (ContainerMount) SourceState ¶
func (mnt ContainerMount) SourceState() (llb.State, error)
SourceState returns the state of the source of the mount.
type ContainerMounts ¶ added in v0.3.3
type ContainerMounts []ContainerMount
func (ContainerMounts) With ¶ added in v0.3.3
func (mnts ContainerMounts) With(newMnt ContainerMount) ContainerMounts
type ContainerPort ¶ added in v0.3.13
type ContainerPort struct { Port int `json:"port"` Protocol NetworkProtocol `json:"protocol"` Description *string `json:"description,omitempty"` }
ContainerPort configures a port to expose from the container.
type ContainerSecret ¶
type ContainerSecret struct { Secret SecretID `json:"secret"` EnvName string `json:"env,omitempty"` MountPath string `json:"path,omitempty"` }
ContainerSecret configures a secret to expose, either as an environment variable or mounted to a file path.
type ContainerSocket ¶ added in v0.3.7
type ContainerSocket struct { Socket SocketID `json:"socket"` UnixPath string `json:"unix_path,omitempty"` }
ContainerSocket configures a socket to expose, currently as a Unix socket, but potentially as a TCP or UDP address in the future.
type CopyFilter ¶ added in v0.3.3
type Directory ¶
type Directory struct {
ID DirectoryID `json:"id"`
}
Directory is a content-addressed directory.
func MergeDirectories ¶
func NewDirectory ¶
func (*Directory) WithDirectory ¶
func (*Directory) WithNewDirectory ¶ added in v0.3.3
func (*Directory) WithNewFile ¶
func (*Directory) WithTimestamps ¶ added in v0.3.8
type DirectoryID ¶
type DirectoryID string
DirectoryID is an opaque value representing a content-addressed directory.
func (DirectoryID) Decode ¶
func (id DirectoryID) Decode() (*directoryIDPayload, error)
Decode returns the private payload of a DirectoryID.
NB(vito): Ideally this would not be exported, but it's currently needed for the project/ package. I left the return type private as a compromise.
type File ¶
type File struct {
ID FileID `json:"id"`
}
File is a content-addressed file.
type GatewayClient ¶ added in v0.3.8
GatewayClient wraps the standard buildkit gateway client with errors that include the output of execs when they fail.
func NewGatewayClient ¶ added in v0.3.13
func NewGatewayClient(baseClient bkgw.Client) *GatewayClient
func (*GatewayClient) CombinedResult ¶ added in v0.3.13
CombinedResult returns a buildkit result with all the refs solved by this client so far. This is useful for constructing a result for remote caching.
func (*GatewayClient) Solve ¶ added in v0.3.8
func (g *GatewayClient) Solve(ctx context.Context, req bkgw.SolveRequest) (_ *bkgw.Result, rerr error)
type Host ¶ added in v0.3.3
func (*Host) NormalizeDest ¶ added in v0.3.3
type HostVariable ¶
type HostVariable struct {
Name string `json:"name"`
}
type NetworkProtocol ¶ added in v0.3.13
type NetworkProtocol string
NetworkProtocol is a string deriving from NetworkProtocol enum
const ( NetworkProtocolTCP NetworkProtocol = "TCP" NetworkProtocolUDP NetworkProtocol = "UDP" )
func (NetworkProtocol) Network ¶ added in v0.3.13
func (p NetworkProtocol) Network() string
Network returns the value appropriate for the "network" argument to Go net.Dial, and for appending to the port number to form the key for the ExposedPorts object in the OCI image config.
type PipelineMetaResolver ¶ added in v0.4.1
type PipelineMetaResolver struct { Resolver llb.ImageMetaResolver Pipeline pipeline.Path }
func (PipelineMetaResolver) ResolveImageConfig ¶ added in v0.4.1
func (r PipelineMetaResolver) ResolveImageConfig(ctx context.Context, ref string, opt llb.ResolveImageConfigOpt) (digest.Digest, []byte, error)
type Query ¶ added in v0.3.10
type Query struct {
Context QueryContext
}
func (*Query) PipelinePath ¶ added in v0.4.0
PipelinePath returns the current pipeline path prepended with a "root" pipeline containing default labels. The pipeline has no name, so it won't confuse the user in the UI.
When called against a nil receiver, as will happen if no pipelines have been created, it will return a path with only the root pipeline.
type QueryContext ¶ added in v0.3.10
type Secret ¶
type Secret struct {
ID SecretID `json:"id"`
}
Secret is a content-addressed secret.
func NewSecretFromFile ¶
func NewSecretFromHostEnv ¶
type SecretID ¶
type SecretID string
SecretID is an opaque value representing a content-addressed secret.
func NewSecretID ¶ added in v0.4.1
func (SecretID) IsOldFormat ¶ added in v0.4.1
type SecretToScrubInfo ¶ added in v0.3.13
type SecretToScrubInfo struct { // Envs stores environment variable names that we need to scrub. Envs []string `json:"envs,omitempty"` // Files stores secret file paths that we need to scrub. Files []string `json:"files,omitempty"` }
SecretToScrubInfo stores the info to access secrets and scrub them from outputs.
type ServiceBindings ¶ added in v0.3.13
type ServiceBindings map[ContainerID]AliasSet
func (*ServiceBindings) Merge ¶ added in v0.3.13
func (bndp *ServiceBindings) Merge(other ServiceBindings)
type Socket ¶ added in v0.3.7
type Socket struct {
ID SocketID `json:"id"`
}