provider

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DockerProviderName = "docker"

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerRequest

type ContainerRequest struct {
	Image      string
	Entrypoint []string
	User       string // uid:gid
	Env        Env
	Cmd        []string
	Networks   []string
	Privileged bool
	Files      []File
}

type DockerProvider

type DockerProvider struct {
	// contains filtered or unexported fields
}

func NewDocker

func NewDocker(name string, req DockerRequest) (*DockerProvider, error)

func (*DockerProvider) Exec

func (p *DockerProvider) Exec(ctx context.Context, config ExecConfig) (io.Reader, error)

Exec implements Provider.

func (*DockerProvider) Start

func (p *DockerProvider) Start(ctx context.Context) error

Start implements Provider.

func (*DockerProvider) Teardown

func (p *DockerProvider) Teardown(ctx context.Context) error

Teardown implements Provider.

type DockerRequest

type DockerRequest struct {
	ContainerRequest
	Mounts []mount.Mount
}

type Env

type Env map[string]string

func (Env) ToSlice

func (e Env) ToSlice() []string

type ExecConfig added in v0.0.3

type ExecConfig struct {
	// The command to be executed in the provider
	Command string

	// The working directory to be used to execute the command
	WorkingDir string
}

type File

type File struct {
	Contents io.Reader
	Target   string
	Mode     int64
}

type Provider

type Provider interface {
	Start(ctx context.Context) error
	Teardown(ctx context.Context) error
	Exec(ctx context.Context, config ExecConfig) (io.Reader, error)
}

Jump to

Keyboard shortcuts

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