Documentation
¶
Overview ¶
Copyright 2022 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2022 The ChromiumOS Authors. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2022 The ChromiumOS Authors. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Index ¶
- func DefaultPRPCOpts() *prpc.Options
- func FakeAuthInfoRunner(tool string, exitCode int) cmd.FakeCommandRunner
- func FakeAuthInfoRunnerSuccessStdout(tool string, user string) cmd.FakeCommandRunner
- func FakeBBAddRunner(args []string, bbid string) cmd.FakeCommandRunner
- func FakeWhichRunner(tool string, exitCode int) cmd.FakeCommandRunner
- func GetProp(props map[string]interface{}, prop string) (interface{}, bool)
- func HasProp(props map[string]interface{}, prop string, value interface{}) bool
- func PollForOutputProp(ctx context.Context, client bbpb.BuildsClient, buildIds []int64, ...) (map[int64]*bbpb.Build, error)
- func ReadStructFromFile(path string) (*structpb.Struct, error)
- func SeparateBucketFromBuilder(fullBuilderName string) (bucket string, builder string, err error)
- func SetProperty(s *structpb.Struct, key string, value interface{}) error
- func WriteStructToFile(s *structpb.Struct, file *os.File) error
- type Client
- func (c *Client) BBAdd(ctx context.Context, dryRun bool, args ...string) (string, error)
- func (c *Client) BBBuilders(ctx context.Context, bucket string) ([]string, error)
- func (c *Client) EnsureLUCIToolsAuthed(ctx context.Context, tools ...string) error
- func (c *Client) GetBuild(ctx context.Context, bbid string) (*bbpb.Build, error)
- func (c *Client) GetBuilderInputProps(ctx context.Context, fullBuilderName string) (*structpb.Struct, error)
- func (c *Client) GetBuilds(ctx context.Context, bbids []string) ([]*bbpb.Build, error)
- func (c *Client) IsLUCIToolAuthed(ctx context.Context, tool string) (bool, error)
- func (c *Client) ListBuildsWithPredicate(ctx context.Context, predicate string) ([]*bbpb.Build, error)
- func (c *Client) LogErr(format string, a ...interface{})
- func (c *Client) LogOut(format string, a ...interface{})
- func (c *Client) ToolPath(ctx context.Context, tool string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPRPCOpts ¶
DefaultPRPCOpts returns a set of Options that work well with Buildbucket for most use cases.
func FakeAuthInfoRunner ¶
func FakeAuthInfoRunner(tool string, exitCode int) cmd.FakeCommandRunner
FakeAuthInfoRunner creates a FakeCommandRunner for `{tool} auth-info` (like bb or led).
func FakeAuthInfoRunnerSuccessStdout ¶
func FakeAuthInfoRunnerSuccessStdout(tool string, user string) cmd.FakeCommandRunner
FakeAuthInfoRunnerSuccessStdout is like FakeAuthInfoRunner with exitCode=0, plus stdout about the logged-in user. user should normally be an email address, such as "sundar@google.com". For now it doesn't mock OAuth token details.
func FakeBBAddRunner ¶
func FakeBBAddRunner(args []string, bbid string) cmd.FakeCommandRunner
FakeBBAddRunner creates a FakeCommandRunner for `bb add`. args should be a list of command args, including ["bb", "add"].
func FakeWhichRunner ¶
func FakeWhichRunner(tool string, exitCode int) cmd.FakeCommandRunner
FakeWhichRunner creates a FakeCommandRunner for `which {tool}` (like bb or led).
func HasProp ¶
HasProp checks if the given key value pair is in the dict. prop may be a nested field (. delmited).
func PollForOutputProp ¶
func PollForOutputProp( ctx context.Context, client bbpb.BuildsClient, buildIds []int64, outputProp string, interval time.Duration, ) (map[int64]*bbpb.Build, error)
PollForOutputProp polls until all of buildIds are completed or have set outputProp. Between each call to Buildbucket, the fn. sleeps for interval. This functionality is similar to the `bb collect` command, but allows polling for an output prop being set, instead of only build completion; this is useful for things like polling until a builder has published images.
On completion, returns a map from build id -> Build for all of buildIds.
func ReadStructFromFile ¶
ReadStructFromFile reads a struct from the specified file.
func SeparateBucketFromBuilder ¶
SeparateBucketFromBuilder takes a full builder name (like chromeos/release/release-main-orchestrator), and separates it into a bucket (chromeos/release) and a builder (release-main-orchestrator).
func SetProperty ¶
SetProperty sets the specified property in the property struct.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) BBAdd ¶
BBAdd runs a `bb add` command, and prints stdout to the user. Returns the bbid of the build and an error (if any).
func (*Client) BBBuilders ¶
getBuilders runs the `bb builders` command to get all builders in the given bucket. The bucket param should not include the project prefix (normally "chromeos/").
func (*Client) EnsureLUCIToolsAuthed ¶
EnsureLUCIToolsAuthed ensures that multiple LUCI CLI tools are logged in. If any tools are not authed, it will return an error instructing the user to log into each unauthed tool.
func (*Client) GetBuilderInputProps ¶
func (*Client) IsLUCIToolAuthed ¶
IsLUCIToolAuthed checks whether the named LUCI CLI tool is logged in.
func (*Client) ListBuildsWithPredicate ¶
func (c *Client) ListBuildsWithPredicate(ctx context.Context, predicate string) ([]*bbpb.Build, error)
ListBuilds gets the specified build using `bb ls -predicate ...`.