Documentation
¶
Index ¶
- Constants
- func GetBitbucketClient(cfg *pb.VCSCreds) (models.VCSHandler, string, error)
- func GetBitbucketFromHttpClient(cli *http.Client) models.VCSHandler
- func GetBitbucketHandler(adminConfig *pb.VCSCreds, client ocenet.HttpClient) models.VCSHandler
- type BBTranslate
- type Bitbucket
- func (bb *Bitbucket) CreateWebhook(webhookURL string) error
- func (bb *Bitbucket) FindWebhooks(getWebhookURL string) bool
- func (bb *Bitbucket) GetAllBranchesLastCommitData(acctRepo string) ([]*pb.BranchHistory, error)
- func (bb *Bitbucket) GetAllCommits(acctRepo string, branch string) (*pbb.Commits, error)
- func (bb *Bitbucket) GetBaseURL() string
- func (bb *Bitbucket) GetBranchLastCommitData(acctRepo, branch string) (hist *pb.BranchHistory, err error)
- func (bb *Bitbucket) GetCallbackURL() string
- func (bb *Bitbucket) GetClient() ocenet.HttpClient
- func (bb *Bitbucket) GetCommitLog(acctRepo, branch, lastHash string) ([]*pb.Commit, error)
- func (bb *Bitbucket) GetFile(filePath string, fullRepoName string, commitHash string) (bytez []byte, err error)
- func (bb *Bitbucket) GetPRCommits(url string) ([]*pb.Commit, error)
- func (bb *Bitbucket) GetRepoDetail(acctRepo string) (pbb.PaginatedRepository_RepositoryValues, error)
- func (bb *Bitbucket) PostPRComment(acctRepo, prId, hash string, fail bool, buildId int64) error
- func (bb *Bitbucket) SetBaseURL(baseURL string)
- func (bb *Bitbucket) SetCallbackURL(callbackURL string)
- func (bb *Bitbucket) Walk() error
Constants ¶
const DefaultCallbackURL = "http://ec2-34-212-13-136.us-west-2.compute.amazonaws.com:8088/bitbucket"
const DefaultRepoBaseURL = "https://api.bitbucket.org/2.0/repositories/%v"
const V1RepoBaseURL = "https://api.bitbucket.org/1.0/repositories/%v"
Variables ¶
This section is empty.
Functions ¶
func GetBitbucketClient ¶
Returns VCS handler for pulling source code and auth token if exists (auth token is needed for code download)
func GetBitbucketFromHttpClient ¶
func GetBitbucketFromHttpClient(cli *http.Client) models.VCSHandler
func GetBitbucketHandler ¶
func GetBitbucketHandler(adminConfig *pb.VCSCreds, client ocenet.HttpClient) models.VCSHandler
TODO: callback url is set as env. variable on admin, or passed in via command line GetBitbucketHandler returns a Bitbucket handler referenced by VCSHandler interface
Types ¶
type BBTranslate ¶
type BBTranslate struct {
Unmarshaler jsonpb.Unmarshaler
}
func GetTranslator ¶
func GetTranslator() *BBTranslate
func (*BBTranslate) TranslatePR ¶
func (bb *BBTranslate) TranslatePR(reader io.Reader) (*pb.PullRequest, error)
func (*BBTranslate) TranslatePush ¶
type Bitbucket ¶
type Bitbucket struct {
CallbackURL string
RepoBaseURL string
Client ocenet.HttpClient
Marshaler jsonpb.Marshaler
Unmarshaler jsonpb.Unmarshaler
// contains filtered or unexported fields
}
Bitbucket is a bitbucket handler responsible for finding build files and registering webhooks for necessary repositories
func (*Bitbucket) CreateWebhook ¶
CreateWebhook will create webhook at specified webhook url
func (*Bitbucket) FindWebhooks ¶
recursively iterates over all webhooks and returns true (matches our callback urls) if one already exists
func (*Bitbucket) GetAllBranchesLastCommitData ¶
func (bb *Bitbucket) GetAllBranchesLastCommitData(acctRepo string) ([]*pb.BranchHistory, error)
func (*Bitbucket) GetAllCommits ¶
GetAllCommits /2.0/repositories/{username}/{repo_slug}/commits
func (*Bitbucket) GetBaseURL ¶
func (*Bitbucket) GetBranchLastCommitData ¶
func (bb *Bitbucket) GetBranchLastCommitData(acctRepo, branch string) (hist *pb.BranchHistory, err error)
func (*Bitbucket) GetCallbackURL ¶
GetCallbackURL is a getter for retrieving callbackURL for bitbucket webhooks
func (*Bitbucket) GetClient ¶
func (bb *Bitbucket) GetClient() ocenet.HttpClient
func (*Bitbucket) GetCommitLog ¶
GetCommitLog will return a list of Commits, starting with the most recent and ending at the lastHash value. If the lastHash commit value is never found, will return an error.
func (*Bitbucket) GetFile ¶
func (bb *Bitbucket) GetFile(filePath string, fullRepoName string, commitHash string) (bytez []byte, err error)
Get File in repo at a certain commit. filepath: string filepath relative to root of repo fullRepoName: string account_name/repo_name as it is returned in the Bitbucket api Repo Source `full_name` commitHash: string git hash for revision number
func (*Bitbucket) GetPRCommits ¶
func (*Bitbucket) GetRepoDetail ¶
func (bb *Bitbucket) GetRepoDetail(acctRepo string) (pbb.PaginatedRepository_RepositoryValues, error)
func (*Bitbucket) PostPRComment ¶
func (*Bitbucket) SetBaseURL ¶
func (*Bitbucket) SetCallbackURL ¶
SetCallbackURL sets callback urls to be used for webhooks