Documentation ¶
Index ¶
- Constants
- Variables
- func AddEnv(env []string, name, value string) []string
- func LoadModuleConfig(ctx context.Context, bk *buildkit.Client, svcs *Services, sourceDir *Directory, ...) (string, *modules.Config, error)
- func LoadModuleConfigFromFile(ctx context.Context, bk *buildkit.Client, svcs *Services, configFile *File) (*modules.Config, error)
- func LookupEnv(env []string, name string) (string, bool)
- func WalkEnv(env []string, fn func(string, string, string))
- type AliasSet
- type BuildArg
- type CacheMap
- type CacheSharingMode
- type CacheVolume
- type CacheVolumeID
- type CallInput
- type Container
- func (container *Container) AsTarball(ctx context.Context, bk *buildkit.Client, engineHostPlatform specs.Platform, ...) (*File, error)
- func (container *Container) Build(ctx context.Context, contextDir *Directory, dockerfile string, ...) (*Container, error)
- func (container *Container) Clone() *Container
- func (container *Container) Digest() (digest.Digest, error)
- func (container *Container) Directory(ctx context.Context, bk *buildkit.Client, svcs *Services, dirPath string) (*Directory, error)
- func (container *Container) Evaluate(ctx context.Context, bk *buildkit.Client, svcs *Services) (*buildkit.Result, error)
- func (container *Container) Export(ctx context.Context, bk *buildkit.Client, svcs *Services, dest string, ...) error
- func (container *Container) FSState() (llb.State, error)
- func (container *Container) File(ctx context.Context, bk *buildkit.Client, svcs *Services, filePath string) (*File, error)
- func (container *Container) From(ctx context.Context, bk *buildkit.Client, addr string) (*Container, error)
- func (container *Container) ID() (ContainerID, error)
- func (container *Container) ImageConfig(ctx context.Context) (specs.ImageConfig, error)
- func (container *Container) ImageRefOrErr(ctx context.Context, bk *buildkit.Client) (string, error)
- func (container *Container) Import(ctx context.Context, source FileID, tag string, bk *buildkit.Client, ...) (*Container, error)
- func (container *Container) MetaFileContents(ctx context.Context, bk *buildkit.Client, svcs *Services, progSock string, ...) (string, error)
- func (container *Container) MetaState() (*llb.State, error)
- func (container *Container) MountTargets(ctx context.Context) ([]string, error)
- func (container *Container) PBDefinitions() ([]*pb.Definition, error)
- func (container *Container) PipelinePath() pipeline.Path
- func (container *Container) Publish(ctx context.Context, bk *buildkit.Client, svcs *Services, ref string, ...) (string, error)
- func (container *Container) RootFS(ctx context.Context) (*Directory, error)
- func (container *Container) Service(ctx context.Context, bk *buildkit.Client, progSock string) (*Service, error)
- func (container *Container) ShellEndpoint(bk *buildkit.Client, progSock string, svcs *Services) (string, http.Handler, error)
- func (container *Container) UpdateImageConfig(ctx context.Context, updateFn func(specs.ImageConfig) specs.ImageConfig) (*Container, error)
- func (container *Container) WithDirectory(ctx context.Context, bk *buildkit.Client, subdir string, src *Directory, ...) (*Container, error)
- func (container *Container) WithExec(ctx context.Context, bk *buildkit.Client, progSock string, ...) (*Container, error)
- func (container *Container) WithExposedPort(port Port) (*Container, error)
- func (container *Container) WithFile(ctx context.Context, bk *buildkit.Client, destPath string, src *File, ...) (*Container, error)
- func (container *Container) WithGPU(ctx context.Context, gpuOpts ContainerGPUOpts) (*Container, error)
- func (container *Container) WithMountedCache(ctx context.Context, bk *buildkit.Client, target string, cache *CacheVolume, ...) (*Container, error)
- func (container *Container) WithMountedDirectory(ctx context.Context, bk *buildkit.Client, target string, dir *Directory, ...) (*Container, error)
- func (container *Container) WithMountedFile(ctx context.Context, bk *buildkit.Client, target string, file *File, ...) (*Container, error)
- func (container *Container) WithMountedSecret(ctx context.Context, bk *buildkit.Client, target string, source *Secret, ...) (*Container, error)
- func (container *Container) WithMountedTemp(ctx context.Context, target string) (*Container, error)
- func (container *Container) WithNewFile(ctx context.Context, bk *buildkit.Client, dest string, content []byte, ...) (*Container, error)
- func (container *Container) WithPipeline(ctx context.Context, name, description string, labels []pipeline.Label) (*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(ctx context.Context, svcs *Services, svc *Service, alias string) (*Container, error)
- func (container *Container) WithUnixSocket(ctx context.Context, bk *buildkit.Client, target string, source *socket.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 ContainerGPUOpts
- type ContainerID
- type ContainerMount
- type ContainerMounts
- type ContainerSecret
- type ContainerSocket
- type CopyFilter
- type Directory
- func NewDirectory(ctx context.Context, def *pb.Definition, dir string, pipeline pipeline.Path, ...) *Directory
- func NewDirectorySt(ctx context.Context, st llb.State, dir string, pipeline pipeline.Path, ...) (*Directory, error)
- func NewScratchDirectory(pipeline pipeline.Path, platform specs.Platform) *Directory
- func (dir *Directory) Clone() *Directory
- func (dir *Directory) Diff(ctx context.Context, other *Directory) (*Directory, error)
- func (dir *Directory) Digest() (digest.Digest, error)
- func (dir *Directory) Directory(ctx context.Context, bk *buildkit.Client, svcs *Services, subdir string) (*Directory, error)
- func (dir *Directory) Entries(ctx context.Context, bk *buildkit.Client, svcs *Services, src string) ([]string, error)
- func (dir *Directory) Evaluate(ctx context.Context, bk *buildkit.Client, svcs *Services) (*buildkit.Result, error)
- func (dir *Directory) Export(ctx context.Context, bk *buildkit.Client, host *Host, svcs *Services, ...) (rerr error)
- func (dir *Directory) File(ctx context.Context, bk *buildkit.Client, svcs *Services, file string) (*File, error)
- func (dir *Directory) Glob(ctx context.Context, bk *buildkit.Client, svcs *Services, src string, ...) ([]string, error)
- func (dir *Directory) ID() (DirectoryID, error)
- func (dir *Directory) PBDefinitions() ([]*pb.Definition, error)
- func (dir *Directory) PipelinePath() pipeline.Path
- func (dir *Directory) Root() (*Directory, error)
- func (dir *Directory) SetState(ctx context.Context, st llb.State) error
- func (dir *Directory) Stat(ctx context.Context, bk *buildkit.Client, svcs *Services, src string) (*fstypes.Stat, error)
- func (dir *Directory) State() (llb.State, error)
- func (dir *Directory) StateWithSourcePath() (llb.State, error)
- func (dir *Directory) WithDirectory(ctx context.Context, destDir string, src *Directory, filter CopyFilter, ...) (*Directory, error)
- func (dir *Directory) WithFile(ctx context.Context, destPath 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) WithPipeline(ctx context.Context, name, description string, labels []pipeline.Label) (*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 FieldTypeDef
- type File
- func NewFile(ctx context.Context, def *pb.Definition, file string, pipeline pipeline.Path, ...) *File
- func NewFileSt(ctx context.Context, st llb.State, dir string, pipeline pipeline.Path, ...) (*File, error)
- func NewFileWithContents(ctx context.Context, bk *buildkit.Client, svcs *Services, name string, ...) (*File, error)
- func (file *File) Clone() *File
- func (file *File) Contents(ctx context.Context, bk *buildkit.Client, svcs *Services) ([]byte, error)
- func (file *File) Digest() (digest.Digest, error)
- func (file *File) Evaluate(ctx context.Context, bk *buildkit.Client, svcs *Services) error
- func (file *File) Export(ctx context.Context, bk *buildkit.Client, host *Host, svcs *Services, ...) error
- func (file *File) ID() (FileID, error)
- func (file *File) Open(ctx context.Context, host *Host, bk *buildkit.Client, svcs *Services) (io.ReadCloser, error)
- func (file *File) PBDefinitions() ([]*pb.Definition, error)
- func (file *File) PipelinePath() pipeline.Path
- func (file *File) Stat(ctx context.Context, bk *buildkit.Client, svcs *Services) (*fstypes.Stat, error)
- func (file *File) State() (llb.State, error)
- func (file *File) WithTimestamps(ctx context.Context, unix int) (*File, error)
- type FileID
- type Function
- type FunctionArg
- type FunctionArgID
- type FunctionCall
- type FunctionID
- type GeneratedCode
- func (code GeneratedCode) Clone() *GeneratedCode
- func (code *GeneratedCode) Digest() (digest.Digest, error)
- func (code *GeneratedCode) ID() (GeneratedCodeID, error)
- func (code *GeneratedCode) WithVCSGeneratedPaths(paths []string) *GeneratedCode
- func (code *GeneratedCode) WithVCSIgnoredPaths(paths []string) *GeneratedCode
- type GeneratedCodeID
- type GitRef
- type GitRefID
- type GitRepository
- type GitRepositoryID
- type HasPBDefinitions
- type Host
- func (host *Host) Directory(ctx context.Context, bk *buildkit.Client, dirPath string, p pipeline.Path, ...) (*Directory, error)
- func (host *Host) File(ctx context.Context, bk *buildkit.Client, svcs *Services, path string, ...) (*File, error)
- func (host *Host) Socket(ctx context.Context, sockPath string) (*socket.Socket, error)
- type ImageLayerCompression
- type ImageMediaTypes
- type ListTypeDef
- type Module
- func (mod *Module) BaseDigest() (digest.Digest, error)
- func (mod Module) Clone() *Module
- func (mod *Module) Digest() (digest.Digest, error)
- func (mod *Module) ID() (ModuleID, error)
- func (mod *Module) PBDefinitions() ([]*pb.Definition, error)
- func (mod *Module) WithObject(def *TypeDef) (*Module, error)
- type ModuleID
- type NetworkProtocol
- type ObjectTypeDef
- type Ownership
- type Port
- type PortForward
- type Query
- type RunningService
- type Secret
- type SecretID
- type SecretStore
- type SecretToScrubInfo
- type Service
- func (svc *Service) Clone() *Service
- func (svc *Service) Digest() (digest.Digest, error)
- func (svc *Service) Endpoint(ctx context.Context, svcs *Services, port int, scheme string) (string, error)
- func (svc *Service) Hostname(ctx context.Context, svcs *Services) (string, error)
- func (svc *Service) ID() (ServiceID, error)
- func (svc *Service) PipelinePath() pipeline.Path
- func (svc *Service) Ports(ctx context.Context, svcs *Services) ([]Port, error)
- func (svc *Service) Start(ctx context.Context, bk *buildkit.Client, svcs *Services, interactive bool, ...) (running *RunningService, err error)
- type ServiceBinding
- type ServiceBindings
- type ServiceID
- type ServiceKey
- type Services
- func (ss *Services) Detach(ctx context.Context, svc *RunningService) error
- func (ss *Services) Get(ctx context.Context, svc Startable) (*RunningService, error)
- func (ss *Services) Start(ctx context.Context, svc Startable) (*RunningService, error)
- func (ss *Services) StartBindings(ctx context.Context, bk *buildkit.Client, bindings ServiceBindings) (_ func(), _ []*RunningService, err error)
- func (ss *Services) Stop(ctx context.Context, bk *buildkit.Client, svc *Service) error
- func (ss *Services) StopClientServices(ctx context.Context, client *engine.ClientMetadata) error
- type Startable
- type TypeDef
- func (typeDef TypeDef) Clone() *TypeDef
- func (typeDef *TypeDef) Digest() (digest.Digest, error)
- func (typeDef *TypeDef) ID() (TypeDefID, error)
- func (typeDef *TypeDef) Underlying() *TypeDef
- func (typeDef *TypeDef) WithKind(kind TypeDefKind) *TypeDef
- func (typeDef *TypeDef) WithListOf(elem *TypeDef) *TypeDef
- func (typeDef *TypeDef) WithObject(name, desc string) *TypeDef
- func (typeDef *TypeDef) WithObjectConstructor(fn *Function) (*TypeDef, error)
- func (typeDef *TypeDef) WithObjectField(name string, fieldType *TypeDef, desc string) (*TypeDef, error)
- func (typeDef *TypeDef) WithObjectFunction(fn *Function) (*TypeDef, error)
- func (typeDef *TypeDef) WithOptional(optional bool) *TypeDef
- type TypeDefID
- type TypeDefKind
Constants ¶
const DetachGracePeriod = 10 * time.Second
DetachGracePeriod is an arbitrary amount of time between when a service is no longer actively used and before it is detached. This is to avoid repeated stopping and re-starting of the same service in rapid succession.
const (
ShimEnableTTYEnvVar = "_DAGGER_ENABLE_TTY"
)
Variables ¶
var ErrCacheMapRecursiveCall = fmt.Errorf("recursive call detected")
var ErrContainerNoExec = errors.New("no command has been executed")
var ErrInvalidCacheVolumeID = errors.New("invalid cache ID; create one using cacheVolume")
var SeenCacheKeys = new(sync.Map)
Functions ¶
func LoadModuleConfig ¶ added in v0.9.0
func LoadModuleConfig( ctx context.Context, bk *buildkit.Client, svcs *Services, sourceDir *Directory, configPath string, ) (string, *modules.Config, error)
Load the module config from the module from the given diretory at the given path
func LoadModuleConfigFromFile ¶ added in v0.9.0
func LoadModuleConfigFromFile( ctx context.Context, bk *buildkit.Client, svcs *Services, configFile *File, ) (*modules.Config, error)
Load the module config as parsed from the given File
Types ¶
type CacheMap ¶ added in v0.8.0
type CacheMap[K comparable, T any] struct { // contains filtered or unexported fields }
func NewCacheMap ¶ added in v0.8.0
func NewCacheMap[K comparable, T any]() *CacheMap[K, T]
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" )
func (CacheSharingMode) MarshalJSON ¶ added in v0.9.0
func (mode CacheSharingMode) MarshalJSON() ([]byte, error)
CacheSharingMode marshals to its lowercased value.
NB: as far as I can recall this is purely for ~*aesthetic*~. GraphQL consts are so shouty!
func (*CacheSharingMode) UnmarshalJSON ¶ added in v0.9.0
func (mode *CacheSharingMode) UnmarshalJSON(payload []byte) error
CacheSharingMode marshals to its lowercased value.
NB: as far as I can recall this is purely for ~*aesthetic*~. GraphQL consts are so shouty!
type CacheVolume ¶
type CacheVolume struct {
Keys []string `json:"keys"`
}
CacheVolume is a persistent volume with a globally scoped identifier.
func NewCache ¶
func NewCache(keys ...string) *CacheVolume
func (*CacheVolume) Clone ¶ added in v0.5.1
func (cache *CacheVolume) Clone() *CacheVolume
func (*CacheVolume) Digest ¶ added in v0.8.8
func (cache *CacheVolume) Digest() (digest.Digest, error)
func (*CacheVolume) ID ¶
func (cache *CacheVolume) ID() (CacheVolumeID, error)
func (*CacheVolume) Sum ¶ added in v0.5.1
func (cache *CacheVolume) Sum() string
Sum returns a checksum of the cache tokens suitable for use as a cache key.
func (*CacheVolume) WithKey ¶
func (cache *CacheVolume) WithKey(key string) *CacheVolume
type CacheVolumeID ¶ added in v0.9.0
type CacheVolumeID = resourceid.ID[CacheVolume]
type Container ¶
type Container struct { // The container's root filesystem. FS *pb.Definition `json:"fs"` // Image configuration (env, workdir, etc) Config specs.ImageConfig `json:"cfg"` // List of GPU devices that will be exposed to the container EnabledGPUs []string `json:"enabledGPUs,omitempty"` // Pipeline Pipeline pipeline.Path `json:"pipeline"` // Mount points configured for the container. Mounts ContainerMounts `json:"mounts,omitempty"` // Meta is the /dagger filesystem. It will be null if nothing has run yet. Meta *pb.Definition `json:"meta,omitempty"` // The platform of the container's rootfs. Platform specs.Platform `json:"platform,omitempty"` // Secrets to expose to the container. Secrets []ContainerSecret `json:"secret_env,omitempty"` // Sockets to expose to the container. Sockets []ContainerSocket `json:"sockets,omitempty"` // Image reference ImageRef string `json:"image_ref,omitempty"` // Ports to expose from the container. Ports []Port `json:"ports,omitempty"` // Services to start before running the container. Services ServiceBindings `json:"services,omitempty"` // Focused indicates whether subsequent operations will be // focused, i.e. shown more prominently in the UI. Focused bool `json:"focused"` }
Container is a content-addressed container.
func NewContainer ¶ added in v0.3.3
func (*Container) AsTarball ¶ added in v0.9.0
func (container *Container) AsTarball( ctx context.Context, bk *buildkit.Client, engineHostPlatform specs.Platform, svcs *Services, platformVariants []ContainerID, forcedCompression ImageLayerCompression, mediaTypes ImageMediaTypes, ) (*File, error)
func (*Container) Clone ¶ added in v0.5.1
Clone returns a deep copy of the container suitable for modifying in a WithXXX method.
func (*Container) Export ¶ added in v0.3.3
func (container *Container) Export( ctx context.Context, bk *buildkit.Client, svcs *Services, dest string, platformVariants []ContainerID, forcedCompression ImageLayerCompression, mediaTypes ImageMediaTypes, ) error
func (*Container) FSState ¶ added in v0.5.1
FSState returns the container's root filesystem mount state. If there is none (as with an empty container ID), it returns scratch.
func (*Container) ID ¶
func (container *Container) ID() (ContainerID, error)
ID marshals the container into a content-addressed ID.
func (*Container) ImageConfig ¶
func (*Container) ImageRefOrErr ¶ added in v0.5.1
func (*Container) MetaFileContents ¶ added in v0.3.5
func (*Container) MetaState ¶ added in v0.5.1
MetaState returns the container's metadata mount state. If the container has yet to run, it returns nil.
func (*Container) MountTargets ¶ added in v0.5.1
func (*Container) PBDefinitions ¶ added in v0.8.8
func (container *Container) PBDefinitions() ([]*pb.Definition, error)
func (*Container) PipelinePath ¶ added in v0.5.2
PipelinePath returns the container's pipeline path.
func (*Container) Publish ¶
func (container *Container) Publish( ctx context.Context, bk *buildkit.Client, svcs *Services, ref string, platformVariants []ContainerID, forcedCompression ImageLayerCompression, mediaTypes ImageMediaTypes, ) (string, error)
func (*Container) ShellEndpoint ¶ added in v0.8.8
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) WithMountedCache ¶
func (*Container) WithMountedDirectory ¶
func (*Container) WithMountedFile ¶
func (*Container) WithMountedSecret ¶
func (*Container) WithMountedTemp ¶
func (*Container) WithNewFile ¶ added in v0.3.7
func (*Container) WithPipeline ¶ added in v0.5.1
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 // If the container has an entrypoint, ignore it for this exec rather than // calling it with args. SkipEntrypoint bool // 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 // (Internal-only) If this exec is for a module function, this digest will be set in the // grpc context metadata for any api requests back to the engine. It's used by the API // server to determine which schema to serve and other module context metadata. ModuleCallerDigest digest.Digest // (Internal-only) Used for module function execs to trigger the nested api client to // be connected back to the same session. NestedInSameSession bool }
type ContainerGPUOpts ¶ added in v0.9.2
type ContainerGPUOpts struct {
Devices []string `json:"devices"`
}
type ContainerID ¶
type ContainerID = resourceid.ID[Container]
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. CacheVolumeID string `json:"cache_volume_id,omitempty"` // How to share the cache across concurrent runs. CacheSharingMode CacheSharingMode `json:"cache_sharing,omitempty"` // Configure the mount as a tmpfs. Tmpfs bool `json:"tmpfs,omitempty"` // Configure the mount as read-only. Readonly bool `json:"readonly,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 ContainerSecret ¶
type ContainerSecret struct { Secret SecretID `json:"secret"` EnvName string `json:"env,omitempty"` MountPath string `json:"path,omitempty"` Owner *Ownership `json:"owner,omitempty"` Mode *int `json:"mode,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 { SocketID socket.ID `json:"socket"` UnixPath string `json:"unix_path,omitempty"` Owner *Ownership `json:"owner,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 { LLB *pb.Definition `json:"llb"` Dir string `json:"dir"` Platform specs.Platform `json:"platform"` Pipeline pipeline.Path `json:"pipeline"` // Services necessary to provision the directory. Services ServiceBindings `json:"services,omitempty"` }
Directory is a content-addressed directory.
func NewDirectory ¶
func NewDirectorySt ¶ added in v0.5.2
func NewScratchDirectory ¶ added in v0.6.3
func (*Directory) Clone ¶ added in v0.5.1
Clone returns a deep copy of the container suitable for modifying in a WithXXX method.
func (*Directory) Glob ¶ added in v0.9.1
func (dir *Directory) Glob(ctx context.Context, bk *buildkit.Client, svcs *Services, src string, pattern string) ([]string, error)
Glob returns a list of files that matches the given pattern.
Note(TomChv): Instead of handling the recursive manually, we could update cacheutil.ReadDir so it will only mount and unmount the filesystem one time. However, this requires to maintain buildkit code and is not mandatory for now until we hit performances issues.
func (*Directory) ID ¶
func (dir *Directory) ID() (DirectoryID, error)
func (*Directory) PBDefinitions ¶ added in v0.8.8
func (dir *Directory) PBDefinitions() ([]*pb.Definition, error)
func (*Directory) PipelinePath ¶ added in v0.5.2
func (*Directory) StateWithSourcePath ¶ added in v0.5.1
func (*Directory) WithDirectory ¶
func (*Directory) WithNewDirectory ¶ added in v0.3.3
func (*Directory) WithNewFile ¶
func (*Directory) WithPipeline ¶ added in v0.5.1
func (*Directory) WithTimestamps ¶ added in v0.3.8
type DirectoryID ¶
type DirectoryID = resourceid.ID[Directory]
type FieldTypeDef ¶ added in v0.8.8
type FieldTypeDef struct { Name string `json:"name"` Description string `json:"description"` TypeDef *TypeDef `json:"typeDef"` // The original name of the object as provided by the SDK that defined it, used // when invoking the SDK so it doesn't need to think as hard about case conversions OriginalName string `json:"originalName,omitempty"` }
func (FieldTypeDef) Clone ¶ added in v0.8.8
func (typeDef FieldTypeDef) Clone() *FieldTypeDef
type File ¶
type File struct { LLB *pb.Definition `json:"llb"` File string `json:"file"` Pipeline pipeline.Path `json:"pipeline"` Platform specs.Platform `json:"platform"` // Services necessary to provision the file. Services ServiceBindings `json:"services,omitempty"` }
File is a content-addressed file.
func NewFileWithContents ¶ added in v0.9.2
func (*File) Clone ¶ added in v0.5.1
Clone returns a deep copy of the container suitable for modifying in a WithXXX method.
func (*File) Contents ¶
func (file *File) Contents(ctx context.Context, bk *buildkit.Client, svcs *Services) ([]byte, error)
Contents handles file content retrieval
func (*File) PBDefinitions ¶ added in v0.8.8
func (file *File) PBDefinitions() ([]*pb.Definition, error)
func (*File) PipelinePath ¶ added in v0.5.2
type FileID ¶
type FileID = resourceid.ID[File]
type Function ¶ added in v0.8.8
type Function struct { // Name is the standardized name of the function (lowerCamelCase), as used for the resolver in the graphql schema Name string `json:"name"` Description string `json:"description"` Args []*FunctionArg `json:"args"` ReturnType *TypeDef `json:"returnType"` // OriginalName of the parent object ParentOriginalName string `json:"parentOriginalName,omitempty"` // The original name of the function as provided by the SDK that defined it, used // when invoking the SDK so it doesn't need to think as hard about case conversions OriginalName string `json:"originalName,omitempty"` }
func NewFunction ¶ added in v0.8.8
func (*Function) ID ¶ added in v0.8.8
func (fn *Function) ID() (FunctionID, error)
func (*Function) WithDescription ¶ added in v0.8.8
type FunctionArg ¶ added in v0.8.8
type FunctionArg struct { // Name is the standardized name of the argument (lowerCamelCase), as used for the resolver in the graphql schema Name string `json:"name"` Description string `json:"description"` TypeDef *TypeDef `json:"typeDef"` DefaultValue any `json:"defaultValue"` // The original name of the argument as provided by the SDK that defined it. OriginalName string `json:"originalName,omitempty"` }
func (FunctionArg) Clone ¶ added in v0.8.8
func (arg FunctionArg) Clone() *FunctionArg
func (*FunctionArg) ID ¶ added in v0.9.4
func (arg *FunctionArg) ID() (FunctionArgID, error)
type FunctionArgID ¶ added in v0.9.4
type FunctionArgID = resourceid.ID[FunctionArg]
type FunctionCall ¶ added in v0.8.8
type FunctionCall struct { Name string `json:"name"` ParentName string `json:"parentName"` Parent any `json:"parent"` InputArgs []*CallInput `json:"inputArgs"` }
func (*FunctionCall) Digest ¶ added in v0.8.8
func (fnCall *FunctionCall) Digest() (digest.Digest, error)
type FunctionID ¶ added in v0.8.8
type FunctionID = resourceid.ID[Function]
type GeneratedCode ¶ added in v0.8.8
type GeneratedCode struct { Code *Directory `json:"code"` VCSIgnoredPaths []string `json:"vcsIgnoredPaths,omitempty"` VCSGeneratedPaths []string `json:"vcsGeneratedPaths,omitempty"` }
func NewGeneratedCode ¶ added in v0.9.0
func NewGeneratedCode(code *Directory) *GeneratedCode
func (GeneratedCode) Clone ¶ added in v0.8.8
func (code GeneratedCode) Clone() *GeneratedCode
func (*GeneratedCode) Digest ¶ added in v0.8.8
func (code *GeneratedCode) Digest() (digest.Digest, error)
func (*GeneratedCode) ID ¶ added in v0.8.8
func (code *GeneratedCode) ID() (GeneratedCodeID, error)
func (*GeneratedCode) WithVCSGeneratedPaths ¶ added in v0.8.8
func (code *GeneratedCode) WithVCSGeneratedPaths(paths []string) *GeneratedCode
func (*GeneratedCode) WithVCSIgnoredPaths ¶ added in v0.8.8
func (code *GeneratedCode) WithVCSIgnoredPaths(paths []string) *GeneratedCode
type GeneratedCodeID ¶ added in v0.8.8
type GeneratedCodeID = resourceid.ID[GeneratedCode]
type GitRef ¶ added in v0.9.1
type GitRef struct { Ref string `json:"ref"` Repo *GitRepository `json:"repository"` }
type GitRefID ¶ added in v0.9.4
type GitRefID = resourceid.ID[GitRef]
type GitRepository ¶ added in v0.9.4
type GitRepository struct { URL string `json:"url"` KeepGitDir bool `json:"keepGitDir"` SSHKnownHosts string `json:"sshKnownHosts"` SSHAuthSocket socket.ID `json:"sshAuthSocket"` Services ServiceBindings `json:"services"` Pipeline pipeline.Path `json:"pipeline"` Platform specs.Platform `json:"platform,omitempty"` }
func (*GitRepository) ID ¶ added in v0.9.4
func (repo *GitRepository) ID() (GitRepositoryID, error)
type GitRepositoryID ¶ added in v0.9.4
type GitRepositoryID = resourceid.ID[GitRepository]
type HasPBDefinitions ¶ added in v0.8.8
type HasPBDefinitions interface {
PBDefinitions() ([]*pb.Definition, error)
}
type Host ¶ added in v0.3.3
type Host struct { }
type ImageLayerCompression ¶ added in v0.5.3
type ImageLayerCompression string
const ( CompressionGzip ImageLayerCompression = "Gzip" CompressionZstd ImageLayerCompression = "Zstd" CompressionEStarGZ ImageLayerCompression = "EStarGZ" CompressionUncompressed ImageLayerCompression = "Uncompressed" )
type ImageMediaTypes ¶ added in v0.6.4
type ImageMediaTypes string
const ( OCIMediaTypes ImageMediaTypes = "OCIMediaTypes" DockerMediaTypes ImageMediaTypes = "DockerMediaTypes" )
type ListTypeDef ¶ added in v0.8.8
type ListTypeDef struct {
ElementTypeDef *TypeDef `json:"elementTypeDef"`
}
func (ListTypeDef) Clone ¶ added in v0.8.8
func (typeDef ListTypeDef) Clone() *ListTypeDef
type Module ¶ added in v0.8.8
type Module struct { // The module's source code root directory SourceDirectory *Directory `json:"sourceDirectory"` // If set, the subdir of the SourceDirectory that contains the module's source code SourceDirectorySubpath string `json:"sourceDirectorySubpath"` // The name of the module Name string `json:"name"` // The doc string of the module, if any Description string `json:"description"` // Dependencies as configured by the module DependencyConfig []string `json:"dependencyConfig"` // The module's objects Objects []*TypeDef `json:"objects,omitempty"` // The module's SDK, as set in the module config file SDK string `json:"sdk,omitempty"` }
func ModuleFromConfig ¶ added in v0.9.4
func ModuleFromConfig( ctx context.Context, bk *buildkit.Client, svcs *Services, sourceDir *Directory, configPath string, ) (*Module, error)
ModuleFromConfig creates a Module from a dagger.json config file.
func ModuleFromRef ¶ added in v0.9.4
func ModuleFromRef( ctx context.Context, bk *buildkit.Client, svcs *Services, pipeline pipeline.Path, platform ocispecs.Platform, parentSrcDir *Directory, parentSrcSubpath string, moduleRefStr string, ) (*Module, error)
Load the module metadata from the given module reference. parentSrcDir and parentSrcSubpath are used to resolve local module refs if needed (i.e. this is a local dep of another module)
func (*Module) BaseDigest ¶ added in v0.9.2
BaseDigest gives a digest after unsetting Objects, which is useful as a digest of the "base" Module that's stable before+after loading TypeDefs
func (*Module) PBDefinitions ¶ added in v0.8.8
func (mod *Module) PBDefinitions() ([]*pb.Definition, error)
type ModuleID ¶ added in v0.8.8
type ModuleID = resourceid.ID[Module]
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) EnumName ¶ added in v0.8.5
func (proto NetworkProtocol) EnumName() string
func (NetworkProtocol) Network ¶ added in v0.3.13
func (proto 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 ObjectTypeDef ¶ added in v0.8.8
type ObjectTypeDef struct { // Name is the standardized name of the object (CamelCase), as used for the object in the graphql schema Name string `json:"name"` Description string `json:"description"` Fields []*FieldTypeDef `json:"fields"` Functions []*Function `json:"functions"` Constructor *Function `json:"constructor"` // The original name of the object as provided by the SDK that defined it, used // when invoking the SDK so it doesn't need to think as hard about case conversions OriginalName string `json:"originalName,omitempty"` }
func NewObjectTypeDef ¶ added in v0.9.1
func NewObjectTypeDef(name, description string) *ObjectTypeDef
func (ObjectTypeDef) Clone ¶ added in v0.8.8
func (typeDef ObjectTypeDef) Clone() *ObjectTypeDef
func (ObjectTypeDef) FieldByName ¶ added in v0.8.8
func (typeDef ObjectTypeDef) FieldByName(name string) (*FieldTypeDef, bool)
func (ObjectTypeDef) FunctionByName ¶ added in v0.8.8
func (typeDef ObjectTypeDef) FunctionByName(name string) (*Function, bool)
type Ownership ¶ added in v0.5.1
Ownership contains a UID/GID pair resolved from a user/group name or ID pair provided via the API. It primarily exists to distinguish an unspecified ownership from UID/GID 0 (root) ownership.
func (Ownership) Opt ¶ added in v0.5.1
func (owner Ownership) Opt() llb.ChownOption
type Port ¶ added in v0.8.5
type Port struct { Port int `json:"port"` Protocol NetworkProtocol `json:"protocol"` Description *string `json:"description,omitempty"` }
Port configures a port to exposed from a container or service.
type PortForward ¶ added in v0.9.0
type PortForward struct { Frontend int `json:"frontend"` Backend int `json:"backend"` Protocol NetworkProtocol `json:"protocol"` }
func (PortForward) FrontendOrBackendPort ¶ added in v0.9.0
func (pf PortForward) FrontendOrBackendPort() int
type Query ¶ added in v0.3.10
func (*Query) PipelinePath ¶ added in v0.4.0
type RunningService ¶ added in v0.8.5
type RunningService struct { // Service is the service that has been started. Service *Service // Key is the unique identifier for the service. Key ServiceKey // Host is the hostname used to reach the service. Host string // Ports lists the ports bound by the service. // // For a Container service, this is simply the list of exposed ports. // // For a TunnelService, this lists the configured port forwards with any // empty or 0 frontend ports resolved to their randomly selected host port. // // For a HostService, this lists the configured port forwards with any empty // or 0 frontend ports set to the same as the backend port. Ports []Port // Stop forcibly stops the service. It is normally called after all clients // have detached, but may also be called manually by the user. Stop func(context.Context) error // Block until the service has exited or the provided context is canceled. Wait func(context.Context) error }
RunningService represents a service that is actively running.
type Secret ¶
type Secret struct { // Name specifies the arbitrary name/id of the secret. Name string `json:"name,omitempty"` }
Secret is a content-addressed secret.
func NewDynamicSecret ¶ added in v0.5.1
type SecretID ¶
type SecretID = resourceid.ID[Secret]
type SecretStore ¶ added in v0.8.0
type SecretStore struct {
// contains filtered or unexported fields
}
func NewSecretStore ¶ added in v0.8.0
func NewSecretStore() *SecretStore
func (*SecretStore) AddSecret ¶ added in v0.8.0
func (store *SecretStore) AddSecret(_ context.Context, name string, plaintext []byte) (SecretID, error)
AddSecret adds the secret identified by user defined name with its plaintext value to the secret store.
func (*SecretStore) GetSecret ¶ added in v0.8.0
GetSecret returns the plaintext secret value.
Its argument may either be the user defined name originally specified within a SecretID, or a full SecretID value.
A user defined name will be received when secrets are used in a Dockerfile build.
In all other cases, a SecretID is expected.
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 Service ¶ added in v0.3.13
type Service struct { // Container is the container to run as a service. Container *Container `json:"container"` // TunnelUpstream is the service that this service is tunnelling to. TunnelUpstream *Service `json:"upstream,omitempty"` // TunnelPorts configures the port forwarding rules for the tunnel. TunnelPorts []PortForward `json:"tunnel_ports,omitempty"` // HostUpstream is the host address (i.e. hostname or IP) for the reverse // tunnel to request through the host. HostUpstream string `json:"reverse_tunnel_upstream_addr,omitempty"` // HostPorts configures the port forwarding rules for the host. HostPorts []PortForward `json:"host_ports,omitempty"` }
func NewContainerService ¶ added in v0.8.5
func NewHostService ¶ added in v0.9.0
func NewHostService(upstream string, ports []PortForward) *Service
func NewTunnelService ¶ added in v0.9.0
func NewTunnelService(upstream *Service, ports []PortForward) *Service
func (*Service) Clone ¶ added in v0.8.5
Clone returns a deep copy of the container suitable for modifying in a WithXXX method.
func (*Service) PipelinePath ¶ added in v0.8.5
PipelinePath returns the service's pipeline path.
type ServiceBinding ¶ added in v0.8.5
type ServiceBindings ¶ added in v0.3.13
type ServiceBindings []ServiceBinding
func (*ServiceBindings) Merge ¶ added in v0.3.13
func (bndp *ServiceBindings) Merge(other ServiceBindings)
type ServiceID ¶ added in v0.8.5
type ServiceID = resourceid.ID[Service]
type ServiceKey ¶ added in v0.8.5
type ServiceKey struct { Digest digest.Digest ClientID string }
ServiceKey is a unique identifier for a service.
type Services ¶ added in v0.8.5
type Services struct {
// contains filtered or unexported fields
}
Services manages the lifecycle of services, ensuring the same service only runs once per client.
func NewServices ¶ added in v0.8.5
NewServices returns a new Services.
func (*Services) Detach ¶ added in v0.8.5
func (ss *Services) Detach(ctx context.Context, svc *RunningService) error
Detach detaches from the given service. If the service is not running, it is a no-op. If the service is running, it is stopped if there are no other clients using it.
func (*Services) Get ¶ added in v0.8.5
Get returns the running service for the given service. If the service is starting, it waits for it and either returns the running service or an error if it failed to start. If the service is not running or starting, an error is returned.
func (*Services) Start ¶ added in v0.8.5
Start starts the given service, returning the running service. If the service is already running, it is returned immediately. If the service is already starting, it waits for it to finish and returns the running service. If the service failed to start, it tries again.
func (*Services) StartBindings ¶ added in v0.8.5
func (ss *Services) StartBindings(ctx context.Context, bk *buildkit.Client, bindings ServiceBindings) (_ func(), _ []*RunningService, err error)
StartBindings starts each of the bound services in parallel and returns a function that will detach from all of them after 10 seconds.
func (*Services) Stop ¶ added in v0.8.5
Stop stops the given service. If the service is not running, it is a no-op.
func (*Services) StopClientServices ¶ added in v0.8.5
StopClientServices stops all of the services being run by the given client. It is called when a client is closing.
type TypeDef ¶ added in v0.8.8
type TypeDef struct { Kind TypeDefKind `json:"kind"` Optional bool `json:"optional"` AsList *ListTypeDef `json:"asList"` AsObject *ObjectTypeDef `json:"asObject"` }
func (*TypeDef) Underlying ¶ added in v0.9.4
func (*TypeDef) WithKind ¶ added in v0.8.8
func (typeDef *TypeDef) WithKind(kind TypeDefKind) *TypeDef
func (*TypeDef) WithListOf ¶ added in v0.8.8
func (*TypeDef) WithObject ¶ added in v0.8.8
func (*TypeDef) WithObjectConstructor ¶ added in v0.9.4
func (*TypeDef) WithObjectField ¶ added in v0.8.8
func (*TypeDef) WithObjectFunction ¶ added in v0.8.8
func (*TypeDef) WithOptional ¶ added in v0.8.8
type TypeDefID ¶ added in v0.8.8
type TypeDefID = resourceid.ID[TypeDef]
type TypeDefKind ¶ added in v0.8.8
type TypeDefKind string
const ( TypeDefKindString TypeDefKind = "StringKind" TypeDefKindInteger TypeDefKind = "IntegerKind" TypeDefKindBoolean TypeDefKind = "BooleanKind" TypeDefKindList TypeDefKind = "ListKind" TypeDefKindObject TypeDefKind = "ObjectKind" TypeDefKindVoid TypeDefKind = "VoidKind" )
func (TypeDefKind) String ¶ added in v0.8.8
func (k TypeDefKind) String() string