Documentation
¶
Overview ¶
Package buildbucket provides a buildbucket Client with helper methods to schedule the tasks.
This package contains constants for recoverylib, including task names for example. For more information, see b:208688399.
Index ¶
- Constants
- func CreateTask(ctx context.Context, client Client, sc schedulingapi.TaskSchedulingAPI, ...) (url string, taskID int64, err error)
- func NewHTTPClient(ctx context.Context, f *authcli.Flags) (*http.Client, error)
- func ScheduleTask(ctx context.Context, client Client, v CIPDVersion, params *Params, ...) (string, int64, error)
- func TaskNameToBuilderNamePerVersion(tn TaskName, v CIPDVersion) string
- func ValidateTaskName(tn TaskName) error
- type CIPDVersion
- type Client
- type Params
- type ScheduleLabpackTaskParams
- type TaskName
Constants ¶
const BuildURLFmt = "https://ci.chromium.org/p/%s/builders/%s/%s/b%d"
BuildURLFmt is the format of a build URL.
Variables ¶
This section is empty.
Functions ¶
func CreateTask ¶
func CreateTask(ctx context.Context, client Client, sc schedulingapi.TaskSchedulingAPI, v CIPDVersion, params *Params, serviceName string) (url string, taskID int64, err error)
CreateTask creates a task in scheduling service.
func NewHTTPClient ¶
NewHTTPClient returns an HTTP client with authentication set up.
func ScheduleTask ¶
func ScheduleTask(ctx context.Context, client Client, v CIPDVersion, params *Params, serviceName string) (string, int64, error)
ScheduleTask schedules a buildbucket task.
func TaskNameToBuilderNamePerVersion ¶
func TaskNameToBuilderNamePerVersion(tn TaskName, v CIPDVersion) string
TaskNameToBuilderNamePerVersion returns builder-name specified per TaskName and CIPDVersion. By default any unknown task will be treated as custom tasks.
func ValidateTaskName ¶
ValidateTaskName checks whether a task name is valid
Types ¶
type CIPDVersion ¶
type CIPDVersion string
CIPD version used for scheduling PARIS.
const ( // Use prod version of CIPD package. CIPDProd CIPDVersion = "prod" // Use latest version of CIPD package. CIPDLatest CIPDVersion = "latest" )
func (CIPDVersion) Validate ¶
func (v CIPDVersion) Validate() error
Validate takes a cipd version and checks whether it's valid.
type Client ¶
type Client interface { // ScheduleLabpackTask schedules a labpack task. // TODO(gregorynisbet): refactor this method to return a structured result. // Method is deprecated and will removed in favor of CreateLabpackTask. ScheduleLabpackTask(ctx context.Context, params *ScheduleLabpackTaskParams, clientName string) (string, int64, error) // CreateLabpackTask create a labpack task. CreateLabpackTask(ctx context.Context, params *ScheduleLabpackTaskParams, sc schedulingapi.TaskSchedulingAPI) (string, int64, error) }
Client provides helper methods to interact with buildbucket builds.
type Params ¶
type Params struct { // BuilderProject -- treated as "chromeos" by default. BuilderProject string // BuilderBucket -- treated as "labpack_runner" by default. BuilderBucket string // BuilderName -- treated as "labpack_builder" by default BuilderName string // UnitName is the DUT or similar that we are scheduling against. // For example, a DUT hostname is a valid UnitName. UnitName string // TaskName is used to drive the recovery process, e.g. "labstation_deploy". TaskName string // Whether recovery actions are enabled or not. EnableRecovery bool // Hostname of the admin service. AdminService string // Hostname of the inventory service. InventoryService string // Namespace to use in inventory service. InventoryNamespace string // Whether to update the inventory or not when the task is finished. UpdateInventory bool // NoStepper determines whether the log stepper things. NoStepper bool // NoMetrics determines whether metrics recording (Karte) is in effect. NoMetrics bool // Disable CFT as part of task preparation. DisableCft bool // ExpectedState is the state that the DUT must be in in order for the task to trigger. // For example, a repair task MUST NOT be eligible to run on a "ready" DUT since that would // be a waste of resources. ExpectedState string // Configuration is a base64-encoded string of the job config. Configuration string // Extra tags setting to the swarming task. ExtraTags []string }
Params are the parameters to the labpack job.
type ScheduleLabpackTaskParams ¶
type ScheduleLabpackTaskParams struct { UnitName string ExpectedDUTState string Props *structbuilder.Struct ExtraTags []string // TODO(gregorynisbet): Support map[string]string as dims value. ExtraDims map[string]string // Bullder custom fields. If not provide default values will be used BuilderName string BuilderProject string BuilderBucket string }
ScheduleLabpackTaskParams includes the parameters necessary to schedule a labpack task.
type TaskName ¶
type TaskName string
TaskName describes which flow/plans will be involved in the process.
const ( InvalidTaskName TaskName = "" // Audit is used to run audit task of RPM. AuditRPM TaskName = "audit_rpm" // Audit is used to run audit task of internal storage. AuditStorage TaskName = "audit_storage" // Audit is used to run audit task of USB drive. AuditUSB TaskName = "audit_usb" // Task used to run auto recovery/repair flow in the lab. Recovery TaskName = "recovery" // Task used to run deep repair flow in the lab. DeepRecovery TaskName = "deep_recovery" // Task used to run auto recovery/repair flow in MH. MHRecovery TaskName = "mh_recovery" // Task used to prepare device to be used in the lab. Deploy TaskName = "deploy" // Task used to execute custom plans. // Configuration has to be provided by the user. Custom TaskName = "custom" // DryRun is a task that runs an empty plan with no actions. // Its intended use case is to verify that a recipe or luciexe executable // can transfer control to labpack (or another recoverylib runner) successfully. DryRun TaskName = "dry_run" // PostTest is a task that runs a lightweight verifier task during test // teardown. Also known as "ile-de-france". PostTest = "post_test" )
func NormalizeTaskName ¶
NormalizeTaskName takes a task name from anywhere and normalizes it. This is a necessary first step towards consolidating our notion of task names.
Names are taken from here and https://chromium.googlesource.com/infra/infra/+/refs/heads/main/go/src/infra/appengine/crosskylabadmin/internal/app/frontend/tracker.go .
func (TaskName) BuilderName ¶
BuilderName returns builder-name specified per TaskName.