core

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: Apache-2.0 Imports: 55 Imported by: 1

Documentation

Index

Constants

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 (16777216) in
	// order to keep space for any Protocol Buffers overhead:
	MaxFileContentsChunkSize = 15938355

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

	// 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"
)
View Source
const OCIStoreName = "dagger-oci"

Variables

View Source
var ErrContainerNoExec = errors.New("no command has been executed")
View Source
var ErrHostRWDisabled = errors.New("host read/write is disabled")
View Source
var ErrInvalidCacheID = errors.New("invalid cache ID; create one using cacheVolume")

Functions

func AddEnv added in v0.6.0

func AddEnv(env []string, name, value string) []string

AddEnv adds or updates an environment variable in 'env'.

func LookupEnv added in v0.6.0

func LookupEnv(env []string, name string) (string, bool)

LookupEnv returns the value of an environment variable.

func WalkEnv added in v0.6.0

func WalkEnv(env []string, fn func(string, string, string))

WalkEnv iterates over all environment variables with parsed key and value, and original string.

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 AliasSet added in v0.3.13

type AliasSet []string

func (AliasSet) String added in v0.3.13

func (set AliasSet) String() string

func (AliasSet) With added in v0.3.13

func (set AliasSet) With(alias string) AliasSet

type BuildArg added in v0.3.8

type BuildArg struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

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".

func (CacheID) ToCacheVolume added in v0.5.1

func (id CacheID) ToCacheVolume() (*CacheVolume, error)

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 (
	CacheSharingModeShared  CacheSharingMode = "SHARED"
	CacheSharingModePrivate CacheSharingMode = "PRIVATE"
	CacheSharingModeLocked  CacheSharingMode = "LOCKED"
)

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) ID

func (cache *CacheVolume) ID() (CacheID, 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 Container

type Container struct {
	// The container's root filesystem.
	FS *pb.Definition `json:"fs"`

	// Image configuration (env, workdir, etc)
	Config specs.ImageConfig `json:"cfg"`

	// 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"`

	// Hostname is the computed hostname for the container.
	Hostname string `json:"hostname,omitempty"`

	// Ports to expose from the container.
	Ports []ContainerPort `json:"ports,omitempty"`

	// Services to start before running the container.
	Services    ServiceBindings `json:"services,omitempty"`
	HostAliases []HostAlias     `json:"host_aliases,omitempty"`
}

Container is a content-addressed container.

func NewContainer added in v0.3.3

func NewContainer(id ContainerID, pipeline pipeline.Path, platform specs.Platform) (*Container, error)

func (*Container) Build

func (container *Container) Build(
	ctx context.Context,
	gw bkgw.Client,
	context *Directory,
	dockerfile string,
	buildArgs []BuildArg,
	target string,
	secrets []SecretID,
) (*Container, error)

func (*Container) Clone added in v0.5.1

func (container *Container) Clone() *Container

Clone returns a deep copy of the container suitable for modifying in a WithXXX method.

func (*Container) Digest added in v0.5.2

func (container *Container) Digest() (digest.Digest, error)

Digest returns the container's content hash.

func (*Container) Directory

func (container *Container) Directory(ctx context.Context, gw bkgw.Client, dirPath string) (*Directory, error)

func (*Container) Endpoint added in v0.3.13

func (container *Container) Endpoint(port int, scheme string) (string, error)

func (*Container) Evaluate added in v0.3.13

func (container *Container) Evaluate(ctx context.Context, gw bkgw.Client, pipelineOverride *pipeline.Path) error

func (*Container) ExitCode

func (container *Container) ExitCode(ctx context.Context, gw bkgw.Client, progSock *Socket) (int, error)

func (*Container) Export added in v0.3.3

func (container *Container) Export(
	ctx context.Context,
	host *Host,
	dest string,
	platformVariants []ContainerID,
	forcedCompression ImageLayerCompression,
	bkClient *bkclient.Client,
	solveOpts bkclient.SolveOpt,
	solveCh chan<- *bkclient.SolveStatus,
) error

func (*Container) FSState added in v0.5.1

func (container *Container) FSState() (llb.State, error)

FSState returns the container's root filesystem mount state. If there is none (as with an empty container ID), it returns scratch.

func (*Container) File

func (container *Container) File(ctx context.Context, gw bkgw.Client, filePath string) (*File, error)

func (*Container) From

func (container *Container) From(ctx context.Context, gw bkgw.Client, addr string) (*Container, error)

func (*Container) HostnameOrErr added in v0.5.1

func (container *Container) HostnameOrErr() (string, error)

func (*Container) ID

func (container *Container) ID() (ContainerID, error)

ID marshals the container into a content-addressed ID.

func (*Container) ImageConfig

func (container *Container) ImageConfig(ctx context.Context) (specs.ImageConfig, error)

func (*Container) ImageRefOrErr added in v0.5.1

func (container *Container) ImageRefOrErr(ctx context.Context, gw bkgw.Client) (string, error)

func (*Container) Import added in v0.5.0

func (container *Container) Import(
	ctx context.Context,
	gw bkgw.Client,
	host *Host,
	source FileID,
	tag string,
	store content.Store,
) (*Container, error)

func (*Container) MetaFileContents added in v0.3.5

func (container *Container) MetaFileContents(ctx context.Context, gw bkgw.Client, progSock *Socket, filePath string) (string, error)

func (*Container) MetaState added in v0.5.1

func (container *Container) MetaState() (*llb.State, error)

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 *Container) MountTargets(ctx context.Context) ([]string, error)

func (*Container) PipelinePath added in v0.5.2

func (container *Container) PipelinePath() pipeline.Path

PipelinePath returns the container's pipeline path.

func (*Container) Publish

func (container *Container) Publish(
	ctx context.Context,
	ref string,
	platformVariants []ContainerID,
	forcedCompression ImageLayerCompression,
	bkClient *bkclient.Client,
	solveOpts bkclient.SolveOpt,
	solveCh chan<- *bkclient.SolveStatus,
) (string, error)

func (*Container) RootFS added in v0.3.5

func (container *Container) RootFS(ctx context.Context) (*Directory, error)

func (*Container) Start added in v0.3.13

func (container *Container) Start(ctx context.Context, gw bkgw.Client) (*Service, error)

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 *Container) WithDirectory(ctx context.Context, gw bkgw.Client, subdir string, src *Directory, filter CopyFilter, owner string) (*Container, error)

func (*Container) WithExec added in v0.3.13

func (container *Container) WithExec(ctx context.Context, gw bkgw.Client, progSock *Socket, defaultPlatform specs.Platform, opts ContainerExecOpts) (*Container, error)

func (*Container) WithExposedPort added in v0.3.13

func (container *Container) WithExposedPort(port ContainerPort) (*Container, error)

func (*Container) WithFile added in v0.3.7

func (container *Container) WithFile(ctx context.Context, gw bkgw.Client, subdir string, src *File, permissions fs.FileMode, owner string) (*Container, error)

func (*Container) WithMountedCache

func (container *Container) WithMountedCache(ctx context.Context, gw bkgw.Client, target string, cache *CacheVolume, source *Directory, concurrency CacheSharingMode, owner string) (*Container, error)

func (*Container) WithMountedDirectory

func (container *Container) WithMountedDirectory(ctx context.Context, gw bkgw.Client, target string, dir *Directory, owner string) (*Container, error)

func (*Container) WithMountedFile

func (container *Container) WithMountedFile(ctx context.Context, gw bkgw.Client, target string, file *File, owner string) (*Container, error)

func (*Container) WithMountedSecret

func (container *Container) WithMountedSecret(ctx context.Context, gw bkgw.Client, target string, source *Secret, owner string) (*Container, error)

func (*Container) WithMountedTemp

func (container *Container) WithMountedTemp(ctx context.Context, target string) (*Container, error)

func (*Container) WithNewFile added in v0.3.7

