Back to godoc.org

Package swmbot

v0.0.0-...-bd98d2d
Latest Go to latest

The highest tagged major version is .

Published: Sep 19, 2020 | License: BSD-3-Clause | Module: chromium.googlesource.com/infra/infra.git

Overview

Package swmbot provides interaction with the Swarming bot running the Skylab worker process. This includes information about the Swarming bot as well as any Swarming bot local state.

Index

func InventoryClient

func InventoryClient(ctx context.Context, b *Info) (fleet.InventoryClient, error)

InventoryClient returns an InventoryClient for the current Swarming bot task. The context should use an explicit service account using WithTaskAccount or WithSystemAccount; otherwise the default service account is used.

func InventoryV2Client

func InventoryV2Client(ctx context.Context, b *Info) (invV2.InventoryClient, error)

InventoryV2Client returns an InventoryClient for the current Swarming bot task. The context should use an explicit service account using WithTaskAccount or WithSystemAccount; otherwise the default service account is used.

func Marshal

func Marshal(bi *LocalState) ([]byte, error)

Marshal returns the encoding of the BotInfo.

func UFSClient

func UFSClient(ctx context.Context, b *Info) (ufsAPI.FleetClient, error)

UFSClient returns a FleetClient to communicate with UFS service. The context should use an explicit service account using WithTaskAccount or WithSystemAccount; otherwise the default service account is used.

func Unmarshal

func Unmarshal(data []byte, bi *LocalState) error

Unmarshal decodes BotInfo from the encoded data.

func WithSystemAccount

func WithSystemAccount(ctx context.Context) (context.Context, error)

WithSystemAccount returns acontext to using the Swarming bot system service account.

func WithTaskAccount

func WithTaskAccount(ctx context.Context) (context.Context, error)

WithTaskAccount returns a context using the Swarming task service account.

type Info

type Info struct {
	AdminService     string
	AutotestPath     string
	DUTID            string
	InventoryService string
	UFSService       string
	LuciferBinDir    string
	ParserPath       string
	SwarmingService  string
	Task             Task
}

Info contains information about the current Swarming bot.

func GetInfo

func GetInfo() *Info

GetInfo returns the Info for the current Swarming bot, built from environment variables.

Per-bot variables:

ADMIN_SERVICE: Admin service host, e.g. foo.appspot.com.
INVENTORY_SERVICE: Inventory V2 service host, e.g. foo.appspot.com.
AUTOTEST_DIR: Path to the autotest checkout on server.
LUCIFER_TOOLS_DIR: Path to the lucifer installation.
PARSER_PATH: Path to the autotest_status_parser installation.
SKYLAB_DUT_ID: skylab_inventory id of the DUT that belongs to this bot.
SWARMING_SERVICE: Swarming service host, e.g. https://foo.appspot.com.

Per-task variables:

SWARMING_TASK_ID: task id of the swarming task being serviced.

func (*Info) LuciferConfig

func (b *Info) LuciferConfig() lucifer.Config

LuciferConfig returns the lucifer.Config for the Swarming bot.

func (*Info) ResultsDir

func (b *Info) ResultsDir() string

ResultsDir returns the path to the results directory used by the bot task.

func (*Info) TaskRunURL

func (b *Info) TaskRunURL() string

TaskRunURL returns the URL for the current Swarming task execution.

type LocalState

type LocalState struct {
	HostState               dutstate.State          `json:"state"`
	ProvisionableLabels     ProvisionableLabels     `json:"provisionable_labels"`
	ProvisionableAttributes ProvisionableAttributes `json:"provisionable_attributes"`
}

LocalState contains persistent bot information that is cached on the Skylab drone.

type ProvisionableAttributes

type ProvisionableAttributes map[string]string

ProvisionableAttributes stores provisionable attributes for a bot and host.

type ProvisionableLabels

type ProvisionableLabels map[string]string

ProvisionableLabels stores provisionable labels for a bot and host.

type Task

type Task struct {
	RunID string
}

Task describes the bot's current task.

func (*Task) GsURL

func (t *Task) GsURL(gsBucket string) string

GsURL returns the URL for the Google Storage location of the logs offloaded from this task.

func (*Task) StainlessURL

func (t *Task) StainlessURL() string

StainlessURL returns the URL to the stainless logs browser for logs offloaded from this task.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier