pkg

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DDEV-Live bot message marker
	MessageMarker = "<!-- ddev-live bot -->"

	// Ping/pong
	Ping = "/ddev-live-ping"

	// Print help message for users calling the command
	Help = "/ddev-live-help"

	// Print help message on PR open, only when applicable
	HelpOnPROpen = "/ddev-live-help-on-pr-open"

	// Create preview site
	PreviewSite = "/ddev-live-preview-site"

	// Delete preview site, always provides verbose response event when no site exists
	DeletePreviewSite = "/ddev-live-delete-preview-site"

	// Close preview site, provides output only in case a preview site existed. This is for PR closing.
	ClosePreviewSite = "/ddev-live-close-preview-site"
)

These strings contain supported `/ddev-live-*` commands in PR/MR comments

Variables

View Source
var (
	CreatePreviewSiteCounter = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "bot_create_preview_site_total",
		Help: "Total number of create preview site command invocations",
	}, []string{"bot", "status"})

	DeletePreviewSiteCounter = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "bot_delete_preview_site_total",
		Help: "Total number of delete preview site command invocations",
	}, []string{"bot", "action", "status"})

	HelpPreviewSiteCounter = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "bot_help_preview_site_total",
		Help: "Total number of help command invocations",
	}, []string{"bot", "action"})
)

Prometheus metrics for bot command invocations

Functions

func AnalyticsClient added in v0.0.12

func AnalyticsClient(botType, appId, writeKey string) *analytics

func IsBotMessage added in v0.0.5

func IsBotMessage(msg string) bool

func RepoURLNormalize added in v0.0.5

func RepoURLNormalize(url string) string

Types

type Bot

type Bot interface {
	Response(args ResponseRequest) string
	ReceiveUpdate() (UpdateEvent, error)
}

func InitBot

func InitBot(bc Config) (Bot, error)

type Config added in v0.0.12

type Config struct {
	Kubeconfig     *restclient.Config
	Annotation     string
	SiteSuffix     string
	AuthSVCLabels  string
	StopCh         <-chan struct{}
	AnalyticsKey   string
	AnalyticsAppId string
}

type PRLock

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

func NewPRLock

func NewPRLock() *PRLock

func (*PRLock) Lock

func (l *PRLock) Lock(repo string, pr int)

func (*PRLock) Unlock

func (l *PRLock) Unlock(repo string, pr int)

type ResponseRequest

type ResponseRequest struct {
	Email        string
	Title        string
	Body         string
	Trigger      string
	RepoURL      string
	Namespace    string
	OriginBranch string
	CloneBranch  string
	PR           int
	Annotations  map[string]string
}

type UpdateEvent

type UpdateEvent struct {
	Message     string
	PR          int
	RepoURL     string
	Type        string
	Annotations map[string]string
}

Jump to

Keyboard shortcuts

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