run

package
v0.8.11 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Replay

func Replay(events []ddd.Event) ddd.Aggregate

Replay recreates the run from a series of events

Types

type AppendLog

type AppendLog struct {
	Timestamp int64
	Level     LogLevel
	Message   string
}

AppendLog is the event for when we append a logging event

func (AppendLog) EventType

func (e AppendLog) EventType() string

EventType marks this as an event

type Completed

type Completed struct {
	Timestamp int64
	Status    Status
}

Completed signifies when this run is completed

func (Completed) EventType

func (e Completed) EventType() string

EventType marks this as an event

type Created

type Created struct {
	UUID     string
	Template *template.Template
	Trigger  *trigger.Trigger
}

Created is the event for when a new run is started

func (Created) EventType

func (e Created) EventType() string

EventType marks this as an event

type Engine

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

The Engine is the worker that performs all run steps and tracking

func NewEngine

func NewEngine(r *Run, s storage.Storage, aa agent.AgentAction, g git.Agent, ra repo.Agent, ap func(string, string, bool) error, t func(string, string, []byte) (string, error)) (*Engine, error)

NewEngine initializes the engine with required dependencies

func (*Engine) Resume added in v0.8.0

func (e *Engine) Resume()

Resume continues a run after a pause

func (*Engine) Start added in v0.8.0

func (e *Engine) Start()

Start the engine-designed to be run in the background

type Link struct {
	Name string
	URL  string
}

A Link is a reference attached to a run

type Log

type Log struct {
	Timestamp int64
	Level     LogLevel
	Message   string
}

A Log is part of a step's result

type LogLevel

type LogLevel string

LogLevel is an alias for different log levels for run messages NOTE: this is not for internal logging, but rather how we represent deployment logs

const (
	// Debug represents a log level not normally shown, for debug purposes
	Debug LogLevel = "DEBUG"

	// Info represents informational logs
	Info LogLevel = "INFO"

	// Warn represents warning logs for conditions not normally seen, but which aren't errors
	Warn LogLevel = "WARN"

	// Error represents the log for an error
	Error LogLevel = "ERROR"
)

type ReadRepository

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

ReadRepository is the repository for dealing with run reads

func NewReadRepository

func NewReadRepository(s storage.Storage) *ReadRepository

NewReadRepository creates a repository with the given storage

func (*ReadRepository) All

func (rr *ReadRepository) All() ([]*Run, error)

All gets all runs

func (*ReadRepository) Load

func (rr *ReadRepository) Load(uuid string) (*Run, error)

Load gets one run

type Run

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

Run represents a single execution of a deployment

func Create

func Create(uuid string, tpl *template.Template, trig *trigger.Trigger) (*Run, error)

Create handles create commands for runs

func (*Run) AppendLog

func (r *Run) AppendLog(message string, level LogLevel, timestamp int64) error

AppendLog appends the log message to the current step

func (*Run) Complete

func (r *Run) Complete(status Status, timestamp int64) error

Complete handles completion commands for runs

func (*Run) CompleteStep

func (r *Run) CompleteStep(timestamp int64) error

CompleteStep completes the currently running step

func (*Run) CurrentTemplate

func (r *Run) CurrentTemplate() *template.Step

CurrentTemplate gets the current step to execute

func (*Run) DeploymentUUID

func (r *Run) DeploymentUUID() string

DeploymentUUID gets the run's deployment uuid

func (*Run) Destroyed

func (r *Run) Destroyed() bool

Destroyed determines if this run has been destroyed

func (*Run) Events

func (r *Run) Events() []ddd.Event

Events gets the run's event history

func (r *Run) Links() []*Link

Links gets the links for this run

func (*Run) Name added in v0.7.0

func (r *Run) Name() string

Name gets the name specified in the template for the run

func (*Run) Paused added in v0.8.0

func (r *Run) Paused() bool

Paused returns if this run has been paused for some reason, for example a manual approval

func (*Run) RunVersion

func (r *Run) RunVersion() string

RunVersion gets the version specified in the template for the run (NOTE: not the entity version)

func (*Run) SetStatus added in v0.8.0

func (r *Run) SetStatus(s Status) error

SetStatus sets the status for the current step

func (*Run) SkipStep

func (r *Run) SkipStep(name, reason string, timestamp int64) error

SkipStep skips the step completely

func (*Run) Start

func (r *Run) Start(timestamp int64) error

Start handles start commands for runs

func (*Run) StartStep

func (r *Run) StartStep(name string, timestamp int64) error

StartStep starts the next step

func (*Run) StartTime

func (r *Run) StartTime() int64

StartTime gets the time this run started

func (*Run) Status

func (r *Run) Status() Status

Status gets the run's current status

func (*Run) Steps

func (r *Run) Steps() []Step

Steps gets the steps for this run

func (*Run) StopTime

func (r *Run) StopTime() int64

StopTime gets the time this run was completed

func (*Run) UUID

func (r *Run) UUID() string

UUID gets the run's uuid

func (*Run) Version

func (r *Run) Version() int

Version gets the run's entity version

type RuntimeError

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

RuntimeError is thrown when some runtime execution rule is broken

func (RuntimeError) Error

func (e RuntimeError) Error() string

type Started

type Started struct {
	Timestamp int64
}

Started signifies when this run is started

func (Started) EventType

func (e Started) EventType() string

EventType marks this as an event

type Status

type Status string

Status is an alias to give us the status of a Step

const (
	// NotStarted signifies a step not yet executed
	NotStarted Status = "NotStarted"

	// InProgress signifies a step that has been started
	InProgress Status = "InProgress"

	// AwaitingApproval signifies a step that is awaiting a manual approver
	AwaitingApproval Status = "AwaitingApproval"

	// Failed signifies a step that failed
	Failed Status = "Failed"

	// Succeeded signifies a step that was successful
	Succeeded Status = "Succeeded"

	// Skipped signifies a step that was not run
	Skipped Status = "Skipped"
)

type StatusSet added in v0.8.0

type StatusSet struct {
	Status Status
}

StatusSet is the event for when a step's status changes

func (StatusSet) EventType added in v0.8.0

func (e StatusSet) EventType() string

EventType marks this as an event

type Step

type Step struct {
	Name   string
	Status Status
	Start  int64
	Stop   int64
	Logs   []Log
}

A Step represents the outcome of a step being executed

type StepCompleted

type StepCompleted struct {
	Timestamp int64
}

StepCompleted is the event for when a particular step is completed

func (StepCompleted) EventType

func (e StepCompleted) EventType() string

EventType marks this as an event

type StepSkipped

type StepSkipped struct {
	Timestamp int64
	Name      string
	Reason    string
}

StepSkipped is the event for when a particular step is skipped

func (StepSkipped) EventType

func (e StepSkipped) EventType() string

EventType marks this as an event

type StepStarted

type StepStarted struct {
	Timestamp int64
	Name      string
}

StepStarted is the event for when a particular step is started

func (StepStarted) EventType

func (e StepStarted) EventType() string

EventType marks this as an event

Jump to

Keyboard shortcuts

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