models

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationNotificationTypeGitClone ApplicationNotificationType = "git_clone_error"
	ApplicationNotificationTypeGitFetch ApplicationNotificationType = "git_fetch_error"

	ApplicationNotificationLevelCritical ApplicationNotificationLevel = "critical"
)
View Source
const (
	// SessionStatusStarting - When the session is being built
	SessionStatusStarting SessionStatus = "starting"
	// SessionStatusStarted - When the session has been built
	// and the session is available to be proxied to
	SessionStatusStarted SessionStatus = "started"
	// SessionStatusStartFailed - When the session build process failed
	SessionStatusStartFailed SessionStatus = "start_failed"
	// SessionStatusStopFailed - When the session stop process failed
	SessionStatusStopFailed SessionStatus = "stop_failed"
	// SessionStatusStopping - When the session is being stopped
	SessionStatusStopping SessionStatus = "stopping"
	// SessionStatusStopped - When the session has been stopped successfully
	SessionStatusStopped SessionStatus = "stopped"
	// SessionStatusDegraded - When the healthcheck failed
	// and the session is NOT available to be proxied to
	SessionStatusDegraded SessionStatus = "degraded"

	// LogTypeStdin is the command being executed
	LogTypeStdin LogType = "stdin"
	// LogTypeStdout is the output printed on the stdout
	LogTypeStdout LogType = "stdout"
	// LogTypeStderr is the output printed on the stderr
	LogTypeStderr LogType = "stderr"

	// KillReasonNone - The reason has not been set. Maybe because there has not been a kill yet
	KillReasonNone KillReason = ""
	// KillReasonStopped - The session has been manually stopped by the user
	KillReasonStopped KillReason = "stopped"
	// KillReasonBuildFailed - The session has been killed because its build process failed
	KillReasonBuildFailed KillReason = "build_failed"
	// KillReasonHealthcheckFailed - The session has been killed because the healthcheck process
	// could not check the service reachability. It depends on user-provided configuration
	KillReasonHealthcheckFailed KillReason = "healthcheck_failed"
	// KillReasonReplaced - Means the session is going to be replaced with an updated one
	KillReasonReplaced KillReason = "replaced"

	// SessionBuildContextKey is the name of the shared BUILD context.
	// It is shared to allow an early session destruction to stop a running build of a session
	SessionBuildContextKey string = "build"
)

Variables

View Source
var (
	ErrMalformedHeader error = errors.New("Malformed header; the format should be key=value")
)

Functions

func MapApplications

func MapApplications(models []*Application) []output.Application

MapApplications converts an application model to an output model

func MapBranch

func MapBranch(model Branch) output.Branch

func MapCheckoutObject

func MapCheckoutObject(model CheckoutObject) output.CheckoutObject

func MapCommand

func MapCommand(model Command) output.Command

func MapForward

func MapForward(model Forward) output.Forward

func MapMetric

func MapMetric(model Metric) output.Metric

func MapReplacedBy added in v1.3.0

func MapReplacedBy(model *Session) string

func MapSession

func MapSession(model *Session) *output.Session

func MapSessionLog

func MapSessionLog(log Log) output.SessionLog

func MapSessionStatus

func MapSessionStatus(model *Session) output.SessionStatus

MapSessionStatus maps a session to a status output model

func MapSessions

func MapSessions(models []*Session) []output.Session

func MapTag

func MapTag(model Tag) output.Tag

func NewContextStore

func NewContextStore(mutexBuilder utils.MutexBuilder) *contextStore

func NewMetricsForSession

func NewMetricsForSession(session *Session) func(string) func()

func NewSessionAlias added in v1.3.0

func NewSessionAlias(exclude []string) string

Types

type Application

type Application struct {
	utils.RWLocker `json:"-"`
	Filename       string `json:"filename"`

	Status                  ApplicationStatus         `json:"status"`
	Folder                  string                    `json:"folder"`
	BaseFolder              string                    `json:"baseFolder"`
	ObjectsToHashMap        map[string]string         `json:"-"`
	HashToObjectsMap        map[string]*RemoteObject  `json:"-"`
	BranchesMap             map[string]*Branch        `json:"branchesMap"`
	TagsMap                 map[string]*Tag           `json:"tagsMap"`
	Commits                 []string                  `json:"-"`
	CommitMap               map[string]*object.Commit `json:"-"`
	CompiledForwardPatterns []CompiledForwardPattern  `json:"-"`
	// contains filtered or unexported fields
}

