{"modulePath":"github.com/Coding/drone","version":"v0.4.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package runner\n\n## Variables\n\n```go\nvar (\n\t// ErrSkip is used as a return value when container execution should be\n\t// skipped at runtime. It is not returned as an error by any function.\n\tErrSkip = errors.New(\"Skip\")\n\n\t// ErrTerm is used as a return value when the runner should terminate\n\t// execution and exit. It is not returned as an error by any function.\n\tErrTerm = errors.New(\"Terminate\")\n)\n```\n\n```go\nvar NoContext = context.TODO()\n```\nNoContext is the default context you should supply if not using your own context.Context\n\n## Types\n\n```go\ntype Auth struct {\n\tUsername string `json:\"username,omitempty\"`\n\tPassword string `json:\"password,omitempty\"`\n\tEmail    string `json:\"email,omitempty\"`\n\tToken    string `json:\"registry_token,omitempty\"`\n}\n```\nAuth provides authentication parameters to authenticate to a remote container registry for image download.\n\n```go\ntype Config struct {\n\tTracer Tracer\n\tEngine Engine\n\n\t// Buffer defines the size of the buffer for the channel to which the\n\t// console output is streamed.\n\tBuffer uint\n}\n```\nConfig defines the configuration for creating the Runner.\n\n```go\nfunc (c *Config) Runner(ctx context.Context, spec *Spec) *Runner\n```\nRunner creates a build Runner using the specific configuration for the given Context and Specification.\n\n```go\ntype Container struct {\n\tName           string            `json:\"name\"`\n\tAlias          string            `json:\"alias\"`\n\tImage          string            `json:\"image\"`\n\tPull           bool              `json:\"pull,omitempty\"`\n\tAuthConfig     Auth              `json:\"auth_config,omitempty\"`\n\tPrivileged     bool              `json:\"privileged,omitempty\"`\n\tWorkingDir     string            `json:\"working_dir,omitempty\"`\n\tEnvironment    map[string]string `json:\"environment,omitempty\"`\n\tEntrypoint     []string          `json:\"entrypoint,omitempty\"`\n\tCommand        []string          `json:\"command,omitempty\"`\n\tExtraHosts     []string          `json:\"extra_hosts,omitempty\"`\n\tVolumes        []string          `json:\"volumes,omitempty\"`\n\tVolumesFrom    []string          `json:\"volumes_from,omitempty\"`\n\tDevices        []string          `json:\"devices,omitempty\"`\n\tNetwork        string            `json:\"network_mode,omitempty\"`\n\tDNS            []string          `json:\"dns,omitempty\"`\n\tDNSSearch      []string          `json:\"dns_search,omitempty\"`\n\tMemSwapLimit   int64             `json:\"memswap_limit,omitempty\"`\n\tMemLimit       int64             `json:\"mem_limit,omitempty\"`\n\tCPUQuota       int64             `json:\"cpu_quota,omitempty\"`\n\tCPUShares      int64             `json:\"cpu_shares,omitempty\"`\n\tCPUSet         string            `json:\"cpuset,omitempty\"`\n\tOomKillDisable bool              `json:\"oom_kill_disable,omitempty\"`\n}\n```\nContainer defines the container configuration.\n\n```go\nfunc (c *Container) Validate() error\n```\nValidate validates the container configuration details and returns an error if the validation fails.\n\n```go\ntype Engine interface {\n\t// VolumeCreate(*Volume) (string, error)\n\t// VolumeRemove(string) error\n\tContainerStart(*Container) (string, error)\n\tContainerStop(string) error\n\tContainerRemove(string) error\n\tContainerWait(string) (*State, error)\n\tContainerLogs(string) (io.ReadCloser, error)\n}\n```\nEngine defines the container runtime engine.\n\n```go\ntype ExitError struct {\n\tName string\n\tCode int\n}\n```\nAn ExitError reports an unsuccessful exit.\n\n```go\nfunc (e *ExitError) Error() string\n```\nError reteurns the error message in string format.\n\n```go\ntype Line struct {\n\tProc string `json:\"proc,omitempty\"`\n\tTime int64  `json:\"time,omitempty\"`\n\tType int    `json:\"type,omitempty\"`\n\tPos  int    `json:\"pos,omityempty\"`\n\tOut  string `json:\"out,omitempty\"`\n}\n```\nLine is a line of console output.\n\n```go\nfunc (l *Line) String() string\n```\n\n```go\ntype Network struct {\n\tName       string            `json:\"name,omitempty\"`\n\tAlias      string            `json:\"alias,omitempty\"`\n\tDriver     string            `json:\"driver,omitempty\"`\n\tDriverOpts map[string]string `json:\"driver_opts,omitempty\"`\n\tExternal   bool              `json:\"external,omitempty\"`\n}\n```\nNetwork defines a container network.\n\n```go\ntype OomError struct {\n\tName string\n}\n```\nAn OomError reports the process received an OOMKill from the kernel.\n\n```go\nfunc (e *OomError) Error() string\n```\nError reteurns the error message in string format.\n\n```go\ntype Pipe struct {\n\t// contains filtered or unexported fields\n}\n```\nPipe returns a buffered pipe that is connected to the console output.\n\n```go\nfunc (p *Pipe) Close()\n```\nClose closes the pipe of console output.\n\n```go\nfunc (p *Pipe) Next() *Line\n```\nNext returns the next Line of console output.\n\n```go\ntype Runner struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (r *Runner) Pipe() *Pipe\n```\nPipe returns a Pipe that is connected to the console output stream.\n\n```go\nfunc (r *Runner) Run()\n```\nRun starts the build runner but does not wait for it to complete. The Wait method will return the exit code and release associated resources once the running containers exit.\n\n```go\nfunc (r *Runner) Wait() error\n```\nWait waits for the runner to exit.\n\n```go\ntype Spec struct {\n\t// Volumes defines a list of all container volumes.\n\tVolumes []*Volume `json:\"volumes,omitempty\"`\n\n\t// Networks defines a list of all container networks.\n\tNetworks []*Network `json:\"networks,omitempty\"`\n\n\t// Containers defines a list of all containers in the pipeline.\n\tContainers []*Container `json:\"containers,omitempty\"`\n\n\t// Nodes defines the container execution tree.\n\tNodes *parse.Tree `json:\"program,omitempty\"`\n}\n```\nSpec defines the pipeline configuration and exeuction.\n\n```go\nfunc Parse(data []byte) (*Spec, error)\n```\nParse parses a raw file containing a JSON encoded format of an intermediate representation of the pipeline.\n\n```go\nfunc ParseFile(filename string) (*Spec, error)\n```\nParseFile parses a file containing a JSON encoded format of an intermediate representation of the pipeline.\n\n```go\ntype State struct {\n\tExitCode  int  // container exit code\n\tOOMKilled bool // container exited due to oom error\n}\n```\nState defines the state of the container.\n\n```go\ntype Tracer func(c *Container) error\n```\nTracer defines a tracing function that is invoked prior to creating and running the container.\n\n```go\ntype Volume struct {\n\tName       string            `json:\"name,omitempty\"`\n\tAlias      string            `json:\"alias,omitempty\"`\n\tDriver     string            `json:\"driver,omitempty\"`\n\tDriverOpts map[string]string `json:\"driver_opts,omitempty\"`\n\tExternal   bool              `json:\"external,omitempty\"`\n}\n```\nVolume defines a container volume.\n\n","path":"github.com/Coding/drone/engine/runner","name":"runner","synopsis":"","isRedistributable":true}