func (container *Container) WithNewFile(ctx context.Context, gw bkgw.Client, dest string, content []byte, permissions fs.FileMode, owner string) (*Container, error)

func (*Container) WithPipeline added in v0.5.1

func (container *Container) WithPipeline(ctx context.Context, name, description string, labels []pipeline.Label) (*Container, error)

func (*Container) WithRootFS added in v0.3.5

func (container *Container) WithRootFS(ctx context.Context, dir *Directory) (*Container, error)

func (*Container) WithSecretVariable

func (container *Container) WithSecretVariable(ctx context.Context, name string, secret *Secret) (*Container, error)

func (*Container) WithServiceBinding added in v0.5.0

func (container *Container) WithServiceBinding(svc *Container, alias string) (*Container, error)

func (*Container) WithUnixSocket added in v0.3.7

func (container *Container) WithUnixSocket(ctx context.Context, gw bkgw.Client, target string, source *Socket, owner string) (*Container, error)

func (*Container) WithoutExposedPort added in v0.3.13

func (container *Container) WithoutExposedPort(port int, protocol NetworkProtocol) (*Container, error)

func (*Container) WithoutMount

func (container *Container) WithoutMount(ctx context.Context, target string) (*Container, error)

func (*Container) WithoutUnixSocket added in v0.3.7

func (container *Container) WithoutUnixSocket(ctx context.Context, target string) (*Container, error)

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
}

type ContainerID

type ContainerID string

ContainerID is an opaque value representing a content-addressed container.

func (ContainerID) Digest added in v0.5.2

func (id ContainerID) Digest() (digest.Digest, error)

func (ContainerID) String added in v0.3.13

func (id ContainerID) String() string

func (ContainerID) ToContainer added in v0.5.1

func (id ContainerID) ToContainer() (*Container, error)

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

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"`
	Owner     *Ownership `json:"owner,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"`
	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 CopyFilter struct {
	Exclude []string
	Include []string
}

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 MergeDirectories

func MergeDirectories(ctx context.Context, dirs []*Directory, platform specs.Platform) (*Directory, error)

func NewDirectory

func NewDirectory(ctx context.Context, def *pb.Definition, dir string, pipeline pipeline.Path, platform specs.Platform, services ServiceBindings) *Directory

func NewDirectorySt added in v0.5.2

func NewDirectorySt(ctx context.Context, st llb.State, dir string, pipeline pipeline.Path, platform specs.Platform, services ServiceBindings) (*Directory, error)

func (*Directory) Clone added in v0.5.1

func (dir *Directory) Clone() *Directory

Clone returns a deep copy of the container suitable for modifying in a WithXXX method.

func (*Directory) Diff

func (dir *Directory) Diff(ctx context.Context, other *Directory) (*Directory, error)

func (*Directory) Digest added in v0.5.2

func (dir *Directory) Digest() (digest.Digest, error)

Digest returns the directory's content hash.

func (*Directory) Directory

func (dir *Directory) Directory(ctx context.Context, subdir string) (*Directory, error)

func (*Directory) Entries

func (dir *Directory) Entries(ctx context.Context, gw bkgw.Client, src string) ([]string, error)

func (*Directory) Export added in v0.3.3

func (dir *Directory) Export(
	ctx context.Context,
	host *Host,
	dest string,
	bkClient *bkclient.Client,
	solveOpts bkclient.SolveOpt,
	solveCh chan<- *bkclient.SolveStatus,
) error

func (*Directory) File

func (dir *Directory) File(ctx context.Context, file string) (*File, error)

func (*Directory) ID

func (dir *Directory) ID() (DirectoryID, error)

ID marshals the directory into a content-addressed ID.

func (*Directory) PipelinePath added in v0.5.2

func (dir *Directory) PipelinePath() pipeline.Path

func (*Directory) Root added in v0.5.1

func (dir *Directory) Root() (*Directory, error)

Root removes any relative path from the directory.

func (*Directory) SetState added in v0.5.1

func (dir *Directory) SetState(ctx context.Context, st llb.State) error

func (*Directory) Stat

func (dir *Directory) Stat(ctx context.Context, gw bkgw.Client, src string) (*fstypes.Stat, error)

func (*Directory) State added in v0.5.1

func (dir *Directory) State() (llb.State, error)

func (*Directory) StateWithSourcePath added in v0.5.1

func (dir *Directory) StateWithSourcePath() (llb.State, error)

func (*Directory) WithDirectory

func (dir *Directory) WithDirectory(ctx context.Context, subdir string, src *Directory, filter CopyFilter, owner *Ownership) (*Directory, error)

func (*Directory) WithFile added in v0.3.3

func (dir *Directory) WithFile(ctx context.Context, subdir string, src *File, permissions fs.FileMode, ownership *Ownership) (*Directory, error)

func (*Directory) WithNewDirectory added in v0.3.3

func (dir *Directory) WithNewDirectory(ctx context.Context, dest string, permissions fs.FileMode) (*Directory, error)

func (*Directory) WithNewFile

func (dir *Directory) WithNewFile(ctx context.Context, dest string, content []byte, permissions fs.FileMode, ownership *Ownership) (*Directory, error)

func (*Directory) WithPipeline added in v0.5.1

func (dir *Directory) WithPipeline(ctx context.Context, name, description string, labels []pipeline.Label) (*Directory, error)

func (*Directory) WithTimestamps added in v0.3.8

func (dir *Directory) WithTimestamps(ctx context.Context, unix int) (*Directory, error)

func (*Directory) Without

func (dir *Directory) Without(ctx context.Context, path string) (*Directory, error)

type DirectoryID

type DirectoryID string

DirectoryID is an opaque value representing a content-addressed directory.

func (DirectoryID) Digest added in v0.5.2

func (id DirectoryID) Digest() (digest.Digest, error)

func (DirectoryID) String added in v0.5.2

func (id DirectoryID) String() string

func (DirectoryID) ToDirectory added in v0.5.1

func (id DirectoryID) ToDirectory() (*Directory, error)

ToDirectory converts the ID into a real Directory.

type ExecError added in v0.6.0

type ExecError struct {
	Cmd      []string
	ExitCode int
	Stdout   string
	Stderr   string
	// contains filtered or unexported fields
}

ExecError is an error that occurred while executing an `Op_Exec`.

func (*ExecError) Error added in v0.6.0

func (e *ExecError) Error() string

func (*ExecError) Extensions added in v0.6.0

func (e *ExecError) Extensions() map[string]interface{}

func (*ExecError) Unwrap added in v0.6.0

func (e *ExecError) Unwrap() error

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 NewFile

func NewFile(ctx context.Context, def *pb.Definition, file string, pipeline pipeline.Path, platform specs.Platform, services ServiceBindings) *File

func NewFileSt added in v0.5.2

func NewFileSt(ctx context.Context, st llb.State, dir string, pipeline pipeline.Path, platform specs.Platform, services ServiceBindings) (*File, error)

func (*File) Clone added in v0.5.1

func (file *File) Clone() *File

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, gw bkgw.Client) ([]byte, error)

Contents handles file content retrieval

func (*File) Digest added in v0.5.2

func (file *File) Digest() (digest.Digest, error)

Digest returns the file's content hash.

func (*File) Export added in v0.3.3

func (file *File) Export(
	ctx context.Context,
	host *Host,
	dest string,
	bkClient *bkclient.Client,
	solveOpts bkclient.SolveOpt,
	solveCh chan<- *bkclient.SolveStatus,
) error

func (*File) ID

func (file *File) ID() (FileID, error)

ID marshals the file into a content-addressed ID.

func (*File) Open added in v0.5.0

func (file *File) Open(ctx context.Context, host *Host, gw bkgw.Client) (io.ReadCloser, error)

func (*File) PipelinePath added in v0.5.2

func (file *File) PipelinePath() pipeline.Path

func (*File) Secret

func (file *File) Secret(ctx context.Context) (*Secret, error)

func (*File) Stat

func (file *File) Stat(ctx context.Context, gw bkgw.Client) (*fstypes.Stat, error)

func (*File) State added in v0.5.1

func (file *File) State() (llb.State, error)

func (*File) WithTimestamps added in v0.3.8

func (file *File) WithTimestamps(ctx context.Context, unix int) (*File, error)

type FileID

type FileID string

FileID is an opaque value representing a content-addressed file.

func (FileID) Digest added in v0.5.2

func (id FileID) Digest() (digest.Digest, error)

func (FileID) String added in v0.5.2

func (id FileID) String() string

func (FileID) ToFile added in v0.5.1

func (id FileID) ToFile() (*File, error)

type GatewayClient added in v0.3.8

type GatewayClient struct {
	bkgw.Client
	// contains filtered or unexported fields
}

GatewayClient wraps the standard buildkit gateway client with a few extensions:

* Errors include the output of execs when they fail. * Vertexes are joined to the Progrock group using the recorder from ctx. * Cache imports can be configured across all Solves. * All Solved results can be retrieved for cache exports.

func NewGatewayClient added in v0.3.13

func NewGatewayClient(baseClient bkgw.Client, cacheConfigType string, cacheConfigAttrs map[string]string) *GatewayClient

func (*GatewayClient) CombinedResult added in v0.3.13

