slacknotifier

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DestroyApiRequest = models.DestroyApiRequest
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchInfo

type BranchInfo = ghclient.BranchInfo

type ChatNotifier

type ChatNotifier interface {
	Creating(name string, rd *RepoRevisionData) error
	Destroying(name string, rd *RepoRevisionData, reason QADestroyReason) error
	Updating(name string, rd *RepoRevisionData, commitmsg string) error
	Success(name string, hostname string, svcports map[string]int64, k8sNamespace string, rd *RepoRevisionData) error
	Failure(name string, rd *RepoRevisionData, msg string) error
	LockError(rd *RepoRevisionData, msg string) error
}

ChatNotifier destribes an object capable of pushing notifications to a chat service

type CommitStatus

type CommitStatus = ghclient.CommitStatus

type FakeChatNotifier

type FakeChatNotifier struct{}

func (FakeChatNotifier) Creating

func (fcn FakeChatNotifier) Creating(name string, rd *RepoRevisionData) error

func (FakeChatNotifier) Destroying

func (fcn FakeChatNotifier) Destroying(name string, rd *RepoRevisionData, reason QADestroyReason) error

func (FakeChatNotifier) Failure

func (fcn FakeChatNotifier) Failure(name string, rd *RepoRevisionData, msg string) error

func (FakeChatNotifier) LockError

func (fcn FakeChatNotifier) LockError(rd *RepoRevisionData, msg string) error

func (FakeChatNotifier) Success

func (fcn FakeChatNotifier) Success(name string, hostname string, svcports map[string]int64, k8sNamespace string, rd *RepoRevisionData) error

func (FakeChatNotifier) Updating

func (fcn FakeChatNotifier) Updating(name string, rd *RepoRevisionData, commitmsg string) error

type FakeSlackUsernameMapper

type FakeSlackUsernameMapper struct {
	F func(githubUsername string) (string, error)
}

func (*FakeSlackUsernameMapper) UsernameFromGithubUsername

func (fsum *FakeSlackUsernameMapper) UsernameFromGithubUsername(githubUsername string) (string, error)

type QADestroyReason

type QADestroyReason = models.QADestroyReason

type RepoBackedSlackUsernameMapper

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

RepoBackedSlackUsernameMapper concrete implementation of SlackUsernameMapper backed by a git repository

func NewRepoBackedSlackUsernameMapper

func NewRepoBackedSlackUsernameMapper(client RepoClient, repo string, mapPath string, ref string, updateInterval time.Duration) *RepoBackedSlackUsernameMapper

NewRepoBackedSlackUsernameMapper returns an initialized RepoBackedSlackUsernameMapper with the given repo client

func (*RepoBackedSlackUsernameMapper) UsernameFromGithubUsername

func (m *RepoBackedSlackUsernameMapper) UsernameFromGithubUsername(githubUsername string) (string, error)

UsernameFromGithubUsername returns the Slack username for the provided GitHub username or nil

type RepoClient

type RepoClient = ghclient.RepoClient

type RepoRevisionData

type RepoRevisionData = models.RepoRevisionData

type SlackAPIClient

type SlackAPIClient interface {
	PostMessage(channel, text string, params slack.PostMessageParameters) (string, string, error)
}

SlackAPIClient describes the methods we use on slack.Client

type SlackNotifier

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

SlackNotifier is an object that pushes notifications to Slack

func NewSlackNotifier

func NewSlackNotifier(channel string, api SlackAPIClient, usernameMapper SlackUsernameMapper) *SlackNotifier

NewSlackNotifier returns a SlackNotifier using the provided API token

func (*SlackNotifier) Creating

func (sn *SlackNotifier) Creating(name string, rd *RepoRevisionData) error

Creating sends a Slack notification that a new QA is being created

func (*SlackNotifier) Destroying

func (sn *SlackNotifier) Destroying(name string, rd *RepoRevisionData, reason QADestroyReason) error

Destroying sends a Slack notification that an existing QA is being explicitly destroyed

func (*SlackNotifier) Failure

func (sn *SlackNotifier) Failure(name string, rd *RepoRevisionData, msg string) error

Failure sends a Slack notification that a QA operation failed

func (*SlackNotifier) LockError

func (sn *SlackNotifier) LockError(rd *RepoRevisionData, msg string) error

LockError sends a Slack notification that an action for a repo/PR combination couldn't be performed because the lock couldn't be acquired

func (*SlackNotifier) Success

func (sn *SlackNotifier) Success(name string, hostname string, svcports map[string]int64, k8sNamespace string, rd *RepoRevisionData) error

Success sends a Slack notification that an existing QA is up and ready

func (*SlackNotifier) Updating

func (sn *SlackNotifier) Updating(name string, rd *RepoRevisionData, commitmsg string) error

Updating sends a Slack notification that an existing environment is getting replaced by one with new(er) code

type SlackUsernameMapper

type SlackUsernameMapper interface {
	UsernameFromGithubUsername(githubUsername string) (string, error)
}

SlackUsernameMapper maps Github usernames to Slack usernames. If no Slack username is found, an empty string is returned

Jump to

Keyboard shortcuts

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