Documentation ¶
Index ¶
- Constants
- func DefaultParameterValues(params ...Parameter) cron.JobParameters
- func ExpandParameters(ji *cron.JobInvocation) func(string) string
- func NewEmailMessage(flag string, emailDefaults email.Message, ji *JobInvocation, ...) (email.Message, error)
- func NewServer(jm *cron.JobManager, cfg Config, options ...web.Option) *web.App
- func NewSlackMessage(flag string, defaults slack.Message, ji *JobInvocation, ...) slack.Message
- func ParameterValuesAsEnviron(params cron.JobParameters) (environ []string)
- func ParameterValuesFromForm(parameters []Parameter, formValues url.Values) cron.JobParameters
- func ParameterValuesFromJSON(parameters []Parameter, data []byte) (cron.JobParameters, error)
- func WithJobInvocationOutput(ctx context.Context, jio *JobInvocationOutput) context.Context
- type Config
- type HistoryMemory
- func (hm *HistoryMemory) Add(_ context.Context, ji *JobInvocation) error
- func (hm *HistoryMemory) AddMany(_ context.Context, invocations ...*JobInvocation) error
- func (hm *HistoryMemory) Cull(_ context.Context, jobName string, maxCount int, maxAge time.Duration) error
- func (hm *HistoryMemory) Get(_ context.Context, jobName string) ([]*JobInvocation, error)
- func (hm *HistoryMemory) GetByID(_ context.Context, jobName, invocationID string) (*JobInvocation, error)
- func (hm *HistoryMemory) Initialize(ctx context.Context) error
- type HistoryPostgres
- func (h *HistoryPostgres) Add(ctx context.Context, ji *JobInvocation) error
- func (h *HistoryPostgres) Cull(ctx context.Context, jobName string, maxCount int, maxAge time.Duration) (err error)
- func (h *HistoryPostgres) Get(ctx context.Context, jobName string) (output []*JobInvocation, err error)
- func (h *HistoryPostgres) GetByID(ctx context.Context, jobName, invocationID string) (*JobInvocation, error)
- func (h *HistoryPostgres) Initialize(ctx context.Context) error
- type HistoryProvider
- type Job
- func (job *Job) AddHistoryResult(ctx context.Context, ji *JobInvocation) error
- func (job *Job) Config() cron.JobConfig
- func (job *Job) CullHistory(ctx context.Context) error
- func (job *Job) Debugf(ctx context.Context, format string, args ...interface{})
- func (job *Job) Error(ctx context.Context, err error) error
- func (job *Job) Execute(ctx context.Context) (err error)
- func (job *Job) Lifecycle() (output cron.JobLifecycle)
- func (job *Job) Name() string
- func (job *Job) OnBegin(ctx context.Context)
- func (job *Job) OnBroken(ctx context.Context)
- func (job *Job) OnCancellation(ctx context.Context)
- func (job *Job) OnComplete(ctx context.Context)
- func (job *Job) OnDisabled(ctx context.Context)
- func (job *Job) OnEnabled(ctx context.Context)
- func (job *Job) OnError(ctx context.Context)
- func (job *Job) OnFixed(ctx context.Context)
- func (job *Job) OnLoad(ctx context.Context) error
- func (job *Job) OnSuccess(ctx context.Context)
- func (job *Job) OnUnload(ctx context.Context) error
- func (job *Job) Schedule() cron.Schedule
- type JobConfig
- type JobInvocation
- type JobInvocationOutput
- type JobNotificationsConfig
- func (jnc JobNotificationsConfig) MaxRetriesOrDefault() int
- func (jnc JobNotificationsConfig) OnBeginOrDefault() bool
- func (jnc JobNotificationsConfig) OnBrokenOrDefault() bool
- func (jnc JobNotificationsConfig) OnCancellationOrDefault() bool
- func (jnc JobNotificationsConfig) OnCompleteOrDefault() bool
- func (jnc JobNotificationsConfig) OnDisabledOrDefault() bool
- func (jnc JobNotificationsConfig) OnEnabledOrDefault() bool
- func (jnc JobNotificationsConfig) OnErrorOrDefault() bool
- func (jnc JobNotificationsConfig) OnFixedOrDefault() bool
- func (jnc JobNotificationsConfig) OnSuccessOrDefault() bool
- func (jnc JobNotificationsConfig) RetryWaitOrDefault() time.Duration
- type JobOption
- type JobStats
- type JobViewModel
- type ManagementServer
- type Parameter
- type ParameterOption
- type RetryQueue
- type RetryQueueOption
- func OptRetryQueueMaxAttempts(maxAttempts int) RetryQueueOption
- func OptRetryQueueRetryWait(wait time.Duration) RetryQueueOption
- func OptRetryQueueRetryWaitBackoff(base time.Duration) RetryQueueOption
- func OptRetryQueueRetryWaitProvider(waitProvider func(*RetryQueueWorkItem) time.Duration) RetryQueueOption
- type RetryQueueWorkItem
- type RetryQueueWorker
- func (rqw *RetryQueueWorker) Execute(workItem *RetryQueueWorkItem)
- func (rqw *RetryQueueWorker) NotifyStarted() <-chan struct{}
- func (rqw *RetryQueueWorker) NotifyStopped() <-chan struct{}
- func (rqw *RetryQueueWorker) OnComplete(wi *RetryQueueWorkItem)
- func (rqw *RetryQueueWorker) OnError(wi *RetryQueueWorkItem, err error)
- func (rqw *RetryQueueWorker) OnStart(wi *RetryQueueWorkItem)
- func (rqw *RetryQueueWorker) Start() error
- func (rqw *RetryQueueWorker) Stop() error
- type ShellAction
- type ShellActionConfig
- type ShellActionOption
- type Webhook
Constants ¶
const ( DefaultMaxLogBytes = 10 * (1 << 10) DefaultHistoryPath = "_history" DefaultSkipExpandEnv = false DefaultDiscardOutput = false DefaultHideOutput = false DefaultHistoryMaxCount = 256 DefaultHistoryMaxAge = 0 DefaultHistoryDisabled = false DefaultHistoryPersistenceDisabled = false DefaultSchedule = "* */1 * * * * *" )
Constants and Defaults
const ( // DefaultEmailMimeType is the default email mime type. DefaultEmailMimeType = "text/plain" // DefaultEmailSubjectTemplate is the default subject template. DefaultEmailSubjectTemplate = `{{.Var "jobName" }} :: {{ .Var "flag" }}{{ if .HasVar "elapsed" }} ({{ .Var "elapsed" }} elapsed){{end}}` // DefaultEmailHTMLBodyTemplate is the default email html body template. DefaultEmailHTMLBodyTemplate = `` /* 853-byte string literal not displayed */ // DefaultEmailTextBodyTemplate is the default body template. DefaultEmailTextBodyTemplate = `` /* 231-byte string literal not displayed */ )
const (
ShellActionLogFlag = "shell.action"
)
Logger Constants
Variables ¶
This section is empty.
Functions ¶
func DefaultParameterValues ¶
func DefaultParameterValues(params ...Parameter) cron.JobParameters
DefaultParameterValues pulls the default parameter values off a set of jobkit parameters.
func ExpandParameters ¶
func ExpandParameters(ji *cron.JobInvocation) func(string) string
ExpandParameters returns a new parameter expander for a given job invocation.
func NewEmailMessage ¶
func NewEmailMessage(flag string, emailDefaults email.Message, ji *JobInvocation, options ...email.MessageOption) (email.Message, error)
NewEmailMessage returns a new email message.
func NewServer ¶
NewServer returns a new management server that lets you trigger jobs or look at job statuses via. a json api.
func NewSlackMessage ¶
func NewSlackMessage(flag string, defaults slack.Message, ji *JobInvocation, options ...slack.MessageOption) slack.Message
NewSlackMessage returns a new job started message.
func ParameterValuesAsEnviron ¶
func ParameterValuesAsEnviron(params cron.JobParameters) (environ []string)
ParameterValuesAsEnviron returns params as environment values, i.e. key=value.
func ParameterValuesFromForm ¶
func ParameterValuesFromForm(parameters []Parameter, formValues url.Values) cron.JobParameters
ParameterValuesFromForm creates a parameter values set from url values.
func ParameterValuesFromJSON ¶
func ParameterValuesFromJSON(parameters []Parameter, data []byte) (cron.JobParameters, error)
ParameterValuesFromJSON creates a parameter values set from json data.
func WithJobInvocationOutput ¶
func WithJobInvocationOutput(ctx context.Context, jio *JobInvocationOutput) context.Context
WithJobInvocationOutput adds a job invocation to a context.
Types ¶
type Config ¶
type Config struct { // Title is a descriptive title for the jobkit instance. // It defaults to `Jobkit` Title string `yaml:"title"` // UseViewFiles indicates if we should use local view files from the disk. UseViewFiles *bool `yaml:"useViewFiles"` // Cron is the cron manager config. Cron JobConfig `yaml:"cron"` // Email sets email defaults. EmailDefaults email.Message `yaml:"emailDefaults"` // Logger is the logger config. Logger logger.Config `yaml:"logger"` // Web is the web config used for the management server. Web web.Config `yaml:"web"` // SMTP is the smtp options. SMTP email.SMTPSender `yaml:"smtp"` // Datadog configures the datadog client. Datadog datadog.Config `yaml:"datadog"` // Slack configures the slack webhook sender. Slack slack.Config `yaml:"slack"` // Sentry confgures the sentry error collector. Sentry sentry.Config `yaml:"sentry"` // DB controls database connections for the job manager. DB db.Config `yaml:"db"` }
Config is the jobkit config.
func (Config) TitleOrDefault ¶
TitleOrDefault returns a property or a default.
func (Config) UseViewFilesOrDefault ¶
UseViewFilesOrDefault returns a value or a default.
type HistoryMemory ¶
type HistoryMemory struct { sync.RWMutex History map[string][]*JobInvocation Lookup map[string]*JobInvocation }
HistoryMemory is a memory backed history store.
func (*HistoryMemory) Add ¶
func (hm *HistoryMemory) Add(_ context.Context, ji *JobInvocation) error
Add adds a result.
func (*HistoryMemory) AddMany ¶
func (hm *HistoryMemory) AddMany(_ context.Context, invocations ...*JobInvocation) error
AddMany adds multiple invocations to the history store.
func (*HistoryMemory) Cull ¶
func (hm *HistoryMemory) Cull(_ context.Context, jobName string, maxCount int, maxAge time.Duration) error
Cull culls history.
func (*HistoryMemory) Get ¶
func (hm *HistoryMemory) Get(_ context.Context, jobName string) ([]*JobInvocation, error)
Get returns all history for a given job.
func (*HistoryMemory) GetByID ¶
func (hm *HistoryMemory) GetByID(_ context.Context, jobName, invocationID string) (*JobInvocation, error)
GetByID gets a job invocation by ID.
func (*HistoryMemory) Initialize ¶
func (hm *HistoryMemory) Initialize(ctx context.Context) error
Initialize initializes the backing maps.
type HistoryPostgres ¶
type HistoryPostgres struct { Conn *db.Connection Tx *sql.Tx }
HistoryPostgres implements a sqlite history provider.
func (*HistoryPostgres) Add ¶
func (h *HistoryPostgres) Add(ctx context.Context, ji *JobInvocation) error
Add adds a result.
func (*HistoryPostgres) Cull ¶
func (h *HistoryPostgres) Cull(ctx context.Context, jobName string, maxCount int, maxAge time.Duration) (err error)
Cull culls history.
func (*HistoryPostgres) Get ¶
func (h *HistoryPostgres) Get(ctx context.Context, jobName string) (output []*JobInvocation, err error)
Get gets all results for a given job.
func (*HistoryPostgres) GetByID ¶
func (h *HistoryPostgres) GetByID(ctx context.Context, jobName, invocationID string) (*JobInvocation, error)
GetByID gets a specific result.
func (*HistoryPostgres) Initialize ¶
func (h *HistoryPostgres) Initialize(ctx context.Context) error
Initialize creates the schema for the provider.
type HistoryProvider ¶
type HistoryProvider interface { Initialize(ctx context.Context) error Add(context.Context, *JobInvocation) error Get(context.Context, string) ([]*JobInvocation, error) GetByID(context.Context, string, string) (*JobInvocation, error) Cull(context.Context, string, int, time.Duration) error }
HistoryProvider is a provider for jobkit history specifically.
type Job ¶
type Job struct { Job cron.Job JobConfig JobConfig JobSchedule cron.Schedule Log logger.Log StatsClient stats.Collector SlackDefaults slack.Message EmailDefaults email.Message WebhookDefaults Webhook SlackClient slack.Sender SentryClient sentry.Sender EmailClient email.Sender NotificationsQueueEmail *RetryQueue NotificationsQueueSlack *RetryQueue NotificationsQueueWebhook *RetryQueue HistoryProvider HistoryProvider }
Job is the main job body.
func MustNewJob ¶
MustNewJob returns a new job with a given set of options and panics if ther is an error.
func (*Job) AddHistoryResult ¶
func (job *Job) AddHistoryResult(ctx context.Context, ji *JobInvocation) error
AddHistoryResult adds an item to history and culls old items.
func (*Job) Config ¶
Config implements job config provider. One specific consideration is it merges the inner job's config parameters with the config parameters found on the wrapping jobkit job config.
func (*Job) CullHistory ¶
CullHistory triggers the history provider cull.
func (*Job) Lifecycle ¶
func (job *Job) Lifecycle() (output cron.JobLifecycle)
Lifecycle implements cron.LifecycleProvider.
func (*Job) OnCancellation ¶
OnCancellation is a lifecycle event handler.
func (*Job) OnComplete ¶
OnComplete is a lifecycle event handler.
func (*Job) OnDisabled ¶
OnDisabled is a lifecycle event handler.
type JobConfig ¶
type JobConfig struct { cron.JobConfig `yaml:",inline"` ShellActionConfig `yaml:",inline"` Name string `yaml:"name"` Schedule string `yaml:"schedule"` HistoryPath string `yaml:"historyPath"` HistoryDisabled *bool `yaml:"historyDisabled"` HistoryMaxAge *time.Duration `yaml:"historyMaxAge"` HistoryMaxCount *int `yaml:"historyMaxCount"` Parameters []Parameter `yaml:"parameters"` Notifications JobNotificationsConfig `yaml:"notifications"` }
JobConfig is something you can use to give your jobs some knobs to turn from configuration. You can use this job config by embedding it into your larger job config struct.
func (JobConfig) HistoryDisabledOrDefault ¶
HistoryDisabledOrDefault returns a value or a default.
func (JobConfig) HistoryMaxAgeOrDefault ¶
HistoryMaxAgeOrDefault returns a value or a default.
func (JobConfig) HistoryMaxCountOrDefault ¶
HistoryMaxCountOrDefault returns a value or a default.
func (JobConfig) HistoryPathOrDefault ¶
HistoryPathOrDefault returns a value or a default.
func (JobConfig) ScheduleOrDefault ¶
ScheduleOrDefault returns a value or a default.
type JobInvocation ¶
type JobInvocation struct { cron.JobInvocation JobInvocationOutput }
JobInvocation is a serialized form of a job invocation.
func NewJobInvocation ¶
func NewJobInvocation(ji *cron.JobInvocation) *JobInvocation
NewJobInvocation creates a new jobkit job invocation from a cron job invocation.
func (JobInvocation) MarshalJSON ¶
func (ji JobInvocation) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*JobInvocation) UnmarshalJSON ¶
func (ji *JobInvocation) UnmarshalJSON(contents []byte) error
UnmarshalJSON unmarhsals
type JobInvocationOutput ¶
type JobInvocationOutput struct { Output *bufferutil.Buffer OutputHandlers *bufferutil.BufferHandlers }
JobInvocationOutput is a wrapping job invocation.
func GetJobInvocationOutput ¶
func GetJobInvocationOutput(ctx context.Context) *JobInvocationOutput
GetJobInvocationOutput gets a job invocation from a context.
func NewJobInvocationOutput ¶
func NewJobInvocationOutput() *JobInvocationOutput
NewJobInvocationOutput returns a new job invocation output.
type JobNotificationsConfig ¶
type JobNotificationsConfig struct { Slack slack.Message `yaml:"slack"` // Email holds the message defaults for email notifications. Email email.Message `yaml:"email"` // Webhook set a webhook target for notifications. Webhook Webhook `yaml:"webhook"` // MaxRetries is the maximum number of retries before we give up on a notification. MaxRetries *int `yaml:"maxRetries"` // RetryWait is the time between attempts. RetryWait *time.Duration `yaml:"retryWait"` // OnBegin governs if we should send notifications job start. OnBegin *bool `yaml:"onBegin"` // OnComplete governs if we should send notifications on any success. OnComplete *bool `yaml:"onComplete"` // OnSuccess governs if we should send notifications on any success. OnSuccess *bool `yaml:"onSuccess"` // OnFailure governs if we should send notifications on any failure. OnError *bool `yaml:"onError"` // OnCancellation governs if we should send notifications on cancellation. OnCancellation *bool `yaml:"onCancellation"` // OnBroken governs if we should send notifications on a success => failure transition. OnBroken *bool `yaml:"onBroken"` // OnFixed governs if we should send notifications on a failure => success transition. OnFixed *bool `yaml:"onFixed"` // OnEnabled governs if we should send notifications when a job is enabled. OnEnabled *bool `yaml:"onEnabled"` // OnDisabled governs if we should send notifications when a job is disabled. OnDisabled *bool `yaml:"onDisabled"` }
JobNotificationsConfig are the notification options for a job.
func (JobNotificationsConfig) MaxRetriesOrDefault ¶
func (jnc JobNotificationsConfig) MaxRetriesOrDefault() int
MaxRetriesOrDefault returns a value or a default.
func (JobNotificationsConfig) OnBeginOrDefault ¶
func (jnc JobNotificationsConfig) OnBeginOrDefault() bool
OnBeginOrDefault returns a value or a default.
func (JobNotificationsConfig) OnBrokenOrDefault ¶
func (jnc JobNotificationsConfig) OnBrokenOrDefault() bool
OnBrokenOrDefault returns a value or a default.
func (JobNotificationsConfig) OnCancellationOrDefault ¶
func (jnc JobNotificationsConfig) OnCancellationOrDefault() bool
OnCancellationOrDefault returns a value or a default.
func (JobNotificationsConfig) OnCompleteOrDefault ¶
func (jnc JobNotificationsConfig) OnCompleteOrDefault() bool
OnCompleteOrDefault returns a value or a default.
func (JobNotificationsConfig) OnDisabledOrDefault ¶
func (jnc JobNotificationsConfig) OnDisabledOrDefault() bool
OnDisabledOrDefault returns a value or a default.
func (JobNotificationsConfig) OnEnabledOrDefault ¶
func (jnc JobNotificationsConfig) OnEnabledOrDefault() bool
OnEnabledOrDefault returns a value or a default.
func (JobNotificationsConfig) OnErrorOrDefault ¶
func (jnc JobNotificationsConfig) OnErrorOrDefault() bool
OnErrorOrDefault returns a value or a default.
func (JobNotificationsConfig) OnFixedOrDefault ¶
func (jnc JobNotificationsConfig) OnFixedOrDefault() bool
OnFixedOrDefault returns a value or a default.
func (JobNotificationsConfig) OnSuccessOrDefault ¶
func (jnc JobNotificationsConfig) OnSuccessOrDefault() bool
OnSuccessOrDefault returns a value or a default.
func (JobNotificationsConfig) RetryWaitOrDefault ¶
func (jnc JobNotificationsConfig) RetryWaitOrDefault() time.Duration
RetryWaitOrDefault returns a value or a default.
type JobOption ¶
JobOption is a function that mutates a job.
func OptJobHistory ¶
func OptJobHistory(provider HistoryProvider) JobOption
OptJobHistory sets the job history provider.
func OptJobParsedSchedule ¶
OptJobParsedSchedule sets the schedule to a parsed cron string.
type JobStats ¶
type JobStats struct { SuccessRate float64 `json:"successRate"` OutputBytes int `json:"outputBytes"` RunsTotal int `json:"runsTotal"` RunsSuccessful int `json:"runsSuccessful"` RunsErrored int `json:"runsErrored"` RunsCancelled int `json:"runsCancelled"` ElapsedMax time.Duration `json:"elapsedMax"` ElapsedMin time.Duration `json:"elapsedMin"` Elapsed50th time.Duration `json:"elapsed50th"` Elapsed95th time.Duration `json:"elapsed95th"` }
JobStats represent stats about a job scheduler.
func HistoryStats ¶
func HistoryStats(history []*JobInvocation) JobStats
HistoryStats returns job history stats.
type JobViewModel ¶
type JobViewModel struct { Name string Labels map[string]string Disabled bool Config JobConfig Stats JobStats Schedule cron.Schedule NextRuntime time.Time Current *JobInvocation Last *JobInvocation History []*JobInvocation HistoryLookup map[string]*JobInvocation }
JobViewModel is a viewmodel that represents a job.
func FilterJobViewModels ¶
func FilterJobViewModels(jobs []*JobViewModel, predicate func(*JobViewModel) bool) (output []*JobViewModel)
FilterJobViewModels filters a set of job view models by a predicate.
func NewJobViewModel ¶
func NewJobViewModel(js *cron.JobScheduler) (*JobViewModel, error)
NewJobViewModel returns a job view model from a job scheduler.
func NewJobViewModels ¶
func NewJobViewModels(jobs map[string]*cron.JobScheduler) ([]*JobViewModel, error)
NewJobViewModels returns the job view models.
type ManagementServer ¶
type ManagementServer struct { Config Config Cron *cron.JobManager }
ManagementServer is the jobkit management server.
func (ManagementServer) Register ¶
func (ms ManagementServer) Register(app *web.App)
Register registers the management server.
func (ManagementServer) ViewPaths ¶
func (ms ManagementServer) ViewPaths() []string
ViewPaths returns the view paths for the management server.
type Parameter ¶
type Parameter struct { Label string `yaml:"label"` // label will be a descriptive label next to the input Name string `yaml:"name"` // name is the post form key on submission Required bool `yaml:"required"` // indicates the value for this parameter must be set Placeholder string `yaml:"placeholder"` // placeholder is used to show ghost text in an input. Value string `yaml:"value"` // value is the default value or the provided value. Options []ParameterOption `yaml:"options"` // options are select input options; if they are set the param will be a select }
Parameter is an option for a job invocation.
func (Parameter) RenderInput ¶
RenderInput returns the html string for the input.
type ParameterOption ¶
ParameterOption is an option for a parameter.
type RetryQueue ¶
type RetryQueue struct { Parallelism int MaxAttempts int RetryWaitProvider func(*RetryQueueWorkItem) time.Duration Latch *async.Latch Log logger.Log Work chan *RetryQueueWorkItem Action async.WorkAction WaitHandles map[string]*async.Latch WaitHandlesMux sync.Mutex }
RetryQueue is a queue that retries on error.
func NewRetryQueue ¶
func NewRetryQueue(action async.WorkAction, options ...RetryQueueOption) *RetryQueue
NewRetryQueue returns a new retry queue.
func (*RetryQueue) Add ¶
func (rq *RetryQueue) Add(ctx context.Context, item interface{})
Add adds an item to the queue.
func (*RetryQueue) NotifyStarted ¶
func (rq *RetryQueue) NotifyStarted() <-chan struct{}
NotifyStarted returns the started notification channel.
func (*RetryQueue) NotifyStopped ¶
func (rq *RetryQueue) NotifyStopped() <-chan struct{}
NotifyStopped returns the stopped notification channel.
type RetryQueueOption ¶
type RetryQueueOption func(*RetryQueue)
RetryQueueOption is an option or mutator for a retry queue.
func OptRetryQueueMaxAttempts ¶
func OptRetryQueueMaxAttempts(maxAttempts int) RetryQueueOption
OptRetryQueueMaxAttempts sets the retry queue max attempts.
func OptRetryQueueRetryWait ¶
func OptRetryQueueRetryWait(wait time.Duration) RetryQueueOption
OptRetryQueueRetryWait sets the retry wait to a const value.
func OptRetryQueueRetryWaitBackoff ¶
func OptRetryQueueRetryWaitBackoff(base time.Duration) RetryQueueOption
OptRetryQueueRetryWaitBackoff sets the retry wait to be a backoff based on a base and the number of attempts.
func OptRetryQueueRetryWaitProvider ¶
func OptRetryQueueRetryWaitProvider(waitProvider func(*RetryQueueWorkItem) time.Duration) RetryQueueOption
OptRetryQueueRetryWaitProvider sets the retry wait provider.
type RetryQueueWorkItem ¶
RetryQueueWorkItem is a work item for the retry queue.
type RetryQueueWorker ¶
type RetryQueueWorker struct { Latch *async.Latch Action async.WorkAction Work chan *RetryQueueWorkItem OnStartHandler func(*RetryQueueWorkItem) OnCompleteHandler func(*RetryQueueWorkItem) OnErrorHandler func(*RetryQueueWorkItem, error) }
RetryQueueWorker is a background worker for a retry queue.
func (*RetryQueueWorker) Execute ¶
func (rqw *RetryQueueWorker) Execute(workItem *RetryQueueWorkItem)
Execute handles a work item.
func (*RetryQueueWorker) NotifyStarted ¶
func (rqw *RetryQueueWorker) NotifyStarted() <-chan struct{}
NotifyStarted returns the started notification channel.
func (*RetryQueueWorker) NotifyStopped ¶
func (rqw *RetryQueueWorker) NotifyStopped() <-chan struct{}
NotifyStopped returns the stopped notification channel.
func (*RetryQueueWorker) OnComplete ¶
func (rqw *RetryQueueWorker) OnComplete(wi *RetryQueueWorkItem)
OnComplete handles on complete steps.
func (*RetryQueueWorker) OnError ¶
func (rqw *RetryQueueWorker) OnError(wi *RetryQueueWorkItem, err error)
OnError handles on error steps.
func (*RetryQueueWorker) OnStart ¶
func (rqw *RetryQueueWorker) OnStart(wi *RetryQueueWorkItem)
OnStart handles on start steps.
func (*RetryQueueWorker) Start ¶
func (rqw *RetryQueueWorker) Start() error
Start starts the retry queue worker.
func (*RetryQueueWorker) Stop ¶
func (rqw *RetryQueueWorker) Stop() error
Stop stops the retry queue worker.
type ShellAction ¶
type ShellAction struct { Log logger.Log Config ShellActionConfig }
ShellAction captures options for a shell action.
func NewShellAction ¶
func NewShellAction(exec []string, opts ...ShellActionOption) ShellAction
NewShellAction returns a new shell action.
type ShellActionConfig ¶
type ShellActionConfig struct { // Exec is a job body that shells out for its action. Exec []string `yaml:"exec"` // SkipExpandEnv skips expanding environment variables in the exec segments. SkipExpandEnv *bool `yaml:"skipExpandEnv"` // DiscardOutput skips setting up output buffers for job invocations. DiscardOutput *bool `yaml:"discardOutput"` // HideOutput skips writing job output to standard output and standard error. HideOutput *bool `yaml:"hideOutput"` }
ShellActionConfig is a config for shell actions.
func (ShellActionConfig) DiscardOutputOrDefault ¶
func (se ShellActionConfig) DiscardOutputOrDefault() bool
DiscardOutputOrDefault returns a value or a default.
func (ShellActionConfig) HideOutputOrDefault ¶
func (se ShellActionConfig) HideOutputOrDefault() bool
HideOutputOrDefault returns a value or a default.
func (ShellActionConfig) SkipExpandEnvOrDefault ¶
func (se ShellActionConfig) SkipExpandEnvOrDefault() bool
SkipExpandEnvOrDefault returns a value or a default.
type ShellActionOption ¶
type ShellActionOption func(*ShellAction)
ShellActionOption is a mutator for a shell action.
func OptShellActionConfig ¶
func OptShellActionConfig(cfg ShellActionConfig) ShellActionOption
OptShellActionConfig sets the shell action config.
func OptShellActionLog ¶
func OptShellActionLog(log logger.Log) ShellActionOption
OptShellActionLog sets the shell action logger.
type Webhook ¶
type Webhook struct { Method string `yaml:"method"` URL string `yaml:"url"` Headers map[string]string `yaml:"headers"` Body string `yaml:"body"` }
Webhook is a notification type.
func (Webhook) MethodOrDefault ¶
MethodOrDefault returns the webhoook method.
Source Files ¶
- config.go
- constants.go
- email.go
- expand_parameters.go
- generate.go
- history_memory.go
- history_postgres.go
- history_provider.go
- job.go
- job_config.go
- job_invocation.go
- job_invocation_output.go
- job_notifications_config.go
- job_stats.go
- job_viewmodel.go
- management_server.go
- parameter.go
- parameter_values.go
- retry_queue.go
- shell_action.go
- shell_action_config.go
- slack.go
- webhook.go