Example #1
0
// Run stops the execution if the another execution is already running
func (m *Overlap) Run(ctx *core.Context) error {
	if m.NoOverlap && ctx.Job.Running() > 1 {
		ctx.Stop(core.ErrSkippedExecution)
	}

	return ctx.Next()
}
Example #2
0
// Run sends a message to the slack channel, its close stop the exection to
// collect the metrics
func (m *Slack) Run(ctx *core.Context) error {
	err := ctx.Next()
	ctx.Stop(err)

	if ctx.Execution.Failed || !m.SlackOnlyOnError {
		m.pushMessage(ctx)
	}

	return err
}
Example #3
0
// Run save the result of the execution to disk
func (m *Save) Run(ctx *core.Context) error {
	err := ctx.Next()
	ctx.Stop(err)

	if ctx.Execution.Failed || !m.SaveOnlyOnError {
		err := m.saveToDisk(ctx)
		if err != nil {
			ctx.Logger.Errorf("Save error: %q", err)
		}
	}

	return err
}
Example #4
0
// Run sents a email with the result of the execution
func (m *Mail) Run(ctx *core.Context) error {
	err := ctx.Next()
	ctx.Stop(err)

	if ctx.Execution.Failed || !m.MailOnlyOnError {
		err := m.sendMail(ctx)
		if err != nil {
			ctx.Logger.Error("Mail error: %q", err)
		}
	}

	return err
}