notification

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GHWorkflowTaskName is the name of the GitHub action request task
	GHWorkflowTaskName string = "github-workflow"
	// DefaultRef is default github reference (branch)
	DefaultRef string = "master"
)
View Source
const (
	// NewLine is a newline character
	NewLine string = "\n"
	// Space is a space character
	Space string = " "
)
View Source
const (
	// HTTPTaskName is the name of the HTTP request task
	HTTPTaskName string = "http"
)
View Source
const (

	// LibraryName is the name of the task library this package implements
	LibraryName string = "notification"
)
View Source
const (
	// SlackTaskName is the name of the task this file implements
	SlackTaskName string = "slack"
)

Variables

This section is empty.

Functions

func Bold

func Bold(text string) string

Bold formats a string as bold in markdown

func Failed

func Failed(e *tasks.Experiment) bool

Failed returns true if the experiment has failed; false otherwise

func Italic

func Italic(text string) string

Italic formats a string as italic in markdown

func MakeGHWorkflowTask

func MakeGHWorkflowTask(t *v2alpha2.TaskSpec) (tasks.Task, error)

MakeGHWorkflowTask converts an spec to a task.

func MakeHTTPTask added in v0.1.21

func MakeHTTPTask(t *v2alpha2.TaskSpec) (tasks.Task, error)

MakeHTTPTask converts an spec to a task.

func MakeSlackTask

func MakeSlackTask(t *v2alpha2.TaskSpec) (tasks.Task, error)

MakeSlackTask converts an sampletask spec into an base.Task.

func MakeTask

func MakeTask(t *v2alpha2.TaskSpec) (tasks.Task, error)

MakeTask constructs a Task from a TaskMeta or returns an error if any.

func Name

func Name(e *tasks.Experiment) string

Name returns the name of the experiment in the form namespace/name

func SlackMessage

func SlackMessage(e *tasks.Experiment) string

SlackMessage constructs the slack message to post

func Stage

func Stage(e *tasks.Experiment) string

Stage returns the stage (status.stage) of an experiment

func Versions

func Versions(e *tasks.Experiment) string

Versions returns a comma separated list of version names

func Winner

func Winner(e *tasks.Experiment) string

Winner returns the name of the winning version, if one. Otherwise "not found"

Types

type GHWorkflowInputs

type GHWorkflowInputs struct {
	Repository string                `json:"repository" yaml:"repository"`
	Workflow   string                `json:"workflow" yaml:"workflow"`
	Secret     string                `json:"secret" yaml:"secret"`
	Ref        *string               `json:"ref,omitempty" yaml:"ref,omitempty"`
	WFInputs   []v2alpha2.NamedValue `json:"inputs,omitempty" yaml:"inputs,omitempty"`
	Inputs     `json:",inline" yaml:",inline"`
}

GHWorkflowInputs contain the name and arguments of the task.

type GHWorkflowTask

type GHWorkflowTask struct {
	tasks.TaskMeta `json:",inline" yaml:",inline"`
	With           GHWorkflowInputs `json:"with" yaml:"with"`
}

GHWorkflowTask encapsulates the task.

func (*GHWorkflowTask) Run

func (t *GHWorkflowTask) Run(ctx context.Context) error

Run the task. Ignores failures unless the task indicates ignoreFailures: false

func (*GHWorkflowTask) ToHTTPTask

func (t *GHWorkflowTask) ToHTTPTask() *HTTPTask

ToHTTPTask converts a GHWorkflowTask task to a HTTPTask

type HTTPInputs added in v0.1.21

type HTTPInputs struct {
	URL      string                `json:"URL" yaml:"URL"`
	Method   *v2alpha2.MethodType  `json:"method,omitempty" yaml:"method,omitempty"`
	AuthType *v2alpha2.AuthType    `json:"authType,omitempty" yaml:"authType,omitempty"`
	Secret   *string               `json:"secret,omitempty" yaml:"secret,omitempty"`
	Headers  []v2alpha2.NamedValue `json:"headers,omitempty" yaml:"headers,omitempty"`
	Body     *string               `json:"body,omitempty" yaml:"body,omitempty"`
	Inputs   `json:",inline" yaml:",inline"`
}

HTTPInputs contain the name and arguments of the task.

type HTTPTask added in v0.1.21

type HTTPTask struct {
	tasks.TaskMeta `json:",inline" yaml:",inline"`
	With           HTTPInputs `json:"with" yaml:"with"`
}

HTTPTask encapsulates the task.

func (*HTTPTask) Run added in v0.1.21

func (t *HTTPTask) Run(ctx context.Context) error

Run the task. Ignores failures unless the task indicates ignoreFailures: false

type Inputs added in v0.1.21

type Inputs struct {
	IgnoreFailure *bool `json:"ignoreFailure,omitempty" yaml:"ignoreFailure,omitempty"`
}

Inputs contains inputs common to all notifations. Should be included in the indivodual input structs via inline

type SlackTask

type SlackTask struct {
	tasks.TaskMeta `json:",inline" yaml:",inline"`
	// If there are any additional inputs
	With SlackTaskInputs `json:"with" yaml:"with"`
}

SlackTask encapsulates a command that can be executed.

func (*SlackTask) Run

func (t *SlackTask) Run(ctx context.Context) error

Run the task. This suppresses all errors so that the task will always succeed. In this way, any failure does not cause failure of the enclosing experiment.

type SlackTaskInputs

type SlackTaskInputs struct {
	Channel string `json:"channel" yaml:"channel"`
	Secret  string `json:"secret" yaml:"secret"`
	Inputs  `json:",inline" yaml:",inline"`
}

SlackTaskInputs is the object corresponding to the expcted inputs to the task

Jump to

Keyboard shortcuts

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