func (*Application) AddNotification added in v1.4.0

func (a *Application) AddNotification(notificationType ApplicationNotificationType, description string, level ApplicationNotificationLevel, permanent bool)

AddNotification adds a notification to the array of notifications to be shown on the client side The notifications are grouped by type, so only the first one gets notified to the final user.

func (*Application) GetConfiguration

func (a *Application) GetConfiguration() ApplicationConfiguration

func (*Application) GetEventBus

func (a *Application) GetEventBus() *ApplicationEventBus

func (*Application) GetStatus

func (a *Application) GetStatus() ApplicationStatus

func (*Application) RemoveNotificationByType added in v1.4.0

func (a *Application) RemoveNotificationByType(notificationType ApplicationNotificationType)

RemoveNotificationByType removes all notifications by a type

func (*Application) SetBaseFolder

func (a *Application) SetBaseFolder(baseFolder string)

func (*Application) SetConfiguration

func (a *Application) SetConfiguration(conf ApplicationConfiguration)

func (*Application) SetFolder

func (a *Application) SetFolder(folder string)

func (*Application) SetStatus

func (a *Application) SetStatus(status ApplicationStatus)

func (*Application) ToOutput

func (a *Application) ToOutput() output.Application

ToOutput converts this model into an output model

func (*Application) WithLock

func (a *Application) WithLock(f func(*Application))

func (*Application) WithRLock

func (a *Application) WithRLock(f func(*Application))

type ApplicationBuilder

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

func NewApplicationBuilder

func NewApplicationBuilder(mutexBuilder utils.MutexBuilder, logger logging.Logger) *ApplicationBuilder

func (*ApplicationBuilder) Build

func (b *ApplicationBuilder) Build(configuration *ApplicationConfiguration, filename string) (*Application, error)

func (*ApplicationBuilder) BuildConfiguration

func (b *ApplicationBuilder) BuildConfiguration(configuration *ApplicationConfiguration) (*ApplicationConfiguration, error)

type ApplicationCommand

type ApplicationCommand struct {
	exec.Cmd
}

type ApplicationCommandOutput

type ApplicationCommandOutput struct {
	Output   []string
	ExitCode int
}

type ApplicationConfiguration

type ApplicationConfiguration struct {
	SharedConfiguration   `yaml:",inline"` // Base configuration, common for branches and root application configuration
	utils.RWLocker        `json:"-"`
	ID                    string   `json:"id"`
	Name                  string   `json:"name"`
	Hash                  string   `json:"hash"`
	Fetch                 Fetch    `json:"fetch"`
	IsDefault             bool     `yaml:"is_default" json:"isDefault"`
	MaxConcurrentSessions int      `yaml:"max_concurrent_sessions" json:"maxConcurrentSessions"`
	Branches              Branches `yaml:"branches"`
	UseFolderCopy         bool     `yaml:"use_folder_copy" json:"useFolderCopy"`
	CleanOnExit           *bool    `yaml:"clean_on_exit" json:"cleanOnExit" default:"true"`
}

ApplicationConfiguration contains the configuration of the application Usually its retrieval methods override the SharedConfiguration struct with the checkout-specific configuration

func BuildApplicationConfiguration added in v1.3.0

func BuildApplicationConfiguration(name string) *ApplicationConfiguration

func NewApplicationConfiguration

func NewApplicationConfiguration(configuration *ApplicationConfiguration, mutexBuilder utils.MutexBuilder) (*ApplicationConfiguration, error)

func (*ApplicationConfiguration) OverrideWith

func (a *ApplicationConfiguration) OverrideWith(override SharedConfiguration)

func (*ApplicationConfiguration) SetAsDefault added in v1.3.0

func (ApplicationConfiguration) ToOutput

ToOutput converts this model into an output model

func (*ApplicationConfiguration) WithBranch added in v1.3.0

