docker

package
v0.9.10 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScribeContainerPath = "/var/scribe"
)

Variables

View Source
var KnownVolumes = map[pipeline.Argument]func(*pipeline.State) (docker.HostMount, error){
	pipeline.ArgumentSourceFS: func(state *pipeline.State) (docker.HostMount, error) {
		source := state.MustGetDirectoryString(pipeline.ArgumentSourceFS)
		sourceAbs, err := filepath.Abs(source)
		if err != nil {
			return docker.HostMount{}, err
		}

		return docker.HostMount{
			Type:   "bind",
			Source: sourceAbs,
			Target: ScribeContainerPath,
		}, nil
	},
	pipeline.ArgumentDockerSocketFS: func(state *pipeline.State) (docker.HostMount, error) {
		return docker.HostMount{
			Type:   "bind",
			Source: "/var/run/docker.sock",
			Target: "/var/run/docker.sock",
		}, nil
	},
}

KnownVolumes are pre-defined filesystem arguments that need to be mounted in the container in order to have value. Most filesystem arguments are packaged and placed into the state directory for other steps to use. These, however, exist on the host and must be explicitely mounted using a "bind" mount.

Functions

func CreateStepContainer

func CreateStepContainer(ctx context.Context, state *pipeline.State, client *docker.Client, opts CreateStepContainerOpts) (*docker.Container, error)

func DefaultMounts

func DefaultMounts(v *docker.Volume) ([]docker.HostMount, error)

func MountAt added in v0.9.5

func MountAt(v *docker.Volume, target string, mode int) docker.HostMount

func RunContainer added in v0.9.5

func RunContainer(ctx context.Context, client *docker.Client, opts RunOpts) error

Types

type Client

type Client struct {
	Client *docker.Client
	Opts   pipeline.CommonOpts

	Log *logrus.Logger
}

The Client is used when interacting with a scribe pipeline using the scribe CLI. In order to emulate what happens in a remote environment, the steps are put into a queue before being ran. Each step is ran in its own docker container.

func (*Client) Done

func (c *Client) Done(ctx context.Context, w pipeline.Walker) error

func (*Client) Validate

func (c *Client) Validate(step pipeline.Step) error

func (*Client) Walk

func (c *Client) Walk(ctx context.Context, opts walkOpts) error

type CreateStepContainerOpts

type CreateStepContainerOpts struct {
	Step     pipeline.Step
	Env      []string
	Network  *docker.Network
	Volumes  []*docker.Volume
	Mounts   []docker.HostMount
	Binary   string
	Pipeline string
	BuildID  string
	Out      io.Writer
}

type RunOpts added in v0.9.5

type RunOpts struct {
	Container  *docker.Container
	HostConfig *docker.HostConfig
	Stdout     io.Writer
	Stderr     io.Writer
}

Jump to

Keyboard shortcuts

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