spread

package
v0.0.0-...-ded9133 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: GPL-3.0 Imports: 33 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug bool

Debug defines whether to also deliver debug messages to the log. Implies Verbose if set.

View Source
var Logger *stdlog.Logger

Logger defines the logger where messages should be sent to.

View Source
var Verbose bool

Verbose defines whether to also deliver verbose messages to the log.

Functions

func ParseLabelTime

func ParseLabelTime(s string) (time.Time, error)

func SplitVariants

func SplitVariants(s string) (prefix string, variants []string)

func SystemLabel

func SystemLabel(system *System, note string) string

Types

type Backend

type Backend struct {
	Name string `yaml:"-"`
	Type string
	Key  string

	// Only for adhoc.
	Allocate string
	Discard  string

	// Only for qemu so far.
	Memory Size

	// Only for Linode and Google so far.
	Plan     string
	Location string
	Storage  Size

	Systems SystemsMap

	Prepare     string
	Restore     string
	Debug       string
	PrepareEach string `yaml:"prepare-each"`
	RestoreEach string `yaml:"restore-each"`
	DebugEach   string `yaml:"debug-each"`

	Environment *Environment
	Variants    []string

	WarnTimeout Timeout `yaml:"warn-timeout"`
	KillTimeout Timeout `yaml:"kill-timeout"`
	HaltTimeout Timeout `yaml:"halt-timeout"`

	Priority OptionalInt
	Manual   bool
}

func (*Backend) String

func (b *Backend) String() string

type Client

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

func Dial

func Dial(server Server, username, password string) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) CombinedOutput

func (c *Client) CombinedOutput(script string, dir string, env *Environment) (output []byte, err error)

func (*Client) MissingOrEmpty

func (c *Client) MissingOrEmpty(dir string) (bool, error)

func (*Client) Output

func (c *Client) Output(script string, dir string, env *Environment) (output []byte, err error)

func (*Client) ReadFile

func (c *Client) ReadFile(path string) ([]byte, error)

func (*Client) RecvTar

func (c *Client) RecvTar(packDir string, include []string, tar io.Writer) error

func (*Client) RemoveAll

func (c *Client) RemoveAll(path string) error

func (*Client) ResetJob

func (c *Client) ResetJob()

func (*Client) Run

func (c *Client) Run(script string, dir string, env *Environment) error

func (*Client) Send

func (c *Client) Send(from, to string, include, exclude []string) error

func (*Client) SendTar

func (c *Client) SendTar(tar io.Reader, unpackDir string) error

func (*Client) Server

func (c *Client) Server() Server

func (*Client) SetJob

func (c *Client) SetJob(job string)

func (*Client) SetKillTimeout

func (c *Client) SetKillTimeout(timeout time.Duration)

func (*Client) SetWarnTimeout

func (c *Client) SetWarnTimeout(timeout time.Duration)

func (*Client) SetupRootAccess

func (c *Client) SetupRootAccess(password string) error

func (*Client) Shell

func (c *Client) Shell(script string, dir string, env *Environment) error

func (*Client) Trace

func (c *Client) Trace(script string, dir string, env *Environment) (output []byte, err error)

func (*Client) WriteFile

func (c *Client) WriteFile(path string, data []byte) error

type Environment

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

func NewEnvironment

func NewEnvironment(pairs ...string) *Environment

func (*Environment) Copy

func (e *Environment) Copy() *Environment

func (*Environment) Get

func (e *Environment) Get(key string) string

func (*Environment) Keys

func (e *Environment) Keys() []string

func (*Environment) MarshalYAML

func (e *Environment) MarshalYAML() (interface{}, error)

func (*Environment) Replace

func (e *Environment) Replace(oldkey, newkey, value string)

func (*Environment) Set

func (e *Environment) Set(key, value string)

func (*Environment) UnmarshalYAML

func (e *Environment) UnmarshalYAML(u func(interface{}) error) error