func (*ApplicationConfiguration) WithCleanCommand added in v1.3.0

func (a *ApplicationConfiguration) WithCleanCommand(command string) *ApplicationConfiguration

func (*ApplicationConfiguration) WithCleanCommand_ContinueOnError added in v1.3.0

func (a *ApplicationConfiguration) WithCleanCommand_ContinueOnError(command string) *ApplicationConfiguration

func (*ApplicationConfiguration) WithHealthcheckRetryInterval added in v1.3.0

func (a *ApplicationConfiguration) WithHealthcheckRetryInterval(interval float32) *ApplicationConfiguration

func (*ApplicationConfiguration) WithLock

func (a *ApplicationConfiguration) WithLock(f func(*ApplicationConfiguration))

func (*ApplicationConfiguration) WithRLock

func (a *ApplicationConfiguration) WithRLock(f func(*ApplicationConfiguration))

func (*ApplicationConfiguration) WithRemote added in v1.3.0

func (*ApplicationConfiguration) WithStartCommand added in v1.3.0

func (a *ApplicationConfiguration) WithStartCommand(command string) *ApplicationConfiguration

func (*ApplicationConfiguration) WithStartupRetries added in v1.3.0

func (a *ApplicationConfiguration) WithStartupRetries(n int) *ApplicationConfiguration

func (*ApplicationConfiguration) WithStopCommand added in v1.3.0

func (a *ApplicationConfiguration) WithStopCommand(command string) *ApplicationConfiguration

type ApplicationEvent

type ApplicationEvent struct {
	EventType    ApplicationEventType
	Application  *Application
	EventPayload interface{}
}

type ApplicationEventBus

type ApplicationEventBus struct {
	utils.RWLocker
	// contains filtered or unexported fields
}

func NewApplicationEventBus

func NewApplicationEventBus(mutexBuilder utils.MutexBuilder, logger logging.Logger) *ApplicationEventBus

func (*ApplicationEventBus) Close

func (b *ApplicationEventBus) Close()

func (*ApplicationEventBus) GetChan

func (b *ApplicationEventBus) GetChan() <-chan ApplicationEvent

func (*ApplicationEventBus) PublishEvent

func (b *ApplicationEventBus) PublishEvent(eventType ApplicationEventType, application *Application, payloadObjects ...interface{})

type ApplicationEventType

type ApplicationEventType string
const (
	ApplicationEventTypeNone                    ApplicationEventType = "none"
	ApplicationEventTypeInitializationStarted   ApplicationEventType = "initialization_started"
	ApplicationEventTypeInitializationCompleted ApplicationEventType = "initialization_completed"
	ApplicationEventTypeFetchStarted            ApplicationEventType = "fetch_started"
	ApplicationEventTypeFetchCompleted          ApplicationEventType = "fetch_completed"
	ApplicationEventTypeHotSwap                 ApplicationEventType = "hot_swap"
	ApplicationEventTypeAutoStart               ApplicationEventType = "auto_start"
	ApplicationEventTypeSessionBuild            ApplicationEventType = "session_build"
	ApplicationEventTypeSessionBuildFailed      ApplicationEventType = "session_build_failed"
	ApplicationEventTypeSessionBuildSucceeded   ApplicationEventType = "session_build_succeeded"
	ApplicationEventTypeSessionCleaned          ApplicationEventType = "session_cleaned"
)

func (ApplicationEventType) String

func (t ApplicationEventType) String() string

type ApplicationNotification added in v1.4.0

type ApplicationNotification struct {
	UUID        string
	Type        ApplicationNotificationType
	Permanent   bool
	Level       ApplicationNotificationLevel
	Description string
	CreatedAt   time.Time
}

func (*ApplicationNotification) ToOutput added in v1.4.0

type ApplicationNotificationLevel added in v1.4.0

type ApplicationNotificationLevel string

type ApplicationNotificationType added in v1.4.0

type ApplicationNotificationType string

type ApplicationStatus

type ApplicationStatus string
var (
	ApplicationStatusLoading ApplicationStatus = "loading"
	ApplicationStatusReady   ApplicationStatus = "ready"
)

type Branch

type Branch struct {
	CheckoutObject
}

