Documentation ¶
Index ¶
- Constants
- func FilterLocalFiles(localPath string, includePatterns, excludePatterns []string) (localPaths []string, err error)
- func FirstUpInterface() (string, error)
- func LocalID(ctx context.Context, absPath string, opts ...llb.LocalOption) (string, error)
- func LocalUniqueID(cwd string) (string, error)
- func NewSession(ctx context.Context, opts ...SessionOption) (*session.Session, error)
- func OutputFromWriter(w io.WriteCloser) func(map[string]string) (io.WriteCloser, error)
- func PositionFromLexer(pos lexer.Position) pb.Position
- func SSHID(paths ...string) string
- func SecretID(path string) string
- func ShimReadonlyMountpoints(opts []llb.RunOption) error
- func WithDir(dir string) llb.RunOption
- func WithEnv(name, value string) llb.RunOption
- func WithExtraHost(host string, ip net.IP) llb.RunOption
- func WithNetwork(netMode pb.NetMode) llb.RunOption
- func WithReadonlyRootFS() llb.RunOption
- func WithSSHSocket(target string, opts ...llb.SSHOption) llb.RunOption
- func WithSecret(dest string, opts ...llb.SecretOption) llb.RunOption
- func WithSecurity(securityMode pb.SecurityMode) llb.RunOption
- func WithUser(user string) llb.RunOption
- type AllowEmptyWildcard
- type AllowWildcard
- type AttemptUnpack
- type CacheMountOption
- type Chmod
- type Chown
- type CopyDirContentsOnly
- type CreateDestPath
- type CreatedTime
- type DirOption
- type EnvOption
- type ExcludePatterns
- type FileInfo
- type FollowSymlinks
- type GID
- type GatewayOption
- type HostOption
- type IDOption
- type IncludePatterns
- type MountRunOption
- type NetworkOption
- type ReadonlyMountOption
- type ReadonlyRootFSOption
- type SSHOption
- type SecretOption
- type SecurityOption
- type SessionInfo
- type SessionOption
- func WithAgentConfig(id string, cfg sockproxy.AgentConfig) SessionOption
- func WithSecretSource(id string, source secretsprovider.Source) SessionOption
- func WithSyncTarget(f func(map[string]string) (io.WriteCloser, error)) SessionOption
- func WithSyncTargetDir(dir string) SessionOption
- func WithSyncedDir(id string, dir filesync.SyncedDir) SessionOption
- type SourcePathMountOption
- type Target
- type TmpfsMountOption
- type UID
- type UserOption
Constants ¶
const ( KeyContainerImageDigest = "containerimage.digest" KeyContainerImageConfig = "containerimage.config" )
Variables ¶
This section is empty.
Functions ¶
func FilterLocalFiles ¶
func FirstUpInterface ¶
FirstUpInterface returns the mac address for the first "UP" network interface.
func LocalID ¶
LocalID returns a consistent hash for this local (path + options) so that the same content doesn't get transported multiple times when referenced repeatedly.
func LocalUniqueID ¶
LocalUniqueID returns a consistent string that is unique per host + cwd
func NewSession ¶
func OutputFromWriter ¶
func OutputFromWriter(w io.WriteCloser) func(map[string]string) (io.WriteCloser, error)
func ShimReadonlyMountpoints ¶
ShimReadonlyMountpoints will modify the source for readonly mounts so subsequent mounts that mount onto the readonly-mounts will have the mountpoint present.
For example if we have this code:
```hlb
run "make" with option { dir "/src" mount fs { local "." } "/src" with readonly mount scratch "/src/output" as buildOutput # ^^^^^ FAIL cannot create `output` directory for mount on readonly fs secret "./secret/foo.pem" "/src/secret/foo.pem" # ^^^^^ FAIL cannot create `./secret/foo.pm` for secret on readonly fs } }
```
When containerd tries to mount /src/output on top of the /src mountpoint it will fail because /src is mounted as readonly. The work around for this is to inline create the mountpoints so that they pre-exist and containerd will not have to create them.
It can be done with HLB like:
```hlb
run "make" with option { dir "/src" mount fs { local "." mkdir "output" 0o755 # <-- this is added to ensure mountpoint exists mkdir "secret" 0o755 # <-- added so the secret can be mounted mkfile "secret/foo.pm" 0o644 "" # <-- added so the secret can be mounted } "/src" with readonly mount scratch "/src/output" as buildOutput } }
```
So this function is effectively automatically adding the `mkdir` and `mkfile` instructions when it detects that a mountpoint is required to be on a readonly fs.
func WithReadonlyRootFS ¶
func WithSecret ¶
func WithSecret(dest string, opts ...llb.SecretOption) llb.RunOption
func WithSecurity ¶
func WithSecurity(securityMode pb.SecurityMode) llb.RunOption
Types ¶
type AllowEmptyWildcard ¶
type AllowEmptyWildcard bool
func WithAllowEmptyWildcard ¶
func WithAllowEmptyWildcard(ok bool) AllowEmptyWildcard
func (AllowEmptyWildcard) SetCopyOption ¶
func (ct AllowEmptyWildcard) SetCopyOption(ci *llb.CopyInfo)
type AllowWildcard ¶
type AllowWildcard bool
func WithAllowWildcard ¶
func WithAllowWildcard(ok bool) AllowWildcard
func (AllowWildcard) SetCopyOption ¶
func (ct AllowWildcard) SetCopyOption(ci *llb.CopyInfo)
type AttemptUnpack ¶
type AttemptUnpack bool
func WithAttemptUnpack ¶
func WithAttemptUnpack(ok bool) AttemptUnpack
func (AttemptUnpack) SetCopyOption ¶
func (ct AttemptUnpack) SetCopyOption(ci *llb.CopyInfo)
type CacheMountOption ¶
type CacheMountOption struct { ID string Sharing llb.CacheMountSharingMode }
func WithPersistentCacheDir ¶
func WithPersistentCacheDir(id string, sharing llb.CacheMountSharingMode) CacheMountOption
type Chmod ¶
func (Chmod) SetCopyOption ¶
func (Chmod) SetSSHOption ¶
func (Chmod) SetSecretOption ¶
func (c Chmod) SetSecretOption(si *llb.SecretInfo)
type CopyDirContentsOnly ¶
type CopyDirContentsOnly bool
func WithCopyDirContentsOnly ¶
func WithCopyDirContentsOnly(ok bool) CopyDirContentsOnly
func (CopyDirContentsOnly) SetCopyOption ¶
func (ct CopyDirContentsOnly) SetCopyOption(ci *llb.CopyInfo)
type CreateDestPath ¶
type CreateDestPath bool
func WithCreateDestPath ¶
func WithCreateDestPath(ok bool) CreateDestPath
func (CreateDestPath) SetCopyOption ¶
func (ct CreateDestPath) SetCopyOption(ci *llb.CopyInfo)
type CreatedTime ¶
func WithCreatedTime ¶
func WithCreatedTime(t time.Time) CreatedTime
func (CreatedTime) SetCopyOption ¶
func (ct CreatedTime) SetCopyOption(ci *llb.CopyInfo)
type EnvOption ¶
func (EnvOption) SetRunOption ¶
type ExcludePatterns ¶
type ExcludePatterns []string
func WithExcludePatterns ¶
func WithExcludePatterns(excludePatterns []string) ExcludePatterns
func (ExcludePatterns) SetCopyOption ¶
func (ep ExcludePatterns) SetCopyOption(ci *llb.CopyInfo)
func (ExcludePatterns) SetLocalOption ¶
func (ep ExcludePatterns) SetLocalOption(li *llb.LocalInfo)
type FollowSymlinks ¶
type FollowSymlinks bool
func WithFollowSymlinks ¶
func WithFollowSymlinks(ok bool) FollowSymlinks
func (FollowSymlinks) SetCopyOption ¶
func (ct FollowSymlinks) SetCopyOption(ci *llb.CopyInfo)
type GID ¶
type GID int
func (GID) SetSSHOption ¶
func (GID) SetSecretOption ¶
func (gid GID) SetSecretOption(si *llb.SecretInfo)
type GatewayOption ¶
type GatewayOption func(r *gateway.SolveRequest)
func FrontendInput ¶
func FrontendInput(key string, def *llb.Definition) GatewayOption
func FrontendOpt ¶
func FrontendOpt(key, value string) GatewayOption
type HostOption ¶
func (HostOption) SetRunOption ¶
func (host HostOption) SetRunOption(ei *llb.ExecInfo)
type IDOption ¶
type IDOption string
func (IDOption) SetSSHOption ¶
func (IDOption) SetSecretOption ¶
func (id IDOption) SetSecretOption(si *llb.SecretInfo)
type IncludePatterns ¶
type IncludePatterns []string
func WithIncludePatterns ¶
func WithIncludePatterns(includePatterns []string) IncludePatterns
func (IncludePatterns) SetCopyOption ¶
func (ip IncludePatterns) SetCopyOption(ci *llb.CopyInfo)
func (IncludePatterns) SetLocalOption ¶
func (ip IncludePatterns) SetLocalOption(li *llb.LocalInfo)
type MountRunOption ¶
MountRunOption gives access to capture custom MountOptions so we can easily capture if the mount is to be readonly
func (*MountRunOption) IsReadonly ¶
func (m *MountRunOption) IsReadonly() bool
func (*MountRunOption) SetRunOption ¶
func (m *MountRunOption) SetRunOption(es *llb.ExecInfo)
type NetworkOption ¶
func (NetworkOption) SetRunOption ¶
func (network NetworkOption) SetRunOption(ei *llb.ExecInfo)
type ReadonlyMountOption ¶
type ReadonlyMountOption struct{}
func WithReadonlyMount ¶
func WithReadonlyMount() ReadonlyMountOption
type ReadonlyRootFSOption ¶
type ReadonlyRootFSOption struct{}
func (ReadonlyRootFSOption) SetRunOption ¶
func (readonlyRootfs ReadonlyRootFSOption) SetRunOption(ei *llb.ExecInfo)
type SSHOption ¶
func (SSHOption) SetRunOption ¶
type SecretOption ¶
type SecretOption struct { Dest string Opts []llb.SecretOption }
func (SecretOption) SetRunOption ¶
func (secret SecretOption) SetRunOption(ei *llb.ExecInfo)
type SecurityOption ¶
type SecurityOption struct {
pb.SecurityMode
}
func (SecurityOption) SetRunOption ¶
func (security SecurityOption) SetRunOption(ei *llb.ExecInfo)
type SessionInfo ¶
type SessionInfo struct { SyncTargetDir *string SyncTarget func(map[string]string) (io.WriteCloser, error) SyncedDirByID map[string]filesync.SyncedDir FileSourceByID map[string]secretsprovider.Source AgentConfigByID map[string]sockproxy.AgentConfig }
type SessionOption ¶
type SessionOption func(*SessionInfo)
func WithAgentConfig ¶
func WithAgentConfig(id string, cfg sockproxy.AgentConfig) SessionOption
func WithSecretSource ¶
func WithSecretSource(id string, source secretsprovider.Source) SessionOption
func WithSyncTarget ¶
func WithSyncTarget(f func(map[string]string) (io.WriteCloser, error)) SessionOption
func WithSyncTargetDir ¶
func WithSyncTargetDir(dir string) SessionOption
func WithSyncedDir ¶
func WithSyncedDir(id string, dir filesync.SyncedDir) SessionOption
type SourcePathMountOption ¶
type SourcePathMountOption struct {
Path string
}
func WithSourcePath ¶
func WithSourcePath(path string) SourcePathMountOption
type TmpfsMountOption ¶
type TmpfsMountOption struct{}
func WithTmpfs ¶
func WithTmpfs() TmpfsMountOption
type UID ¶
type UID int
func (UID) SetSSHOption ¶
func (UID) SetSecretOption ¶
func (uid UID) SetSecretOption(si *llb.SecretInfo)
type UserOption ¶
type UserOption struct {
User string
}
func (UserOption) SetRunOption ¶
func (user UserOption) SetRunOption(ei *llb.ExecInfo)