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) ([]*pb.Commit, 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) GetChangedFiles(acctRepo, latestHash, earliestHash string) (changedFiles []string, err error)
- func (bb *Bitbucket) GetClient() ocenet.HttpClient
- func (bb *Bitbucket) GetCommit(acctRepo, hash string) (*pb.Commit, error)
- 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) GetRepoLinks(acctRepo string) (*pb.Links, error)
- func (bb *Bitbucket) GetVcsType() pb.SubCredType
- 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"
const DefaultRepoBaseURL = "https://api.bitbucket.org/2.0/repositories/%v"
const TokenUrl = "https://bitbucket.org/site/oauth2/access_token"
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 ¶
TranslatePush will convert a push event from bitbucket into the VCS-generic push object.
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) GetChangedFiles ¶ added in v0.7.3
func (bb *Bitbucket) GetChangedFiles(acctRepo, latestHash, earliestHash string) (changedFiles []string, err error)
GetChangedFiles will get the list of files that have changed between commits. If earliestHash is not passed, then the diff list will be off of just the changed files in the latestHash. If earliesthash is passed, then it will return the changeset similar to git diff --name-only <latestHash>..<earliestHash>
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) GetRepoLinks ¶ added in v0.8.0
func (*Bitbucket) GetVcsType ¶ added in v0.8.0
func (bb *Bitbucket) GetVcsType() pb.SubCredType
func (*Bitbucket) PostPRComment ¶
func (*Bitbucket) SetBaseURL ¶
func (*Bitbucket) SetCallbackURL ¶
SetCallbackURL sets callback urls to be used for webhooks