slack

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFileNotFound indicates that an artifact was not found.
	ErrFileNotFound = errors.New("file not found")
	// ErrNotParsable indicates that an artifact could not be parsed against the
	// artifact specification.
	ErrNotParsable = errors.New("message not parsable")
	// ErrUnknownFields indicates that an artifact contains an unknown field.
	ErrUnknownFields = errors.New("message contains unknown fields")

	MsgColorGreen  = "#73BF69"
	MsgColorYellow = "#FADE2A"
	MsgColorRed    = "#F2495C"
)
View Source
var (
	// ErrUnknownEmail indicates that an email not from the lunar.app domain
	// is used and no email mapping exists.
	ErrUnknownEmail = errors.New("not a lunarway email")
)

Functions

func ParseUserMappings added in v0.0.15

func ParseUserMappings(users []string) (map[string]string, error)

ParseUserMappings parses the slice users as key-value pairs separated with an equal (=) sign.

If any of the provided mappings are invalid or conflicting mappings are provided an error is returned.

func Persist added in v0.0.6

func Persist(path string, message Message) error

Types

type BuildsOptions added in v0.0.10

type BuildsOptions struct {
	Service       string
	ArtifactID    string
	Branch        string
	CommitSHA     string
	CommitLink    string
	CommitMessage string
	CommitAuthor  string
	CIJobURL      string
	Color         string
}

type Client

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

func NewClient

func NewClient(token string, emailMappings map[string]string) (*Client, error)

func NewMuteableClient added in v0.4.1

func NewMuteableClient(token string, emailMappings map[string]string, muteOptions MuteOptions) (*Client, error)

func (*Client) NotifyAuthorEventProcessed added in v0.1.1

func (c *Client) NotifyAuthorEventProcessed(ctx context.Context, options ReleaseOptions) error

func (*Client) NotifyFluxErrorEvent added in v0.3.0

func (c *Client) NotifyFluxErrorEvent(ctx context.Context, artifactID, env, email, service, errorMessage, errorPath string) error

func (*Client) NotifyFluxEventProcessed added in v0.3.0

func (c *Client) NotifyFluxEventProcessed(ctx context.Context, artifactID, env, email, service string) error

func (*Client) NotifyK8SDeployEvent added in v0.5.0

func (c *Client) NotifyK8SDeployEvent(ctx context.Context, event *http.ReleaseEvent) error

func (*Client) NotifyK8SPodErrorEvent added in v0.5.0

func (c *Client) NotifyK8SPodErrorEvent(ctx context.Context, event *http.PodErrorEvent) error

func (*Client) NotifySlackBuildsChannel added in v0.0.10

func (c *Client) NotifySlackBuildsChannel(options BuildsOptions) error

func (*Client) NotifySlackPolicyFailed added in v0.0.15

func (c *Client) NotifySlackPolicyFailed(ctx context.Context, email, title, errorMessage string) error

func (*Client) NotifySlackPolicySucceeded added in v0.0.40

func (c *Client) NotifySlackPolicySucceeded(ctx context.Context, email, title, message string) error

func (*Client) NotifySlackReleasesChannel added in v0.0.10

func (c *Client) NotifySlackReleasesChannel(ctx context.Context, options ReleaseOptions) error

func (*Client) PostSlackBuildStarted added in v0.0.6

func (c *Client) PostSlackBuildStarted(email, title, titleLink, text, color string) (string, string, error)

func (*Client) UpdateMessage added in v0.0.15

func (c *Client) UpdateMessage(path string, f func(Message) Message) error

UpdateMessage updates the message in the file located at path by applying f on the contents.

The stored Slack build message is updated accordingly.

func (*Client) UpdateSlackBuildStatus added in v0.0.6

func (c *Client) UpdateSlackBuildStatus(channel, title, titleLink, text, color, timestamp string) (string, string, error)

type Message added in v0.0.6

type Message struct {
	Color     string `json:"color,omitempty"`
	Channel   string `json:"channel,omitempty"`
	Text      string `json:"text,omitempty"`
	Title     string `json:"title,omitempty"`
	TitleLink string `json:"titleLink,omitempty"`
	Timestamp string `json:"timestamp,omitempty"`
	Service   string `json:"service,omitempty"`
}

func Get added in v0.0.6

func Get(path string) (Message, error)

type MuteOptions added in v0.4.1

type MuteOptions struct {
	Flux             bool
	Kubernetes       bool
	Policy           bool
	ReleaseProcessed bool
}

type ReleaseOptions added in v0.0.10

type ReleaseOptions struct {
	Service           string
	ArtifactID        string
	CommitSHA         string
	CommitLink        string
	CommitMessage     string
	CommitAuthor      string
	CommitAuthorEmail string
	Releaser          string
	Environment       string
}

Jump to

Keyboard shortcuts

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