type BranchConfiguration

type BranchConfiguration struct {
	Main  bool `yaml:"main"`
	Watch bool `yaml:"watch"`
}

type BranchConfigurationMatch

type BranchConfigurationMatch struct {
	SharedConfiguration `yaml:",inline"`
	BranchConfiguration `yaml:",inline"`
	Test                string `yaml:"test"`
}

func BuildBranchConfigurationMatch added in v1.3.0

func BuildBranchConfigurationMatch(branch string) *BranchConfigurationMatch

func (*BranchConfigurationMatch) SetMain added in v1.3.0

func (*BranchConfigurationMatch) SetWatch added in v1.3.0

type Branches

type Branches []BranchConfigurationMatch

func (Branches) BranchIsBeingWatched

func (branches Branches) BranchIsBeingWatched(branch string, logger logging.Logger) bool

func (Branches) BranchIsMain

func (branches Branches) BranchIsMain(branch string, logger logging.Logger) bool

type BusEventType added in v1.3.0

type BusEventType string

func (BusEventType) String added in v1.3.0

func (t BusEventType) String() string

type CheckoutObject

type CheckoutObject struct {
	Name        string `json:"name"`
	Hash        string `json:"hash"`
	Author      string `json:"author"`
	AuthorEmail string
	Date        time.Time `json:"date"`
	Message     string    `json:"message"`
}

type Command

type Command struct {
	Command             string   `json:"command"`
	Environment         []string `yaml:"environment,omitempty" json:"environment"`
	OutputVariable      string   `yaml:"output_variable,omitempty" json:"outputVariable"`
	ContinueOnError     bool     `yaml:"continue_on_error" json:"continueOnError"`
	WorkingDir          string   `yaml:"working_dir" json:"workingDir"`
	StartHealthchecking bool     `yaml:"start_healthchecking" json:"startHealthchecking"`
	Timeout             int      `json:"timeout"`
}

type Commands

type Commands struct {
	Start []Command `json:"start"`
	Stop  []Command `json:"stop"`
	Clean []Command `json:"clean"`
}

type CompiledForwardPattern

type CompiledForwardPattern struct {
	Pattern *regexp.Regexp
	Forward Forward
}

type DiagnosticsAction

type DiagnosticsAction string
const (
	DiagnosticsActionReplacement DiagnosticsAction = "replacement"
)

func (DiagnosticsAction) String

func (diagnosticsAction DiagnosticsAction) String() string

type DiagnosticsData

type DiagnosticsData struct {
	Action DiagnosticsAction
	When   time.Time
	Field  string
	Value  interface{}
}

type Fetch

type Fetch struct {
	Interval int `json:"interval"`
}

type Forward

type Forward struct {
	Pattern string  `json:"pattern"`
	To      string  `json:"to"`
	Host    string  `json:"host"`
	Headers Headers `json:"headers"`
}

type GlobalConfiguration

type GlobalConfiguration struct {
	Port                  int
	TLSCertFile           string `yaml:"tls_cert,omitempty"`
	TLSKeyFile            string `yaml:"tls_key,omitempty"`
	SessionsFolder        string `yaml:"sessions_folder"`
	MaxConcurrentSessions int    `yaml:"max_concurrent_sessions" json:"maxConcurrentSessions"`
}
type Header string

func (Header) Parse

func (h Header) Parse() (string, string, error)

type Headers

type Headers struct {
	Add     []Header `json:"add"`
	Set     []Header `json:"set"`
	Del     []string `json:"del"`
	Replace []Header `json:"replace"`
}

func (*Headers) ApplyTo

func (h *Headers) ApplyTo(r *http.Request) error

type Healthcheck

type Healthcheck struct {
	RequestConfiguration `yaml:",inline"`
	MaxRetries           int     `yaml:"max_retries" json:"maxRetries"`
	RetryInterval        float32 `yaml:"retry_interval" json:"retryInterval"`
}

type Helper

type Helper struct {
	Position HelperPosition `json:"position"`
}

type HelperPosition

type HelperPosition string

func (*HelperPosition) GetStyle

func (p *HelperPosition) GetStyle() (x string, y string)

type KillReason

type KillReason string

