container

package
v11.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: GPL-3.0 Imports: 65 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewContainer = func(input *NewContainerInput) ExecutionsEnvironment {
	cr := new(containerReference)
	cr.input = input
	cr.toolCache = input.ToolCache
	return cr
}

NewContainer creates a reference to a container

Functions

func GetDockerClient

func GetDockerClient(ctx context.Context) (cli client.APIClient, err error)

func GetHostInfo

func GetHostInfo(ctx context.Context) (info system.Info, err error)

func ImageExistsLocally

func ImageExistsLocally(ctx context.Context, imageName, platform string) (bool, error)

ImageExistsLocally returns a boolean indicating if an image with the requested name, tag and architecture exists in the local docker image store

func LoadDockerAuthConfig

func LoadDockerAuthConfig(ctx context.Context, image string) (registry.AuthConfig, error)

func LoadDockerAuthConfigs

func LoadDockerAuthConfigs(ctx context.Context) map[string]registry.AuthConfig

func NewDockerBuildExecutor

func NewDockerBuildExecutor(input NewDockerBuildExecutorInput) common.Executor

NewDockerBuildExecutor function to create a run executor for the container

func NewDockerNetworkCreateExecutor

func NewDockerNetworkCreateExecutor(name string, config *network.CreateOptions) common.Executor

func NewDockerNetworkRemoveExecutor

func NewDockerNetworkRemoveExecutor(name string) common.Executor

func NewDockerPullExecutor

func NewDockerPullExecutor(input NewDockerPullExecutorInput) common.Executor

NewDockerPullExecutor function to create a run executor for the container

func NewDockerVolumesRemoveExecutor

func NewDockerVolumesRemoveExecutor(volumeNames []string) common.Executor

func RemoveImage

func RemoveImage(ctx context.Context, imageName string, force, pruneChildren bool) (bool, error)

RemoveImage removes image from local store, the function is used to run different container image architectures

func RunnerArch

func RunnerArch(ctx context.Context) string

Arch fetches values from docker info and translates architecture to GitHub actions compatible runner.arch values https://github.com/github/docs/blob/main/data/reusables/actions/runner-arch-description.md

Types

type Container

type Container interface {
	Create(capAdd, capDrop []string) common.Executor
	ConnectToNetwork(name 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
	GetLXC() 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