func (g *GatewayClient) CombinedResult(ctx context.Context) (*bkgw.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 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

type Host struct {
	Workdir   string
	DisableRW bool
}

func NewHost added in v0.3.3

func NewHost(workdir string, disableRW bool) *Host

func (*Host) Directory added in v0.3.3

func (host *Host) Directory(ctx context.Context, dirPath string, p pipeline.Path, platform specs.Platform, filter CopyFilter) (*Directory, error)

func (*Host) Export added in v0.3.3

func (host *Host) Export(
	ctx context.Context,
	export bkclient.ExportEntry,
	bkClient *bkclient.Client,
	solveOpts bkclient.SolveOpt,
	solveCh chan<- *bkclient.SolveStatus,
	buildFn bkgw.BuildFunc,
) error

func (*Host) NormalizeDest added in v0.3.3

func (host *Host) NormalizeDest(dest string) (string, error)

func (*Host) Socket added in v0.3.7

func (host *Host) Socket(ctx context.Context, sockPath string) (*Socket, error)

type HostAlias added in v0.3.13

type HostAlias struct {
	Alias  string `json:"alias"`
	Target string `json:"target"`
}

type HostVariable

type HostVariable struct {
	Name string `json:"name"`
}

type ImageLayerCompression added in v0.5.3

type ImageLayerCompression string
const (
	CompressionGzip         ImageLayerCompression = "Gzip"
	CompressionZstd         ImageLayerCompression = "Zstd"
	CompressionEStarGZ      ImageLayerCompression = "EStarGZ"
	CompressionUncompressed ImageLayerCompression = "Uncompressed"
)

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 Ownership added in v0.5.1

type Ownership struct {
	UID int `json:"uid"`
	GID int `json:"gid"`
}

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 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 Project added in v0.5.3

type Project struct {
	// The project's root directory
	Directory *Directory `json:"directory"`
	// Path to the project's config file relative to the root directory
	ConfigPath string `json:"configPath"`
	// The parsed project config
	Config ProjectConfig `json:"config"`
	// The graphql schema for the project
	Schema string `json:"schema"`
	// The project's platform
	Platform specs.Platform `json:"platform,omitempty"`
}

func NewProject added in v0.5.3

func NewProject(id ProjectID, platform specs.Platform) (*Project, error)

func (*Project) Clone added in v0.5.3

func (p *Project) Clone() *Project

func (*Project) Commands added in v0.5.3

func (p *Project) Commands(ctx context.Context) ([]ProjectCommand, error)

func (*Project) ID added in v0.5.3

func (p *Project) ID() (ProjectID, error)

func (*Project) Load added in v0.5.3

func (p *Project) Load(ctx context.Context, gw bkgw.Client, r *router.Router, progSock *Socket, source *Directory, configPath string) (*Project, error)

type ProjectCommand added in v0.5.3

type ProjectCommand struct {
	Name        string
	Flags       []ProjectCommandFlag
	Description string
	Subcommands []ProjectCommand
}

func NewProjectCommand added in v0.5.3

func NewProjectCommand(id ProjectCommandID) (*ProjectCommand, error)

func (*ProjectCommand) ID added in v0.5.3

type ProjectCommandFlag added in v0.5.3

type ProjectCommandFlag struct {
	Name        string
	Description string
}

type ProjectCommandID added in v0.5.3

type ProjectCommandID string

func (ProjectCommandID) String added in v0.5.3

func (id ProjectCommandID) String() string

func (ProjectCommandID) ToProjectCommand added in v0.5.3

func (id ProjectCommandID) ToProjectCommand() (*ProjectCommand, error)

type ProjectConfig added in v0.5.3

type ProjectConfig struct {
	Name string `json:"name"`
	SDK  string `json:"sdk,omitempty"`
}

type ProjectID added in v0.5.3

type ProjectID string

func (ProjectID) String added in v0.5.3

func (id ProjectID) String() string

func (ProjectID) ToProject added in v0.5.3

func (id ProjectID) ToProject() (*Project, error)

type Query added in v0.3.10

type Query struct {
	Context QueryContext
}

func (*Query) PipelinePath added in v0.4.0

func (query *Query) PipelinePath() pipeline.Path

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 QueryContext struct {
	// Pipeline
	Pipeline pipeline.Path `json:"pipeline"`
}

type Secret

type Secret struct {
	// Name specifies the arbitrary name/id of the secret.
	Name string `json:"name,omitempty"`

	// FromFile specifies the FileID it is based off.
	//
	// Deprecated: this shouldn't be used as it can leak secrets in the cache.
	// Use the setSecret API instead.
	FromFile FileID `json:"file,omitempty"`

	// FromHostEnv specifies the FileID it is based off.
	//
	// Deprecated: use the setSecret API instead.
	FromHostEnv string `json:"host_env,omitempty"`
}

Secret is a content-addressed secret.

func NewDynamicSecret added in v0.5.1

func NewDynamicSecret(name string) *Secret

func NewSecretFromFile

func NewSecretFromFile(fileID FileID) *Secret

func NewSecretFromHostEnv

func NewSecretFromHostEnv(name string) *Secret

func (*Secret) Clone added in v0.5.1

func (secret *Secret) Clone() *Secret

func (*Secret) ID

func (secret *Secret) ID() (SecretID, error)

func (*Secret) IsOldFormat added in v0.5.1

func (secret *Secret) IsOldFormat() bool

func (*Secret) LegacyPlaintext added in v0.5.1

func (secret *Secret) LegacyPlaintext(ctx context.Context, gw bkgw.Client) ([]byte, error)

type SecretID

type SecretID string

SecretID is an opaque value representing a content-addressed secret.

func (SecretID) String added in v0.3.7

func (id SecretID) String() string

func (SecretID) ToSecret added in v0.5.1

func (id SecretID) ToSecret() (*Secret, error)

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 *Container
	Detach    func()
}

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 {
	HostPath string `json:"host_path,omitempty"`
}

func NewHostSocket added in v0.3.7

func NewHostSocket(absPath string) *Socket

func (*Socket) ID added in v0.3.7

func (socket *Socket) ID() (SocketID, error)

func (*Socket) IsHost added in v0.3.8

func (socket *Socket) IsHost() bool

func (*Socket) Server added in v0.3.7

func (socket *Socket) Server() (sshforward.SSHServer, error)

type SocketID added in v0.3.7

type SocketID string

func (SocketID) LLBID added in v0.3.7

func (id SocketID) LLBID() string

func (SocketID) String added in v0.3.7

func (id SocketID) String() string

func (SocketID) ToSocket added in v0.5.1

func (id SocketID) ToSocket() (*Socket, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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