imagerunner

package
v0.186.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateUnknown    = "Unknown"
	StatePending    = "Pending"
	StateRunning    = "Running"
	StateUploading  = "Uploading"
	StateSucceeded  = "Succeeded"
	StateCancelled  = "Cancelled"
	StateFailed     = "Failed"
	StateTerminated = "Terminated"
)

The different states that a runner can be in.

View Source
const (
	RunnerAssetStateWaiting = "Waiting"
	RunnerAssetStateErrored = "Errored"
)

Variables

View Source
var (
	Kind       = "imagerunner"
	APIVersion = "v1alpha"

	ValidWorkloadType = []string{
		"webdriver",
		"other",
	}

	ValidResourceProfilesFormat    = "cXmX"
	ValidResourceProfilesValidator = regexp.MustCompile("^c([0-9]+)m([0-9]+)$")
)

DoneStates represents states that a runner doesn't transition out of, i.e. once the runner is in one of these states, it's done.

View Source
var ErrResourceNotFound = errors.New("resource not found")

Functions

func Done

func Done(status string) bool

Done returns true if the runner status is one of DoneStates. False otherwise.

func FilterSuites added in v0.137.0

func FilterSuites(p *Project, suiteName string) error

FilterSuites filters out suites in the project that don't match the given suite name.

func GetCanonicalServiceName added in v0.163.0

func GetCanonicalServiceName(serviceName string) string

func SetDefaults added in v0.135.0

func SetDefaults(p *Project)

SetDefaults applies config defaults in case the user has left them blank.

func Validate added in v0.135.0

func Validate(p Project) error

func ValidateServices added in v0.163.0

func ValidateServices(service []SuiteService, suiteName string) error

Types

type ArtifactList added in v0.133.0

type ArtifactList struct {
	ID    string   `json:"id"`
	Items []string `json:"items"`
}

type AsyncEvent added in v0.171.0

type AsyncEvent struct {
	Type         string
	LineSequence string
	Data         map[string]string
}

type AsyncEventFatalError added in v0.171.0

type AsyncEventFatalError struct {
	Err error
}

AsyncEventFatalError represents an error that occurs during the asynchronous event handling process. This error is considered fatal, meaning it cannot be recovered from.

func (AsyncEventFatalError) Error added in v0.171.0

func (e AsyncEventFatalError) Error() string

type AsyncEventManager added in v0.171.0

type AsyncEventManager interface {
	ParseEvent(event string) (*AsyncEvent, error)
	IsLogIdle() bool
}

type AsyncEventSetupError added in v0.171.0

type AsyncEventSetupError struct {
	Err error
}

AsyncEventSetupError represents an error that occurs during the setup of the asynchronous event handling process. This error indicates that the setup process failed and may need to be retried or debugged.

func (AsyncEventSetupError) Error added in v0.171.0

func (e AsyncEventSetupError) Error() string

type AsyncEventTransporter added in v0.172.0

type AsyncEventTransporter interface {
	ReadMessage() (string, error)
	Close() error
}

type Auth

type Auth struct {
	User  string `json:"user,omitempty"`
	Token string `json:"token,omitempty"`
}

type Container

type Container struct {
	Name string `json:"name,omitempty"`
	Auth *Auth  `json:"auth,omitempty"`
}

type Defaults

type Defaults struct {
	Suite `yaml:",inline" mapstructure:",squash"`
}

type EnvItem

type EnvItem struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

type File

type File struct {
	Src string `yaml:"src,omitempty" json:"src"`
	Dst string `yaml:"dst,omitempty" json:"dst"`
}

type FileData

type FileData struct {
	Path string `json:"path,omitempty"`
	Data string `json:"data,omitempty"`
}

type ImagePullAuth

type ImagePullAuth struct {
	User  string `yaml:"user,omitempty" json:"user"`
	Token string `yaml:"token,omitempty" json:"token"`
}

type Project

type Project struct {
	config.TypeDef `yaml:",inline" mapstructure:",squash"`
	Defaults       Defaults           `yaml:"defaults" json:"defaults"`
	Sauce          config.SauceConfig `yaml:"sauce,omitempty" json:"sauce"` // Used fields are `region` and `tunnel`.
	Suites         []Suite            `yaml:"suites,omitempty" json:"suites"`
	Artifacts      config.Artifacts   `yaml:"artifacts,omitempty" json:"artifacts"`
	DryRun         bool               `yaml:"-" json:"-"`
	LiveLogs       bool               `yaml:"-" json:"-"`
	Env            map[string]string  `yaml:"env,omitempty" json:"env"`
	EnvFlag        map[string]string  `yaml:"-" json:"-"`
	Reporters      config.Reporters   `yaml:"reporters,omitempty" json:"-"`
}