func (*Environment) Unset

func (e *Environment) Unset(key string)

func (*Environment) Variant

func (e *Environment) Variant(variant string) *Environment

type FatalError

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

FatalError represents an error that cannot be fixed by just retrying.

type Filter

type Filter interface {
	Pass(job *Job) bool
}

func NewFilter

func NewFilter(args []string) (Filter, error)

type Job

type Job struct {
	Name    string
	Project *Project
	Backend *Backend
	System  *System
	Suite   *Suite
	Task    *Task

	Variant     string
	Environment *Environment
	Sample      int

	Priority int64
}

func (*Job) Debug

func (job *Job) Debug() string

func (*Job) KillTimeoutFor

func (job *Job) KillTimeoutFor(context interface{}) time.Duration

func (*Job) Prepare

func (job *Job) Prepare() string

func (*Job) Restore

func (job *Job) Restore() string

func (*Job) String

func (job *Job) String() string

func (*Job) StringFor

func (job *Job) StringFor(context interface{}) string

func (*Job) WarnTimeoutFor

func (job *Job) WarnTimeoutFor(context interface{}) time.Duration

type OptionalInt

type OptionalInt struct {
	IsSet bool
	Value int64
}

func (OptionalInt) String

func (s OptionalInt) String() string

func (*OptionalInt) UnmarshalYAML

func (s *OptionalInt) UnmarshalYAML(u func(interface{}) error) error

type Options

type Options struct {
	Password       string
	Filter         Filter
	Reuse          bool
	ReusePid       int
	Debug          bool
	Shell          bool
	ShellBefore    bool
	ShellAfter     bool
	Abend          bool
	Restore        bool
	Resend         bool
	Discard        bool
	Artifacts      string
	Seed           int64
	Repeat         int
	GarbageCollect bool
}

type Project

type Project struct {
	Name string `yaml:"project"`

	Backends map[string]*Backend

	Environment *Environment

	Repack      string
	Prepare     string
	Restore     string
	Debug       string
	PrepareEach string `yaml:"prepare-each"`
	RestoreEach string `yaml:"restore-each"`
	DebugEach   string `yaml:"debug-each"`

	Suites map[string]*Suite

	RemotePath string `yaml:"path"`

	Include []string
	Exclude []string
	Rename  []string

	Path string `yaml:"-"`

	WarnTimeout Timeout `yaml:"warn-timeout"`
	KillTimeout Timeout `yaml:"kill-timeout"`
}

func Load

func Load(path string) (*Project, error)

func (*Project) Jobs

func (p *Project) Jobs(options *Options) ([]*Job, error)

func (*Project) String

func (p *Project) String() string

type Provider

type Provider interface {
	Backend() *Backend
	Allocate(ctx context.Context, system *System) (Server, error)
	Reuse(ctx context.Context, rsystem *ReuseSystem, system *System) (Server, error)
	GarbageCollect() error
}

func AdHoc

func AdHoc(p *Project, b *Backend, o *Options) Provider

func Google

func Google(p *Project, b *Backend, o *Options) Provider

func Humbox

func Humbox(p *Project, b *Backend, o *Options) Provider

func LXD

func LXD(p *Project, b *Backend, o *Options) Provider

func Linode

func Linode(p *Project, b *Backend, o *Options) Provider

func QEMU

func QEMU(p *Project, b *Backend, o *Options) Provider

type Reuse

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

func OpenReuse

func OpenReuse(filename string) (r *Reuse, err error)

func (*Reuse) Add

func (r *Reuse) Add(server Server, password string) error

func (*Reuse) Close

func (r *Reuse) Close()

func (*Reuse) Remove

func (r *Reuse) Remove(server Server) error

func (*Reuse) ReuseSystems

func (r *Reuse) ReuseSystems(system *System) []*ReuseSystem

type ReuseBackend

