buildbucket

package
v0.0.0-...-9febfc8 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package buildbucket contains all the necessary code to schedule a CTP build for running a test using buildbucket APIs.

Index

Constants

View Source
const (
	// DefaultSwarmingPriority is the default priority for a Swarming task.
	DefaultSwarmingPriority = int64(140)
	// MinSwarmingPriority is the lowest-allowed priority for a Swarming task.
	MinSwarmingPriority = int64(50)
	// MaxSwarmingPriority is the highest-allowed priority for a Swarming task.
	MaxSwarmingPriority = int64(255)
)

Variables

This section is empty.

Functions

func NewBuildBucketClient

func NewBuildBucketClient(ctx context.Context, hclient *http.Client) (*client, error)

NewBuildBucketClient creates a client to communicate with Buildbucket.

func ScheduleBuild

func ScheduleBuild(ctx context.Context, bbClient BuildbucketClient) (string, error)

ScheduleBuild register a build. If it successes, it returns a link of build. Otherwise, return an error.

Types

type BuildbucketClient

type BuildbucketClient interface {
	ScheduleCTPBuild(ctx context.Context) (*bb.Build, error)
}

BuildbucketClient interface provides subset of Buildbucket methods relevant to Fleet use cases

type BuildsClient

type BuildsClient interface {
	SearchBuilds(ctx context.Context, in *bb.SearchBuildsRequest, opts ...grpc.CallOption) (*bb.SearchBuildsResponse, error)
	GetBuild(context.Context, *bb.GetBuildRequest, ...grpc.CallOption) (*bb.Build, error)
	ScheduleBuild(context.Context, *bb.ScheduleBuildRequest, ...grpc.CallOption) (*bb.Build, error)
}

BuildsClient is a subset of buildbucketpb.BuildsClient providing a smaller surface area for unit tests

type FakeBuildClient

type FakeBuildClient struct{}

func (FakeBuildClient) ScheduleBuild

type FakeClient

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

func (*FakeClient) BuildURL

func (c *FakeClient) BuildURL(ID int64) string

func (*FakeClient) GetLatestGreenBuild

func (c *FakeClient) GetLatestGreenBuild(ctx context.Context) (*buildbucketpb.Build, error)

func (FakeClient) ScheduleCTPBuild

func (c FakeClient) ScheduleCTPBuild(ctx context.Context) (*buildbucketpb.Build, error)

type Run

type Run struct {
	Image     string
	Model     string
	Board     string
	Milestone string
	Build     string
	Pool      string
	Suite     string
	Tests     []string
	Testplan  string
	Harness   string
	TestArgs  string
	CFT       bool
	// TRV2 determines whether we will use Test Runner V2
	TRV2        bool
	TimeoutMins int
	// Any configs related to results upload for this test run.
	AddedDims map[string]string
	Tags      map[string]string
	IsProd    bool
	BBClient  BuildsClient
	Priority  int64

	UploadToCpcon bool
}

Run holds the arguments that are needed for the run command.

func (*Run) TriggerRun

func (c *Run) TriggerRun(ctx context.Context) (string, error)

TriggerRun triggers the Run with the given information (it could be either single test or a suite or a test_plan in the GCS bucket or test_plan saved locally)

Jump to

Keyboard shortcuts

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