func FromFile

func FromFile(cfgPath string) (Project, error)

type Runner

type Runner struct {
	ID                string       `json:"id,omitempty"`
	Status            string       `json:"status,omitempty"`
	Image             string       `json:"image,omitempty"`
	CreationTime      int64        `json:"creation_time,omitempty"`
	TerminationTime   int64        `json:"termination_time,omitempty"`
	TerminationReason string       `json:"termination_reason,omitempty"`
	Assets            RunnerAssets `json:"assets,omitempty"`
}

type RunnerAssets added in v0.173.2

type RunnerAssets struct {
	Status string `json:"status,omitempty"`
}

type RunnerSpec

type RunnerSpec struct {
	Container    Container         `json:"container,omitempty"`
	EntryPoint   string            `json:"entrypoint,omitempty"`
	Env          []EnvItem         `json:"env,omitempty"`
	Files        []FileData        `json:"files,omitempty"`
	Metadata     map[string]string `json:"metadata,omitempty"`
	Artifacts    []string          `json:"artifacts,omitempty"`
	WorkloadType string            `json:"workload_type,omitempty"`
	Tunnel       *Tunnel           `json:"tunnel,omitempty"`
	Services     []Service         `json:"services,omitempty"`
}

type ServerError added in v0.164.1

type ServerError struct {
	// HTTPStatus is the HTTP status code as returned by the server.
	HTTPStatus int `json:"-"`

	// Short is a short error prefix saying what failed, e.g. "failed to do x".
	Short string `json:"-"`

	// Code is the error code, such as 'ERR_IMAGE_NOT_ACCESSIBLE'.
	Code string `json:"code"`

	// Msg describes the error in more detail.
	Msg string `json:"message"`
}

func (*ServerError) Error added in v0.164.1

func (s *ServerError) Error() string

type Service added in v0.163.0

type Service struct {
	Name       string     `json:"name,omitempty"`
	Container  Container  `json:"container,omitempty"`
	EntryPoint string     `json:"entrypoint,omitempty"`
	Env        []EnvItem  `json:"env,omitempty"`
	Files      []FileData `json:"files,omitempty"`
}

type Suite

type Suite struct {
	Name            string            `yaml:"name,omitempty" json:"name"`
	Image           string            `yaml:"image,omitempty" json:"image"`
	ImagePullAuth   ImagePullAuth     `yaml:"imagePullAuth,omitempty" json:"imagePullAuth"`
	EntryPoint      string            `yaml:"entrypoint,omitempty" json:"entrypoint"`
	Files           []File            `yaml:"files,omitempty" json:"files"`
	Artifacts       []string          `yaml:"artifacts,omitempty" json:"artifacts"`
	Env             map[string]string `yaml:"env,omitempty" json:"env"`
	Timeout         time.Duration     `yaml:"timeout,omitempty" json:"timeout"`
	Workload        string            `yaml:"workload,omitempty" json:"workload,omitempty"`
	ResourceProfile string            `yaml:"resourceProfile,omitempty" json:"resourceProfile,omitempty"`
	Metadata        map[string]string `yaml:"metadata,omitempty" json:"metadata,omitempty"`
	Services        []SuiteService    `yaml:"services,omitempty" json:"services,omitempty"`
}

type SuiteService added in v0.163.0

type SuiteService struct {
	Name            string            `yaml:"name,omitempty" json:"name"`
	Image           string            `yaml:"image,omitempty" json:"image"`
	ImagePullAuth   ImagePullAuth     `yaml:"imagePullAuth,omitempty" json:"imagePullAuth"`
	EntryPoint      string            `yaml:"entrypoint,omitempty" json:"entrypoint"`
	Files           []File            `yaml:"files,omitempty" json:"files"`
	Env             map[string]string `yaml:"env,omitempty" json:"env"`
	ResourceProfile string            `yaml:"resourceProfile,omitempty" json:"resourceProfile,omitempty"`
}

type Tunnel added in v0.140.0

type Tunnel struct {
	Name  string `json:"name,omitempty"`
	Owner string `json:"owner,omitempty"`
}

Jump to

Keyboard shortcuts

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