docker

package
v0.9.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ScribeContainerPath = "/var/scribe"

Variables

View Source
var KnownVolumes = map[pipeline.Argument]func(*plumbing.PipelineArgs) (string, error){
	pipeline.ArgumentSourceFS: func(args *plumbing.PipelineArgs) (string, error) {
		return ".", nil
	},
	pipeline.ArgumentDockerSocketFS: func(*plumbing.PipelineArgs) (string, error) {
		return "/var/run/docker.sock", nil
	},
}

KnownVolumes is a map of default argument to a function used to retrieve the volume the value represents. For example, we know that every pipeline is ran alongisde source code. The user can supply a "-arg=source={path-to-source}" argument, or we can just

Functions

func CreateStepContainer

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

func DefaultMounts

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

func GetVolumeValue

func GetVolumeValue(args *plumbing.PipelineArgs, arg pipeline.Argument) (string, error)

GetVolumeValue will attempt to find the appropriate volume to mount based on the argument provided. Some arguments have known or knowable values, like "ArgumentSourceFS".

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) Value

func (c *Client) Value(arg pipeline.Argument) (string, error)

Value retrieves the configuration item the same way the CLI does; by looking in the argmap or by asking via stdin.

func (*Client) Walk

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

type CreateStepContainerOpts

type CreateStepContainerOpts struct {
	Configurer pipeline.Configurer
	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