KillReason states the reason why a session has been killed

func (KillReason) PreventsRebuild

func (reason KillReason) PreventsRebuild() bool

PreventsRebuild checks if the reason why this session has been killed prevents another build with the same checkout to be built

type Log

type Log struct {
	When    time.Time `json:"when"`
	UUID    string    `json:"uuid"`
	Type    LogType   `json:"type"`
	Message string    `json:"message"`
}

func NewLog

func NewLog(message string, logType LogType) Log

type LogType

type LogType string
const (
	LogTypeTrace    LogType = "trace"
	LogTypeDebug    LogType = "debug"
	LogTypeInfo     LogType = "info"
	LogTypeWarn     LogType = "warn"
	LogTypeError    LogType = "error"
	LogTypeCritical LogType = "critical"
)

type Metric

type Metric struct {
	Object   string
	Duration time.Duration
}

type Metrics

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

func NewMetrics

func NewMetrics() *Metrics

func (*Metrics) Push

func (m *Metrics) Push(object string, duration time.Duration)

func (*Metrics) ToSlice

func (m *Metrics) ToSlice() []*Metric

type PortConfiguration

type PortConfiguration struct {
	Except []int `json:"except"`
}

type PrevNextDiagnosticsValue

type PrevNextDiagnosticsValue struct {
	Previous string
	Next     string
}

type Recycle

type Recycle struct {
	InactivityTimeout int `yaml:"inactivity_timeout" json:"inactivityTimeout"`
}

type RemoteObject

type RemoteObject struct {
	Branches []string
	Tags     []string
}

type RequestConfiguration

type RequestConfiguration struct {
	Method  string `json:"method"`
	URL     string `yaml:"url" json:"url"`
	Status  int    `json:"status"`
	Timeout int    `yaml:"timeout" json:"timeout"`
}

type RootConfiguration

type RootConfiguration struct {
	Global                    GlobalConfiguration
	ApplicationConfigurations []*ApplicationConfiguration `yaml:"applications"`
}

type Session

type Session struct {
	utils.RWLocker  `json:"-"`
	UUID            string       `json:"uuid"`
	Alias           string       `json:"alias"`
	DisplayName     string       `json:"displayName"`
	Port            int          `json:"port"`
	ApplicationName string       `json:"applicationName"`
	Application     *Application `json:"-"`

	Status    SessionStatus `json:"status"`
	CommitID  string        `json:"commitID"` // The object to be checked out (branch/tag/commit id)
	Checkout  string        `json:"checkout"`
	Commit    object.Commit `json:"commit"`
	Folder    string        `json:"folder"`
	Variables Variables     `json:"variables"`
	Metrics   []Metric      `json:"metrics"`
	Context   *contextStore `json:"-"`
	// contains filtered or unexported fields
}

Session is a process on which an application is available. When a session is started it gets built starting from a branch, and when all is ready the reverse proxy will start pointing to it.

func (*Session) DecreaseMaxAge

func (session *Session) DecreaseMaxAge()

DecreaseMaxAge decreases the max-age parameter of the session thread-safely

func (*Session) GetConfiguration

func (session *Session) GetConfiguration() ApplicationConfiguration

GetConfiguration allows to retrieve the CURRENT configuration in a thread-safe manner. This configuration gets replaced whenever there's an update by the user. So it is advisable to not store indefinitely this configuration, but to ask for it when needed

func (*Session) GetCreatedAt

func (session *Session) GetCreatedAt() time.Time

func (*Session) GetDiagnosticsData

func (session *Session) GetDiagnosticsData() []DiagnosticsData

func (*Session) GetEventBus

func (session *Session) GetEventBus() *SessionLifetimeEventBus

func (*Session) GetInactiveAt

func (session *Session) GetInactiveAt() time.Time

GetInactiveAt retrieves the inactive-at value for the session thread-safely

func (*Session) GetKillReason

func (session *Session) GetKillReason() KillReason

GetKillReason returns the reason why the session has been killed thread-safely. Returns KillReasonNone if the session has not been killed

func (*Session) GetLogs

func (session *Session) GetLogs() []Log

func (*Session) GetMaxAge

func (session *Session) GetMaxAge() int

