container

package
v12.11.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseEnvFile added in v12.11.0

func ParseEnvFile(e Container, srcPath string, env *map[string]string) common.Executor

ParseEnvFile reads an env-file from the container at srcPath and parses it into env. Used by back-ends to support the GITHUB_ENV / GITHUB_OUTPUT / GITHUB_STATE flow.

Types

type Container

type Container interface {
	Create(capAdd, capDrop []string) common.Executor
	Copy(destPath string, files ...*FileEntry) common.Executor
	CopyTarStream(ctx context.Context, destPath string, tarStream io.Reader) error
	CopyDir(destPath, srcPath string, useGitIgnore bool) common.Executor
	GetContainerArchive(ctx context.Context, srcPath string) (io.ReadCloser, error)
	Pull(forcePull bool) common.Executor
	Start(attach bool) common.Executor
	Exec(command []string, env map[string]string, user, workdir string) common.Executor
	UpdateFromEnv(srcPath string, env *map[string]string) common.Executor
	UpdateFromImageEnv(env *map[string]string) common.Executor
	Remove() common.Executor
	Close() common.Executor
	ReplaceLogWriter(io.Writer, io.Writer) (io.Writer, io.Writer)
	IsHealthy(ctx context.Context) (time.Duration, error)
}

Container for managing docker run containers

type ExecutionsEnvironment

type ExecutionsEnvironment interface {
	Container
	ToContainerPath(string) string
	GetName() string
	GetRoot() string
	// BackendID returns a stable, unique identifier for the back-end.
	// Format: lowercase ASCII, alphanumeric plus dashes/underscores (slug form).
	// Used in error messages, log fields, and (for plugins) matching against
	// runs-on labels. Must be unique across registered back-ends. Renames are
	// breaking.
	BackendID() string
	// SupportsDockerContainerActions reports whether the back-end can run a
	// step that requires a Docker container action: `uses: docker://image` or
	// an action whose `runs.using: docker`. It does not gate job-level
	// `container:`, `services:`, or JS/composite actions.
	SupportsDockerContainerActions() bool
	// ManagesOwnNetworking reports whether the back-end provides its own
	// networking, in which case the runner skips creating the shared Docker
	// network used for services and aliases.
	ManagesOwnNetworking() bool
	GetActPath() string
	GetPathVariableName() string
	DefaultPathVariable() string
	JoinPathVariable(...string) string
	GetRunnerContext(ctx context.Context) map[string]any
	// On windows PATH and Path are the same key
	IsEnvironmentCaseInsensitive() bool
}

type FileEntry

type FileEntry struct {
	Name string
	Mode int64
	Body string
}

FileEntry is a file to copy to a container

type HostEnvironment

type HostEnvironment struct {
	Name      string
	Path      string
	TmpDir    string
	ToolCache string
	Workdir   string
	ActPath   string
	Root      string
	StdOut    io.Writer
	LXC       bool
}

func (*HostEnvironment) BackendID added in v12.10.2

func (e *HostEnvironment) BackendID() string

func (*HostEnvironment) Close

func (e *HostEnvironment) Close() common.Executor

func (*HostEnvironment) Copy

func (e *HostEnvironment) Copy(destPath string, files ...*FileEntry) common.Executor

func (*HostEnvironment) CopyDir

func (e *HostEnvironment) CopyDir(destPath, srcPath string, useGitIgnore bool) common.Executor

func (*HostEnvironment) CopyTarStream

func (e *HostEnvironment) CopyTarStream(ctx context.Context, destPath string, tarStream io.Reader) error

func (*HostEnvironment) Create

func (e *HostEnvironment) Create(_, _ []string) common.Executor

func (*HostEnvironment) DefaultPathVariable

func (e *HostEnvironment) DefaultPathVariable() string

func (*HostEnvironment) Exec

func (e *HostEnvironment) Exec(command []string, env map[string]string, user, workdir string) common.Executor

func (*HostEnvironment) ExecWithCmdLine

func (e *HostEnvironment) ExecWithCmdLine(command []string, cmdline string, env map[string]string, user, workdir string) common.Executor

func (*HostEnvironment) GetActPath

func (e *HostEnvironment) GetActPath() string

func (*HostEnvironment) GetContainerArchive

func (e *HostEnvironment) GetContainerArchive(ctx context.Context, srcPath string) (io.ReadCloser, error)

func (*HostEnvironment) GetName

func (e *HostEnvironment) GetName() string

func (*HostEnvironment) GetPathVariableName

func (*HostEnvironment) GetPathVariableName() string

func (*HostEnvironment) GetRoot

func (e *HostEnvironment) GetRoot() string

func (*HostEnvironment) GetRunnerContext

func (e *HostEnvironment) GetRunnerContext(_ context.Context) map[string]any

func (*HostEnvironment) IsEnvironmentCaseInsensitive

func (*HostEnvironment) IsEnvironmentCaseInsensitive() bool

func (*HostEnvironment) IsHealthy

func (e *HostEnvironment) IsHealthy(ctx context.Context) (time.Duration, error)

func (*HostEnvironment) JoinPathVariable

func (*HostEnvironment) JoinPathVariable(paths ...string) string

func (*HostEnvironment) ManagesOwnNetworking added in v12.10.2

func (*HostEnvironment) ManagesOwnNetworking() bool

func (*HostEnvironment) Pull

func (e *HostEnvironment) Pull(_ bool) common.Executor

func (*HostEnvironment) Remove

func (e *HostEnvironment) Remove() common.Executor

func (*HostEnvironment) ReplaceLogWriter

func (e *HostEnvironment) ReplaceLogWriter(stdout, _ io.Writer) (io.Writer, io.Writer)

func (*HostEnvironment) Start

func (e *HostEnvironment) Start(_ bool) common.Executor

func (*HostEnvironment) SupportsDockerContainerActions added in v12.10.2

func (*HostEnvironment) SupportsDockerContainerActions() bool

func (*HostEnvironment) ToContainerPath

func (e *HostEnvironment) ToContainerPath(path string) string

func (*HostEnvironment) UpdateFromEnv

func (e *HostEnvironment) UpdateFromEnv(srcPath string, env *map[string]string) common.Executor

func (*HostEnvironment) UpdateFromImageEnv

func (e *HostEnvironment) UpdateFromImageEnv(_ *map[string]string) common.Executor

type NewContainerInput

type NewContainerInput struct {
	Image           string
	Username        string
	Password        string
	Entrypoint      []string
	Cmd             []string
	Init            bool
	TTY             bool
	WorkingDir      string
	Env             []string
	ToolCache       string
	Binds           []string
	Mounts          map[string]string
	Name            string
	Stdout          io.Writer
	Stderr          io.Writer
	NetworkMode     string
	Privileged      bool
	UsernsMode      string
	DefaultPlatform string // platform if not overridden in JobOptions
	NetworkAliases  []string
	ExposedPorts    map[PortSpec]struct{}
	PortBindings    map[PortSpec][]PortBinding

	ConfigOptions string
	JobOptions    string

	ValidVolumes []string
}

NewContainerInput the input for the New function

type PortBinding added in v12.10.2

type PortBinding struct {
	HostIP   string
	HostPort string
}

PortBinding represents a binding between a container port and a host address.

type PortSpec added in v12.10.2

type PortSpec string

PortSpec is a container-side port and protocol, e.g. "8080/tcp".

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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