buildbucket

package
v0.0.0-...-5782500 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: BSD-3-Clause Imports: 10 Imported by: 7

Documentation

Overview

Package buildbucket provides tools for interacting with the buildbucket API.

Index

Constants

View Source
const (
	BUILD_URL_TMPL = "https://%s/build/%d"
	DEFAULT_HOST   = "cr-buildbucket.appspot.com"
)

Variables

View Source
var (
	DEFAULT_SCOPES = []string{
		"https://www.googleapis.com/auth/userinfo.email",
		"https://www.googleapis.com/auth/userinfo.profile",
	}
)

Functions

This section is empty.

Types

type BuildBucketInterface

type BuildBucketInterface interface {
	// CancelBuild cancels the specified build with the specified
	// SummaryMarkdown.
	CancelBuild(ctx context.Context, buildID int64, summaryMarkdown string) (*buildbucketpb.Build, error)
	// CancelBuilds cancels the specified buildIDs with the specified
	// summaryMarkdown. Builds are cancelled with one batch request
	// to buildbucket.
	CancelBuilds(ctx context.Context, buildIDs []int64, summaryMarkdown string) ([]*buildbucketpb.Build, error)
	// GetBuild retrieves the build with the given ID.
	GetBuild(ctx context.Context, buildId int64) (*buildbucketpb.Build, error)
	// GetTrybotsForCL retrieves trybot results for the given CL using the
	// optional tags.
	GetTrybotsForCL(ctx context.Context, issue, patchset int64, gerritUrl string, tags map[string]string) ([]*buildbucketpb.Build, error)
	// ScheduleBuilds schedules the specified builds on the given CL. Builds are
	// scheduled with one batch request to buildbucket.
	// builds is the slice of which builds should be scheduled by buildbucket.
	// Eg: ["Infra-PerCommit-Race", "Infra-PerCommit-Small"].
	// buildsToTags is the map of which tags to use when scheduling
	// some of the builds. Eg: {"Infra-PerCommit-Race": {"triggered_by": "skcq"}}
	// means that the Infra-PerCommit-Race build should be scheduled with the
	// "triggered_by: skcq" tag.
	ScheduleBuilds(ctx context.Context, builds []string, buildsToTags map[string]map[string]string, issue, patchset int64, gerritUrl, repo, bbProject, bbBucket string) ([]*buildbucketpb.Build, error)
	// Search retrieves Builds which match the given criteria.
	Search(ctx context.Context, pred *buildbucketpb.BuildPredicate) ([]*buildbucketpb.Build, error)
	// UpdateBuild sends an update for the given build.
	UpdateBuild(ctx context.Context, build *buildbucketpb.Build, token string) error
	// StartBuild notifies Buildbucket that the build has started. Returns the
	// token which should be passed to UpdateBuild for subsequent calls.
	StartBuild(ctx context.Context, buildId int64, taskId, token string) (string, error)
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is used for interacting with the BuildBucket API.

func NewClient

func NewClient(c *http.Client) *Client

NewClient returns an authenticated Client instance.

func NewTestingClient

func NewTestingClient(bc buildbucketpb.BuildsClient, host string) *Client

NewTestingClient lets the MockClient inject a mock BuildsClient and host.

func (*Client) CancelBuild

func (c *Client) CancelBuild(ctx context.Context, buildID int64, summaryMarkdown string) (*buildbucketpb.Build, error)

CancelBuild implements BuildbucketInterface.

func (*Client) CancelBuilds

func (c *Client) CancelBuilds(ctx context.Context, buildIDs []int64, summaryMarkdown string) ([]*buildbucketpb.Build, error)

CancelBuilds implements the BuildBucketInterface.

func (*Client) GetBuild

func (c *Client) GetBuild(ctx context.Context, buildId int64) (*buildbucketpb.Build, error)

GetBuild implements the BuildBucketInterface.

func (*Client) GetTrybotsForCL

func (c *Client) GetTrybotsForCL(ctx context.Context, issue, patchset int64, gerritUrl string, tags map[string]string) ([]*buildbucketpb.Build, error)

GetTrybotsForCL implements the BuildBucketInterface.

func (*Client) ScheduleBuilds

func (c *Client) ScheduleBuilds(ctx context.Context, builds []string, buildsToTags map[string]map[string]string, issue, patchset int64, gerritURL, repo, bbProject, bbBucket string) ([]*buildbucketpb.Build, error)

ScheduleBuilds implements the BuildBucketInterface.

func (*Client) Search

GetBuild implements the BuildBucketInterface.

func (*Client) StartBuild

func (c *Client) StartBuild(ctx context.Context, buildId int64, taskId, token string) (string, error)

StartBuild implements BuildbucketInterface.

func (*Client) UpdateBuild

func (c *Client) UpdateBuild(ctx context.Context, build *buildbucketpb.Build, token string) error

UpdateBuild implements BuildbucketInterface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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