inertia: Index | Files

package webhook

import ""

Package webhook contains Inertia's webhook parsing code


Package Files

bitbucket.go bitbucket_push.go doc.go docker.go github.go github_push.go gitlab.go gitlab_push.go parse.go verify.go


const (
    PushEvent EventType = "push"
    PullEvent EventType = "pull"
    PingEvent EventType = "ping"

    // Hosts
    GitHub    = "github"
    GitLab    = "gitlab"
    BitBucket = "bitbucket"

Constants for the generic webhook interface


var (
    GithubPingHeader = "ping"
    GithubPushHeader = "push"

x-github-event header values

var (
    BitbucketPushHeader = "repo:push"

x-event-key header values

var (
    GitlabPushHeader = "Push Hook"

x-gitlab-event header values

func Type Uses

func Type(h http.Header) (host string, eventHeader string)

Type returns the git host and event header of given webhook request

func Verify Uses

func Verify(host, key string, h http.Header, body []byte) (err error)

Verify ensures the payload's integrity and returns and error if anything doesn't match up

type DockerWebhook Uses

type DockerWebhook struct {
    // contains filtered or unexported fields

DockerWebhook represents a push to DockerHub see

func ParseDocker Uses

func ParseDocker(r *http.Request) (*DockerWebhook, error)

ParseDocker takes in a Docker webhook request and parses it

func (*DockerWebhook) GetName Uses

func (d *DockerWebhook) GetName() string

GetName returns the namespace

func (*DockerWebhook) GetOwner Uses

func (d *DockerWebhook) GetOwner() string

GetOwner returns the repository owner

func (*DockerWebhook) GetPusher Uses

func (d *DockerWebhook) GetPusher() string

GetPusher returns the user that pushed to DockerHub

func (*DockerWebhook) GetRepoName Uses

func (d *DockerWebhook) GetRepoName() string

GetRepoName returns the full repository name

func (*DockerWebhook) GetTag Uses

func (d *DockerWebhook) GetTag() string

GetTag returns the tag that was pushed to DockerHub

type EventType Uses

type EventType string

EventType denotes types of webhook events

type Payload Uses

type Payload interface {
    GetSource() string
    GetEventType() EventType
    GetRepoName() string
    GetRef() string
    GetGitURL() string
    GetSSHURL() string

Payload represents a generic webhook payload

func Parse Uses

func Parse(host, eventHeader string, h http.Header, body []byte) (Payload, error)

Parse takes in a webhook request and parses it into one of the supported types

Package webhook imports 7 packages (graph) and is imported by 1 packages. Updated 2019-02-28. Refresh now. Tools for package owners.