Documentation ¶
Index ¶
- Variables
- type Client
- type HTTPClient
- func (c *HTTPClient) ClearStates(ctx context.Context, repoName, sha string) error
- func (c *HTTPClient) CommentError(ctx context.Context, repoName string, prID int64, err error) error
- func (c *HTTPClient) ErrorStatus(ctx context.Context, owner, repo, name, sha, url string, outErr error) error
- func (c *HTTPClient) FinishedStatus(ctx context.Context, owner, repo, name, sha, url string, status bool, ...) error
- func (c *HTTPClient) GetDiffFiles(ctx context.Context, repoName, base, head string) ([]string, error)
- func (c *HTTPClient) GetFile(ctx context.Context, repoName, sha, filename string) ([]byte, error)
- func (c *HTTPClient) GetFileList(ctx context.Context, repoName, sha string) ([]string, error)
- func (c *HTTPClient) GetRefs(ctx context.Context, repoName, sha string) ([]string, error)
- func (c *HTTPClient) GetRepository(ctx context.Context, name string) (*github.Repository, error)
- func (c *HTTPClient) GetSHA(ctx context.Context, repoName, refName string) (string, error)
- func (c *HTTPClient) MyLogin(ctx context.Context) (string, error)
- func (c *HTTPClient) MyRepositories(ctx context.Context) ([]*github.Repository, error)
- func (c *HTTPClient) PendingStatus(ctx context.Context, owner, repo, name, sha, url string) error
- func (c *HTTPClient) SetupHook(ctx context.Context, owner, repo, configAddress, hookSecret string) error
- func (c *HTTPClient) StartedStatus(ctx context.Context, owner, repo, name, sha, url string) error
- func (c *HTTPClient) TeardownHook(ctx context.Context, owner, repo, hookURL string) error
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultUsername controls the default username in the event NoAuth is in // effect; if set it will be used, otherwise an API call will be made. DefaultUsername string // Readonly disables certain actions -- most of which write content back to // github -- to ensure testing can be done with a real github client, without // affecting too much ON github. This is set through config/service.go. Readonly bool )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { CommentError(context.Context, string, int64, error) error MyRepositories(context.Context) ([]*github.Repository, error) GetRepository(context.Context, string) (*github.Repository, error) MyLogin(context.Context) (string, error) GetFileList(context.Context, string, string) ([]string, error) GetSHA(context.Context, string, string) (string, error) GetRefs(context.Context, string, string) ([]string, error) GetFile(context.Context, string, string, string) ([]byte, error) GetDiffFiles(context.Context, string, string, string) ([]string, error) SetupHook(context.Context, string, string, string, string) error TeardownHook(context.Context, string, string, string) error PendingStatus(context.Context, string, string, string, string, string) error StartedStatus(context.Context, string, string, string, string, string) error ErrorStatus(context.Context, string, string, string, string, string, error) error FinishedStatus(context.Context, string, string, string, string, string, bool, string) error ClearStates(context.Context, string, string) error }
Client is the generic client to github operations.
func NewClientFromAccessToken ¶
NewClientFromAccessToken turns an accessToken into a new Client.
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient encapsulates the "real world", or http client.
func (*HTTPClient) ClearStates ¶
func (c *HTTPClient) ClearStates(ctx context.Context, repoName, sha string) error
ClearStates removes all status reports from a SHA in an attempt to restart the process.
func (*HTTPClient) CommentError ¶
func (c *HTTPClient) CommentError(ctx context.Context, repoName string, prID int64, err error) error
CommentError is for commenting on PRs when there is no better means of bubbling up an error.
func (*HTTPClient) ErrorStatus ¶
func (c *HTTPClient) ErrorStatus(ctx context.Context, owner, repo, name, sha, url string, outErr error) error
ErrorStatus updates the status for the sha for the given repo on github.
func (*HTTPClient) FinishedStatus ¶
func (c *HTTPClient) FinishedStatus(ctx context.Context, owner, repo, name, sha, url string, status bool, addlMessage string) error
FinishedStatus updates the status for the sha for the given repo on github.
func (*HTTPClient) GetDiffFiles ¶
func (c *HTTPClient) GetDiffFiles(ctx context.Context, repoName, base, head string) ([]string, error)
GetDiffFiles retrieves the files present in the diff between the base and the head.
func (*HTTPClient) GetFile ¶
GetFile retrieves a file from github directly through the api. Used for retrieving our configuration yamls and other stuff.
func (*HTTPClient) GetFileList ¶
GetFileList finds all the files in the tree for the given repository
func (*HTTPClient) GetRefs ¶
GetRefs gets the refs that match the given SHA. Only heads and tags are considered.
func (*HTTPClient) GetRepository ¶
func (c *HTTPClient) GetRepository(ctx context.Context, name string) (*github.Repository, error)
GetRepository retrieves the github response for a given repository.
func (*HTTPClient) MyLogin ¶
func (c *HTTPClient) MyLogin(ctx context.Context) (string, error)
MyLogin returns the username calling out to the API with its key. Can either be seeded by OAuth or Personal Token.
func (*HTTPClient) MyRepositories ¶
func (c *HTTPClient) MyRepositories(ctx context.Context) ([]*github.Repository, error)
MyRepositories returns all the writable repositories accessible to user owning the access key
func (*HTTPClient) PendingStatus ¶
func (c *HTTPClient) PendingStatus(ctx context.Context, owner, repo, name, sha, url string) error
PendingStatus updates the status for the sha for the given repo on github.
func (*HTTPClient) SetupHook ¶
func (c *HTTPClient) SetupHook(ctx context.Context, owner, repo, configAddress, hookSecret string) error
SetupHook sets up the pr webhook in github.
func (*HTTPClient) StartedStatus ¶
func (c *HTTPClient) StartedStatus(ctx context.Context, owner, repo, name, sha, url string) error
StartedStatus updates the status for the sha for the given repo on github.
func (*HTTPClient) TeardownHook ¶
func (c *HTTPClient) TeardownHook(ctx context.Context, owner, repo, hookURL string) error
TeardownHook removes the pr webhook in github.