GetMaxAge allows to retrieve the session max-age thread-safely

func (*Session) GetReplacedBy

func (session *Session) GetReplacedBy() *Session

GetReplacedBy thread-safely retrieves the UUID of the session by which this session has been replaced

func (*Session) GetReplaces

func (session *Session) GetReplaces() []*Session

GetReplaces thread-safely retrieves the session which will be replaced when this session will go online

func (*Session) GetStartupRetriesCount

func (session *Session) GetStartupRetriesCount() int

GetStartupRetriesCount retrieves the current count of startup retries thread-safely

func (*Session) GetStatus

func (session *Session) GetStatus() SessionStatus

GetStatus allows to get the session status thread-safely

func (*Session) GetTarget

func (session *Session) GetTarget() string

func (*Session) IncStartupRetriesCount

func (session *Session) IncStartupRetriesCount()

IncStartupRetriesCount thread-safely increments the current count of startup retries

func (*Session) InitializeConfiguration

func (session *Session) InitializeConfiguration()

InitializeConfiguration gets called whenever a secondary actor knows that application's configuration changed. This allows the session to get its matching configuration

func (*Session) IsAlive

func (session *Session) IsAlive() bool

IsAlive thread-safely retrieves if the session is alive or not

func (*Session) LogCritical

func (session *Session) LogCritical(message string)

LogCritical logs a message to stdout and stores it in the session logs slice

func (*Session) LogDebug

func (session *Session) LogDebug(message string)

LogDebug logs a message to stdout and stores it in the session logs slice

func (*Session) LogError

func (session *Session) LogError(message string)

LogError logs a message to stdout and stores it in the session logs slice

func (*Session) LogInfo

func (session *Session) LogInfo(message string)

LogInfo logs a message to stdout and stores it in the session logs slice

func (*Session) LogStderr

func (session *Session) LogStderr(message string)

LogStderr logs a message to stdout and stores it in the session logs slice

func (*Session) LogStdin

func (session *Session) LogStdin(message string)

LogStdin logs a message to stdout and stores it in the session logs slice

func (*Session) LogStdout

func (session *Session) LogStdout(message string)

LogStdout logs a message to stdout and stores it in the session logs slice

func (*Session) LogTrace

func (session *Session) LogTrace(message string)

LogTrace logs a message to stdout and stores it in the session logs slice

func (*Session) LogWarn

func (session *Session) LogWarn(message string)

LogWarn logs a message to stdout and stores it in the session logs slice

func (*Session) MarkAsBeingRequested

func (session *Session) MarkAsBeingRequested()

MarkAsBeingRequested informs the session that it has been used by a proxy so it must reset its inactivity timer, if available

func (*Session) ResetStartupRetriesCount

func (session *Session) ResetStartupRetriesCount()

ResetStartupRetriesCount thread-safely resets the current count of startup retries

func (*Session) ResetVariables

func (session *Session) ResetVariables()

ResetVariables thread-safely resets the session variables dictionary

func (*Session) SetInactiveAt

func (session *Session) SetInactiveAt(at time.Time)

SetInactiveAt is the thread-safe setter for InactiveAt

func (*Session) SetKillReason

func (session *Session) SetKillReason(reason KillReason)

SetKillReason allows to set the session kill reason thread-safely

func (*Session) SetMaxAge

func (session *Session) SetMaxAge(age int)

SetMaxAge allows to set an exact max-age value for the session thread-safely

func (*Session) SetReplacedBy

func (session *Session) SetReplacedBy(newSession *Session)

SetReplacedBy thread-safely sets the UUID of the session by which this session has been replaced

func (*Session) SetReplaces

func (session *Session) SetReplaces(replaces []*Session)

SetReplaces thread-safely sets the session which will be replaced when this session will go online

func (*Session) SetStatus

func (session *Session) SetStatus(status SessionStatus)

SetStatus allows to set the session status thread-safely

func (*Session) SetVariable

func (session *Session) SetVariable(k string, v string)

SetVariable thread-safely sets a variable value into the session variables dictionary

func (*Session) ToOutput

func (session *Session) ToOutput() output.Session

ToOutput converts this model into an output model

type SessionBuildEvent

type SessionBuildEvent struct {
	EventType SessionEventType
	Session   *Session
}

type SessionBuilder

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

func NewSessionBuilder

func NewSessionBuilder(mutexBuilder utils.MutexBuilder, logger logging.Logger) *SessionBuilder

func (*SessionBuilder) Build

func (b *SessionBuilder) Build(session *Session) *Session

type SessionEventType

type SessionEventType string
const (
	SessionEventTypeBuildStarted             SessionEventType = "build_started"
	SessionEventTypePreparingFolders         SessionEventType = "preparing_folders"
	SessionEventTypePreparingFoldersFailed   SessionEventType = "preparing_folders_failed"
	SessionEventTypeCommandsExecutionStarted SessionEventType = "commands_execution_started"
	SessionEventTypeCommandsExecutionFailed  SessionEventType = "commands_execution_failed"
	SessionEventTypeWarmupStarted            SessionEventType = "warmup_started"
	SessionEventTypeWarmupFailed             SessionEventType = "warmup_failed"
	SessionEventTypeHealthcheckStarted       SessionEventType = "healthcheck_started"
	SessionEventTypeHealthcheckFailed        SessionEventType = "healthcheck_failed"
	SessionEventTypeHealthcheckSucceded      SessionEventType = "healthcheck_succeeded"
	SessionEventTypeBuildGettingRetried      SessionEventType = "build_getting_retried"
	SessionEventTypeFolderClean              SessionEventType = "folder_clean"
	SessionEventTypeCleanCommandExecution    SessionEventType = "clean_command_execution"
	SessionEventTypeSessionAvailable         SessionEventType = "session_available"
	SessionEventTypeSessionStarted           SessionEventType = "session_started"
)

func (SessionEventType) String

func (t SessionEventType) String() string

type SessionLifetimeEventBus

type SessionLifetimeEventBus struct {
	utils.RWLocker
	// contains filtered or unexported fields
}

func NewSessionBuildEventBus

func NewSessionBuildEventBus(mutexBuilder utils.MutexBuilder) *SessionLifetimeEventBus

func (*SessionLifetimeEventBus) Close

func (b *SessionLifetimeEventBus) Close()

func (*SessionLifetimeEventBus) GetChan

func (b *SessionLifetimeEventBus) GetChan() <-chan SessionBuildEvent

func (*SessionLifetimeEventBus) PublishEvent

func (b *SessionLifetimeEventBus) PublishEvent(eventType SessionEventType, session *Session)

type SessionStatus

type SessionStatus string

SessionStatus is the status of the session

func (SessionStatus) IsAlive

func (status SessionStatus) IsAlive() bool

IsAlive states whether the session is started or about be started

func (SessionStatus) String

func (status SessionStatus) String() string

type SharedConfiguration

type SharedConfiguration struct {
	Commands    Commands          `json:"commands"`
	Forwards    []Forward         `json:"forwards"`
	Headers     Headers           `json:"headers"`
	Healthcheck Healthcheck       `json:"healthCheck"`
	Helper      Helper            `json:"helper"`
	Host        string            `json:"host"`
	Port        PortConfiguration `yaml:"port" json:"port"`
	Recycle     Recycle           `json:"recycle"`
	Remote      string            `json:"remote"`
	Startup     Startup           `json:"startup"`
	Target      string            `json:"target"`
	Warmup      Warmups           `yaml:"warmup"`
}

type Startup

type Startup struct {
	Timeout int `json:"timeout"`
	Retries int `json:"retries"`
}

type Tag

type Tag struct {
	CheckoutObject
}

type Variables

type Variables map[string]string

Variables are those variables used by a single session. May contain data put by the session build process or the output of build commands

func (Variables) ApplyTo

func (v Variables) ApplyTo(str string) string

ApplyTo allows a string with placeholders to get those placeholders replaced by corresponding variables

type Warmup

type Warmup struct {
	RequestConfiguration `yaml:",inline"`
}

type Warmups

type Warmups struct {
	MaxRetries    int      `yaml:"max_retries"`
	RetryInterval int      `yaml:"retry_interval"`
	URLs          []Warmup `yaml:"urls"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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