Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultVcsUsername = "kubechecks" DefaultVcsEmail = "kubechecks@zapier.com" )
Variables ¶
View Source
var ( // ErrInvalidType is a sentinel error for use in client implementations ErrInvalidType = errors.New("invalid event type") ErrHookNotFound = errors.New("webhook not found") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// PostMessage takes in project name in form "owner/repo" (ie zapier/kubechecks), the PR/MR id, and the actual message
PostMessage(context.Context, PullRequest, string) *msg.Message
// UpdateMessage update a message with new content
UpdateMessage(context.Context, *msg.Message, string) error
// VerifyHook validates a webhook secret and return the body; must be called even if no secret
VerifyHook(*http.Request, string) ([]byte, error)
// ParseHook parses webook payload for valid events
ParseHook(*http.Request, []byte) (PullRequest, error)
// CommitStatus sets a status for a specific commit on the remote VCS
CommitStatus(context.Context, PullRequest, pkg.CommitState) error
// GetHookByUrl gets a webhook by url
GetHookByUrl(ctx context.Context, repoName, webhookUrl string) (*WebHookConfig, error)
// CreateHook creates a webhook that points at kubechecks
CreateHook(ctx context.Context, repoName, webhookUrl, webhookSecret string) error
// GetName returns the VCS client name (e.g. "github" or "gitlab")
GetName() string
// TidyOutdatedComments either by hiding or deleting them
TidyOutdatedComments(context.Context, PullRequest) error
// LoadHook creates an EventRequest from the ID of an actual request
LoadHook(ctx context.Context, repoAndId string) (PullRequest, error)
Username() string
Email() string
ToEmoji(pkg.CommitState) string
}
Client represents a VCS client
type PullRequest ¶ added in v1.5.0
type PullRequest struct {
BaseRef string // base ref is the branch that the PR is being merged into
HeadRef string // head ref is the branch that the PR is coming from
DefaultBranch string // Some repos have default branches we need to capture
Remote string // Remote address
CloneURL string // Where we clone the repo from
Name string // Name of the repo
Owner string // Owner of the repo (in Gitlab this is the namespace)
CheckID int // MR/PR id that generated this Repo
SHA string // SHA of the MR/PRs head
FullName string // Owner/Name combined (ie zapier/kubechecks)
Username string // Username of auth'd client
Email string // Email of auth'd client
Labels []string // Labels associated with the MR/PR
Config config.ServerConfig
}
PullRequest represents an PR/MR
type WebHookConfig ¶
Click to show internal directories.
Click to hide internal directories.