Documentation
¶
Overview ¶
Package webhooks provides the data structures and utilities related to the hooks
Index ¶
- Variables
- func AddProvider(name string, initProvider func())
- func AddRouteHandler(name string, route func(router chi.Router))
- func Hook(r Ref)
- func MustRegisterAll()
- func ParseSecrets(providername, secretList, envname string) [][]byte
- func RouteHandlers(r chi.Router)
- type Ref
- type RefID
- type RevID
- type URLSafeGitID
- type URLSafeRefID
- type URLSafeRevID
Constants ¶
This section is empty.
Variables ¶
View Source
var Hooks = make(chan Ref)
Hooks is a channel of incoming webhooks
View Source
var Providers = make(map[string]func())
Providers is a map of the git webhook providers
View Source
var Webhooks = make(map[string]func(chi.Router))
Webhooks is a map of routes
Functions ¶
func AddProvider ¶
func AddProvider(name string, initProvider func())
AddProvider registers a git webhook provider
func AddRouteHandler ¶
AddRouteHandler registers a git webhook route
func ParseSecrets ¶
ParseSecrets grabs secrets from the ENV at runtime
func RouteHandlers ¶
RouteHandlers registers the webhook functions to the route
Types ¶
type Ref ¶
type Ref struct { RepoID string `json:"repo_id"` Timestamp time.Time `json:"timestamp"` HTTPSURL string `json:"https_url"` SSHURL string `json:"ssh_url"` Rev string `json:"rev"` Ref string `json:"ref"` // refs/tags/v0.0.1, refs/heads/master RefType string `json:"ref_type"` // tag, branch RefName string `json:"ref_name"` Owner string `json:"repo_owner"` Repo string `json:"repo_name"` }
Ref represents typical git webhook info such as:
HTTPSURL ex: https://git@git.example.com/example/example.git SSHURL ex: ssh://git@git.example.com/example/example.git Rev ex: 00000000 Ref ex: /refs/heads/master Branch ex: master Repo ex: example Org ex: example
func (*Ref) GetURLSafeRefID ¶
func (h *Ref) GetURLSafeRefID() URLSafeRefID
GetURLSafeRefID returns the URL-safe Base64 encoding of the RefID
func (*Ref) GetURLSafeRevID ¶
func (h *Ref) GetURLSafeRevID() URLSafeRevID
GetURLSafeRevID returns the URL-safe Base64 encoding of the RevID
Click to show internal directories.
Click to hide internal directories.