docker

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const REGISTRY_PASSWORD_ENV_KEY = "REGISTRY_PASSWORD"
View Source
const REGISTRY_USERNAME_ENV_KEY = "REGISTRY_USERNAME"

Environment variables for private registry auth

Variables

View Source
var DefaultCypress = Image{
	Name:    "saucelabs/stt-cypress-mocha-node",
	Version: "v0.1.3",
}
View Source
var DefaultPlaywright = Image{
	Name:    "saucelabs/stt-playwright-jest-node",
	Version: "v0.1.3",
}
View Source
var DefaultPuppeteer = Image{
	Name:    "saucelabs/stt-puppeteer-jest-node",
	Version: "v0.1.2",
}
View Source
var DefaultTestcafe = Image{
	Name:    "saucelabs/stt-testcafe-node",
	Version: "v0.1.2",
}

Functions

This section is empty.

Types

type CommonAPIClient added in v0.10.0

type CommonAPIClient interface {
	ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
	ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
	ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)
	ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
	ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
	CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error
	ContainerStatPath(ctx context.Context, containerID, path string) (types.ContainerPathStat, error)
	CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
	ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
	ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
	ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
	ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error
	ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
}

ClientInterface describes the interface used to handle docker commands

type Handler

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

Handler represents the client to handle Docker tasks

func Create

func Create() (*Handler, error)

Create generates a docker client

func CreateMock added in v0.2.0

func CreateMock(client CommonAPIClient) *Handler

CreateMock allows to get a handler with a custom interface

func (*Handler) ContainerRemove

func (handler *Handler) ContainerRemove(ctx context.Context, srcContainerID string) error

ContainerRemove removes testrunner container

func (*Handler) ContainerStop

func (handler *Handler) ContainerStop(ctx context.Context, srcContainerID string) error

ContainerStop stops a running container

func (*Handler) CopyFromContainer

func (handler *Handler) CopyFromContainer(ctx context.Context, srcContainerID string, srcPath string, dstPath string) error

CopyFromContainer downloads a file from the testrunner container

func (*Handler) CopyTestFilesToContainer

func (handler *Handler) CopyTestFilesToContainer(ctx context.Context, srcContainerID string, files []string, targetDir string) error

CopyTestFilesToContainer copies files from the config into the container

func (*Handler) CopyToContainer added in v0.9.4

func (handler *Handler) CopyToContainer(ctx context.Context, containerID string, srcFile string, targetDir string) error

CopyToContainer copies the given file to the container.

func (*Handler) Execute added in v0.3.7

func (handler *Handler) Execute(ctx context.Context, srcContainerID string, cmd []string) (*types.IDResponse, *types.HijackedResponse, error)

Execute runs the test in the Docker container and attaches to its stdout

func (*Handler) ExecuteInspect

func (handler *Handler) ExecuteInspect(ctx context.Context, srcContainerID string) (int, error)

ExecuteInspect checks exit code of test

func (*Handler) FindTestFiles added in v0.9.4

func (handler *Handler) FindTestFiles(patterns []string) []string

FindTestFiles returns the names of all files matching the patterns.

func (*Handler) GetImageFlavor added in v0.4.2

func (handler *Handler) GetImageFlavor(c config.JobConfiguration) string

TODO - move this to ImageDefinition

func (*Handler) GetImagePullOptions added in v0.10.0

func (handler *Handler) GetImagePullOptions() (types.ImagePullOptions, error)

Prepare ImagePullOptions

func (*Handler) HasBaseImage

func (handler *Handler) HasBaseImage(ctx context.Context, baseImage string) (bool, error)

HasBaseImage checks if base image is installed

func (*Handler) PullBaseImage

func (handler *Handler) PullBaseImage(ctx context.Context, c config.JobConfiguration) error

PullBaseImage pulls an image from Docker

func (*Handler) StartContainer

StartContainer starts the Docker testrunner container

func (*Handler) ValidateDependency

func (handler *Handler) ValidateDependency() error

ValidateDependency checks if external dependencies are installed

type Image added in v0.7.1

type Image struct {
	Name    string
	Version string
}

Image represents docker image metadata.

Jump to

Keyboard shortcuts

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