swarming

package
v0.0.0-...-1643519 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

README

Swarming endpoints. Includes builds and logs.

  • build.go - Ingests annotee

  • build_test.go - Tests for build.go

  • buildLog.go - Displays build logs

  • memoryClient.go - In memory butler client for annotee

  • html.go - Plain ol' html endpoints

Documentation

Index

Constants

View Source
const (
	// TaskRunning means task is running.
	TaskRunning = "RUNNING"
	// TaskPending means task didn't start yet.
	TaskPending = "PENDING"
	// TaskExpired means task expired and did not start.
	TaskExpired = "EXPIRED"
	// TaskTimedOut means task started, but took too long.
	TaskTimedOut = "TIMED_OUT"
	// TaskBotDied means task started but bot died.
	TaskBotDied = "BOT_DIED"
	// TaskCanceled means the task was canceled. See CompletedTs to determine whether it was started.
	TaskCanceled = "CANCELED"
	// TaskKill means the task was canceled. See CompletedTs to determine whether it was started.
	TaskKilled = "KILLED"
	// TaskCompleted means task is complete.
	TaskCompleted = "COMPLETED"
	// TaskNoResource means there was not enough capacity when scheduled, so the
	// task failed immediately.
	TaskNoResource = "NO_RESOURCE"
)

Swarming task states..

View Source
const SwarmingTimeLayout = "2006-01-02T15:04:05.999999999"

SwarmingTimeLayout is time layout used by swarming.

View Source
const URLBase = "/swarming/task"

URLBase is the routing prefix for swarming endpoints. It's here so that it can be a constant between the swarmingURLBuilder and the frontend.

Variables

View Source
var ErrNotMiloJob = errors.New("Not a Milo Job or access denied", common.CodeNoAccess)

ErrNotMiloJob is returned if a Swarming task is fetched that does not self- identify as a Milo job.

Functions

func AddBanner

func AddBanner(build *ui.MiloBuild, tags strpair.Map)

AddBanner adds an OS banner derived from "os" swarming tag, if present.

func AddProjectInfo

func AddProjectInfo(build *ui.MiloBuild, tags strpair.Map)

addProjectInfo adds the luci_project swarming tag to the build.

func AddRecipeLink(build *ui.MiloBuild, tags strpair.Map)

func GetBuild

func GetBuild(c context.Context, host, taskId string) (*ui.MiloBuild, error)

GetBuild returns a milo build from a swarming task id.

func GetLog

func GetLog(c context.Context, host, taskID, logname string) (text string, closed bool, err error)

GetLog loads a step log.

func NewProdService

func NewProdService(c context.Context, host string) (*prodSwarmingService, error)

func SwarmingBuildImpl

func SwarmingBuildImpl(c context.Context, svc SwarmingService, taskID string) (*ui.MiloBuild, error)

SwarmingBuildImpl fetches data from Swarming and LogDog and produces a resp.MiloBuild representation of a build state given a Swarming TaskID.

func TaskPageURL

func TaskPageURL(swarmingHostname, taskID string) *url.URL

TaskPageURL returns a URL to a human-consumable page of a swarming task. Supports host aliases.

Types

type BuildID

type BuildID struct {
	// (Required) The Swarming TaskID.
	TaskID string

	// (Optional) The Swarming host. If empty, will use the
	// milo-instance-configured swarming host.
	Host string
}

BuildID is swarming's notion of a Build. See buildsource.ID.

type BuildInfoProvider

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

BuildInfoProvider provides build information.

In a production system, this will be completely defaults. For testing, the various services and data sources may be substituted for testing stubs.

func (*BuildInfoProvider) GetBuildInfo

GetBuildInfo resolves a Milo protobuf Step for a given Swarming task.

type SwarmingService

type SwarmingService interface {
	GetHost() string
	GetSwarmingResult(c context.Context, taskID string) (*swarming.SwarmingRpcsTaskResult, error)
	GetSwarmingRequest(c context.Context, taskID string) (*swarming.SwarmingRpcsTaskRequest, error)
	GetTaskOutput(c context.Context, taskID string) (string, error)
}

SwarmingService is an interface that fetches data from Swarming.

In production, this is fetched from a Swarming host. For testing, this can be replaced with a mock.

Jump to

Keyboard shortcuts

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