type ReuseBackend struct {
	Systems []*ReuseSystem `yaml:",omitempty"`
}

type ReuseSystem

type ReuseSystem struct {
	Name     string `yaml:"-"`
	Username string `yaml:",omitempty"`
	Password string
	Address  string
	Data     interface{} `yaml:",omitempty"`
}

func (ReuseSystem) MarshalYAML

func (rsys ReuseSystem) MarshalYAML() (interface{}, error)

func (*ReuseSystem) UnmarshalData

func (rsys *ReuseSystem) UnmarshalData(v interface{}) error

func (*ReuseSystem) UnmarshalYAML

func (rsys *ReuseSystem) UnmarshalYAML(u func(interface{}) error) error

type Runner

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

func Start

func Start(project *Project, options *Options) (*Runner, error)

func (*Runner) Stop

func (r *Runner) Stop() error

func (*Runner) Wait

func (r *Runner) Wait() error

type Server

type Server interface {
	Provider() Provider
	Address() string
	Discard(ctx context.Context) error
	ReuseData() interface{}
	System() *System
	Label() string
	String() string
}

type Size

type Size int64

func (Size) String

func (s Size) String() string

func (*Size) UnmarshalYAML

func (s *Size) UnmarshalYAML(u func(interface{}) error) error

type Suite

type Suite struct {
	Summary  string
	Systems  []string
	Backends []string

	Variants    []string
	Environment *Environment

	Prepare     string
	Restore     string
	Debug       string
	PrepareEach string `yaml:"prepare-each"`
	RestoreEach string `yaml:"restore-each"`
	DebugEach   string `yaml:"debug-each"`

	Name  string           `yaml:"-"`
	Path  string           `yaml:"-"`
	Tasks map[string]*Task `yaml:"-"`

	WarnTimeout Timeout `yaml:"warn-timeout"`
	KillTimeout Timeout `yaml:"kill-timeout"`

	Priority OptionalInt
	Manual   bool
}

func (*Suite) String

func (s *Suite) String() string

type System

type System struct {
	Backend string `json:"-"`

	Name     string
	Image    string
	Kernel   string
	Username string
	Password string
	Workers  int

	// Only for Linode and Google so far.
	Storage Size

	// Only for Google so far.
	SecureBoot bool `yaml:"secure-boot"`

	// Supported are {"uefi",""}, only for qemu so far.
	Bios string
	// Request a specific CPU family, e.g. "Intel Skylake" The
	// exact string is backend specific.
	CPUFamily string `yaml:"cpu-family"`

	// Specify a backend specific plan, e.g. `e2-standard-2`
	Plan string

	Environment *Environment
	Variants    []string

	Priority OptionalInt
	Manual   bool
}

func (*System) String

func (system *System) String() string

func (*System) UnmarshalYAML

func (system *System) UnmarshalYAML(u func(interface{}) error) error

type SystemsMap

type SystemsMap map[string]*System

func (*SystemsMap) UnmarshalYAML

func (sysmap *SystemsMap) UnmarshalYAML(u func(interface{}) error) error

type Task

type Task struct {
	Suite string `yaml:"-"`

	Summary  string
	Details  string
	Systems  []string
	Backends []string

	Variants    []string
	Environment *Environment
	Samples     int

	Prepare string
	Restore string
	Execute string
	Debug   string

	Artifacts []string

	Name string `yaml:"-"`
	Path string `yaml:"-"`

	WarnTimeout Timeout `yaml:"warn-timeout"`
	KillTimeout Timeout `yaml:"kill-timeout"`

	Priority OptionalInt
	Manual   bool
}

func (*Task) String

func (t *Task) String() string

type Timeout

type Timeout struct {
	time.Duration
}

func (*Timeout) UnmarshalYAML

func (t *Timeout) UnmarshalYAML(u func(interface{}) error) error

type UnknownServer

type UnknownServer struct {
	Addr string
}

Jump to

Keyboard shortcuts

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