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 NewDockerPushHook(s storage.Store) *dockerPushHook
- func NewGithubHook(s storage.Store) *githubHook
- func SHA1HMAC(salt, message []byte) string
- type GitHubNotifier
- type GitHubStatus
- type StatusCode
- type StatusSetter
Constants ¶
const ( StatusPending = "pending" StatusSuccess = "success" StatusError = "error" StatusFailure = "failure" )
Status codes, as defined by GitHub API v3 https://developer.github.com/v3/repos/statuses/
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 GitHubBaseURL = "https://api.github.com"
GitHubBaseURL is the base URL to the GitHub APIv3.
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 NewDockerPushHook ¶
NewDockerPushHook creates a new Docker Push handler for webhooks.
func NewGithubHook ¶
NewGithubHook creates a GitHub webhook handler.
Types ¶
type GitHubNotifier ¶
type GitHubNotifier struct {
// contains filtered or unexported fields
}
GitHubNotifier sets GitHub status messages via the GitHub APIv3.
func NewGitHubNotifier ¶
func NewGitHubNotifier(token string) *GitHubNotifier
NewGitHubNotifier creates a new GitHubNotifier
It requires a valid GitHub access token.
func (*GitHubNotifier) SetStatus ¶
func (g *GitHubNotifier) SetStatus(status StatusCode, ctx, desc, target string) error
SetStatus sets the status code for a request.
func (*GitHubNotifier) SetTarget ¶
func (g *GitHubNotifier) SetTarget(owner, repo, sha string) error
SetTarget sets the target of a GitHub notification.
type GitHubStatus ¶
type GitHubStatus struct {
State StatusCode `json:"state"`
TargetURL string `json:"target_url"`
Description string `json:"description"`
Context string `json:"context"`
}
GitHubStatus defines the status format that GitHub expects
type StatusSetter ¶
type StatusSetter interface {
// SetTarget indicates the target that this status applies to
//
// owner and repo are the GitHub repository owner and repo names
// (e.g. github.com/OWNER/REPO)
//
// sha is the commit shaw that this status applies to.
SetTarget(owner, repo, sha string) error
// SetStatus indicates the status.
//
// ctx is a context string that the remote system uses to distinguish multiple
// status messages. A sane default is "brigade"
//
// desc is a human-oriented string that explains the status code
//
// targetURL is a callback that displays more information. It may be set to
// ""
SetStatus(status StatusCode, ctx, desc string, targetURL string) error
}
StatusSetter sets the status of a particular build.