Documentation ¶
Index ¶
- Constants
- Variables
- func GetFileContents(proj *brigade.Project, ref, path string) ([]byte, error)
- func GetLastCommit(proj *brigade.Project, ref string) (string, error)
- func GetRepoStatus(proj *brigade.Project, ref string) (*github.RepoStatus, error)
- func GhClient(gh brigade.Github) (*github.Client, error)
- func InstallationTokenClient(instToken, baseURL, uploadURL string) (*github.Client, error)
- func JWT(appID string, keyPEM []byte) (string, error)
- func NewGithubHookHandler(s storage.Store, authors []string, x509Key []byte, opts GithubOpts) gin.HandlerFunc
- func SHA1HMAC(salt, message []byte) string
- type GithubOpts
- type Payload
Constants ¶
const StatusContext = "brigade"
StatusContext names the context for a particular status message.
Variables ¶
var ( StatePending = "pending" StateFailure = "failure" StateError = "error" StateSuccess = "success" )
State names for GitHub status
var ErrAuthFailed = errors.New("Auth Failed")
ErrAuthFailed indicates some part of the auth handshake failed
This is usually indicative of an auth failure between the client library and GitHub
Functions ¶
func GetFileContents ¶
GetFileContents returns the contents for a particular file in the project.
func GetLastCommit ¶
GetLastCommit gets the last commit on the give reference (branch name or tag).
func GetRepoStatus ¶
GetRepoStatus gets the Brigade repository status. The ref can be a SHA or a branch or tag.
func GhClient ¶
GhClient gets a new GitHub client object.
It authenticates with an OAUTH2 token.
If an enterpriseHost base URL is provided, this will attempt to connect to that instead of the hosted GitHub API server.
func InstallationTokenClient ¶
InstallationTokenClient uses an installation token to authenticate to the Github API.
func NewGithubHookHandler ¶
func NewGithubHookHandler(s storage.Store, authors []string, x509Key []byte, opts GithubOpts) gin.HandlerFunc
NewGithubHookHandler creates a GitHub webhook handler.
Types ¶
type GithubOpts ¶
GithubOpts provides options for configuring a GitHub hook
type Payload ¶
type Payload struct { Type string `json:"type"` Token string `json:"token"` TokenExpires time.Time `json:"tokenExpires"` Body interface{} `json:"body"` AppID int `json:"-"` InstID int `json:"-"` Commit string `json:"commit"` Branch string `json:"branch"` }
Payload represents the data sent as the payload of an event.