deploy

package
v0.0.0-...-47374f6 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ASCII_RESET = "\x1b[0m"

	ASCII_BLACK   = "\x1b[30m"
	ASCII_RED     = "\x1b[31m"
	ASCII_GREEN   = "\x1b[32m"
	ASCII_YELLOW  = "\x1b[33m"
	ASCII_BLUE    = "\x1b[34m"
	ASCII_MAGENTA = "\x1b[35m"
	ASCII_CYAN    = "\x1b[36m"
	ASCII_WHITE   = "\x1b[37m"
)

Variables

View Source
var ErrNoDeployment = errors.New("no deployment with this ID found")
View Source
var ErrTimeout = errors.New("sending to listener timed out")
View Source
var ListenerTimeout = 200 * time.Millisecond

Functions

func ConsoleLogger

func ConsoleLogger(logs <-chan LogEntry)

Types

type DeploymentLogger

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

func NewDeploymentLogger

func NewDeploymentLogger(d *models.Deployment, r *LogRouter) *DeploymentLogger

func (*DeploymentLogger) BroadcastLogs

func (l *DeploymentLogger) BroadcastLogs()

func (*DeploymentLogger) Flush

func (l *DeploymentLogger) Flush()

func (*DeploymentLogger) Log

func (l *DeploymentLogger) Log(entry LogEntry)

func (*DeploymentLogger) LogCmdFail

func (l *DeploymentLogger) LogCmdFail(origin, cmd string, err error)

func (*DeploymentLogger) LogCmdStart

func (l *DeploymentLogger) LogCmdStart(origin, cmd string)

func (*DeploymentLogger) LogCmdSuccess

func (l *DeploymentLogger) LogCmdSuccess(origin, cmd string)

func (*DeploymentLogger) LogDeploymentFail

func (l *DeploymentLogger) LogDeploymentFail(err error)

func (*DeploymentLogger) LogDeploymentStart

func (l *DeploymentLogger) LogDeploymentStart()

func (*DeploymentLogger) LogDeploymentSuccess

func (l *DeploymentLogger) LogDeploymentSuccess()

func (*DeploymentLogger) LogKillReceived

func (l *DeploymentLogger) LogKillReceived()

func (*DeploymentLogger) LogStageFail

func (l *DeploymentLogger) LogStageFail(stage models.DeploymentStage)

func (*DeploymentLogger) LogStageResult

func (l *DeploymentLogger) LogStageResult(msg string)

func (*DeploymentLogger) LogStageStart

func (l *DeploymentLogger) LogStageStart(stage models.DeploymentStage)

func (*DeploymentLogger) LogStageSuccess

func (l *DeploymentLogger) LogStageSuccess(stage models.DeploymentStage)

type ExecutionResult

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

type Listener

type Listener func(<-chan LogEntry)

type LogEntry

type LogEntry struct {
	Id           int          `json:"id"`
	Timestamp    time.Time    `json:"timestamp"`
	DeploymentId int          `json:"deployment_id"`
	Origin       string       `json:"origin"`
	EntryType    LogEntryType `json:"entry_type"`
	Message      string       `json:"message"`
}

type LogEntryType

type LogEntryType string
const (
	COMMAND_STDOUT_OUTPUT LogEntryType = "COMMAND_STDOUT_OUTPUT"
	COMMAND_STDERR_OUTPUT LogEntryType = "COMMAND_STDERR_OUTPUT"
	COMMAND_START         LogEntryType = "COMMAND_START"
	COMMAND_FAIL          LogEntryType = "COMMAND_FAIL"
	COMMAND_SUCCESS       LogEntryType = "COMMAND_SUCCESS"
	STAGE_START           LogEntryType = "STAGE_START"
	STAGE_FAIL            LogEntryType = "STAGE_FAIL"
	STAGE_SUCCESS         LogEntryType = "STAGE_SUCCESS"
	STAGE_RESULT          LogEntryType = "STAGE_RESULT"
	DEPLOYMENT_START      LogEntryType = "DEPLOYMENT_START"
	DEPLOYMENT_SUCCESS    LogEntryType = "DEPLOYMENT_SUCCESS"
	DEPLOYMENT_FAIL       LogEntryType = "DEPLOYMENT_FAIL"
	KILL_RECEIVED         LogEntryType = "KILL_RECEIVED"
)

type LogRouter

type LogRouter struct {
	// LogEntries on this channel will be routed to registered listeners
	Broadcast chan LogEntry

	// If a deployment is done, the DeploymentId needs to be sent on this channel
	// so the router can close the listeners target channels
	// Be sure to only sent here after all Broadcast sends
	Done chan int
	// contains filtered or unexported fields
}

func NewLogRouter

func NewLogRouter() *LogRouter

func (*LogRouter) Announce

func (r *LogRouter) Announce(deploymentId int)

func (*LogRouter) Start

func (r *LogRouter) Start()

func (*LogRouter) Stop

func (r *LogRouter) Stop()

func (*LogRouter) Subscribe

func (r *LogRouter) Subscribe(deploymentId int, l Listener) error

func (*LogRouter) SubscribeAll

func (r *LogRouter) SubscribeAll(l Listener)

type Manager

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

func NewManager

func NewManager(c *models.DeploymentConfig, r *LogRouter, kc chan struct{}) (*Manager, error)

func (*Manager) AnnounceStart

func (m *Manager) AnnounceStart()

Starts the broadcasting of LogEntries with the DeploymentLogger and logs the start of the deployment

func (*Manager) Start

func (m *Manager) Start() error

type Worker

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

func (*Worker) Close

func (w *Worker) Close() error

func (*Worker) Connect

func (w *Worker) Connect() error

func (*Worker) Execute

func (w *Worker) Execute(stage models.DeploymentStage) ExecutionResult

Jump to

Keyboard shortcuts

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