Documentation
¶
Overview ¶
Package webhook turns git host deliveries into deploy events. Every host is a Provider: it checks the delivery against the deployment's secret and reports what happened (a push to a branch, or a pull request opening, updating or closing) in one shape the agent acts on.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnsupported = errors.New("webhook event type is not supported") )
Functions ¶
func NormalizeRepo ¶
NormalizeRepo reduces a repository address to host/path.
Types ¶
type Event ¶
Event is a delivery reduced to what a deploy needs. RepoURLs lists every address the host gave for the repository, so it can be matched against the one the deployment was created from.
func (*Event) MatchesRepo ¶
MatchesRepo reports whether any of the event's repository addresses names the same repository as ref, ignoring scheme, credentials, case and a trailing .git. An event with no addresses matches, since the generic hook is bound to one deployment and carries none.
type EventKind ¶
type EventKind string
const ( EventPush EventKind = "push" EventPROpened EventKind = "pr_opened" EventPRSynced EventKind = "pr_synced" EventPRClosed EventKind = "pr_closed" // EventIgnored is a valid delivery the agent has nothing to do for, such // as a tag push, a branch deletion or a label change on a pull request. EventIgnored EventKind = "ignored" )
type Generic ¶
type Generic struct{}
Generic is a deploy hook any CI system can call: X-FlatRun-Token carries the secret and an optional JSON body names the branch or revision to deploy.
type GitHub ¶
type GitHub struct{}
GitHub verifies X-Hub-Signature-256 (HMAC-SHA256 of the body with the hook secret) and handles push and pull_request deliveries.
type GitLab ¶
type GitLab struct{}
GitLab compares X-Gitlab-Token with the hook secret and handles push and merge request deliveries.