bitbucket

package
v0.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2018 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCallbackURL = "http://ec2-34-212-13-136.us-west-2.compute.amazonaws.com:8088/bitbucket"
View Source
const DefaultRepoBaseURL = "https://api.bitbucket.org/2.0/repositories/%v"
View Source
const V1RepoBaseURL = "https://api.bitbucket.org/1.0/repositories/%v"

Variables

This section is empty.

Functions

func GetBitbucketClient

func GetBitbucketClient(cfg *pb.VCSCreds) (models.VCSHandler, string, error)

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

func (bb *BBTranslate) TranslatePush(reader io.Reader) (*pb.Push, error)

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

func (bb *Bitbucket) CreateWebhook(webhookURL string) error

CreateWebhook will create webhook at specified webhook url

func (*Bitbucket) FindWebhooks

func (bb *Bitbucket) FindWebhooks(getWebhookURL string) bool

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

func (bb *Bitbucket) GetAllCommits(acctRepo string, branch string) (*pbb.Commits, error)

GetAllCommits /2.0/repositories/{username}/{repo_slug}/commits

func (*Bitbucket) GetBaseURL

func (bb *Bitbucket) GetBaseURL() string

func (*Bitbucket) GetBranchLastCommitData

func (bb *Bitbucket) GetBranchLastCommitData(acctRepo, branch string) (hist *pb.BranchHistory, err error)

func (*Bitbucket) GetCallbackURL

func (bb *Bitbucket) GetCallbackURL() string

GetCallbackURL is a getter for retrieving callbackURL for bitbucket webhooks

func (*Bitbucket) GetClient

func (bb *Bitbucket) GetClient() ocenet.HttpClient

func (*Bitbucket) GetCommitLog

func (bb *Bitbucket) GetCommitLog(acctRepo, branch, lastHash string) ([]*pb.Commit, error)

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 (bb *Bitbucket) GetPRCommits(url string) ([]*pb.Commit, error)

func (*Bitbucket) GetRepoDetail

func (bb *Bitbucket) GetRepoDetail(acctRepo string) (pbb.PaginatedRepository_RepositoryValues, error)

func (*Bitbucket) PostPRComment

func (bb *Bitbucket) PostPRComment(acctRepo, prId, hash string, fail bool, buildId int64) error

func (*Bitbucket) SetBaseURL

func (bb *Bitbucket) SetBaseURL(baseURL string)

func (*Bitbucket) SetCallbackURL

func (bb *Bitbucket) SetCallbackURL(callbackURL string)

SetCallbackURL sets callback urls to be used for webhooks

func (*Bitbucket) Walk

func (bb *Bitbucket) Walk() error

Walk iterates over all repositories and creates webhook if one doesn't exist. Will only work if client has been setup

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL