model

package
v0.0.0-...-678bb0e Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildSummary

type BuildSummary struct {

	// BuildKey will always point to the "real" build, i.e. a buildbotBuild or
	// a buildbucketBuild. It is always the parent key for the BuildSummary.
	BuildKey *datastore.Key `gae:"$parent"`

	// Global identifier for the builder that this Build belongs to, i.e.:
	//   "buildbot/<mastername>/<buildername>"
	//   "buildbucket/<bucketname>/<buildername>"
	BuilderID string

	// SelfLink provides a relative URL for this build.
	// Buildbot: /buildbot/<mastername>/<buildername>/<buildnumber>
	// Swarmbucket: Derived from Buildbucket (usually link to self)
	SelfLink string

	// Created is the time when the Build was first created. Due to pending
	// queues, this may be substantially before Summary.Start.
	Created time.Time

	// Summary summarizes relevant bits about the overall build.
	Summary Summary

	// CurrentStep summarizes relevant bits about the currently running step (if
	// any). Only expected to be set if !Summary.Status.Terminal().
	CurrentStep Summary

	// Manifests is a list of links to source manifests that this build reported.
	Manifests []ManifestLink

	// Patches is the list of patches which are associated with this build.
	// We reserve the multi-patch case for advanced (multi-repo) tryjobs...
	// Typically there will only be one patch associated with a build.
	Patches []PatchInfo

	// ManifestKeys is the list of ManifestKey entries for this BuildSummary.
	ManifestKeys []ManifestKey
	// contains filtered or unexported fields
}

BuildSummary is a datastore model which is used for storing staandardized summarized build data, and is used for backend-agnostic views (i.e. builders, console). It contains only data that:

  • is necessary to render these simplified views
  • is present in all implementations (buildbot, buildbucket)

This entity will live as a child of the various implementation's representations of a build (e.g. buildbotBuild). It has various 'tag' fields so that it can be queried by the various backend-agnostic views.

func (*BuildSummary) AddManifestKey

func (bs *BuildSummary) AddManifestKey(project, console, manifest, repoURL string, revision []byte)

AddManifestKey adds a new entry to ManifestKey.

`revision` should be the hex-decoded git revision.

It's up to the caller to ensure that entries in ManifestKey aren't duplicated.

type Link struct {
	// Title (text) of the link.
	Label string

	// The destination for the link.
	URL string
}

Link denotes a single labeled link.

type ManifestKey

type ManifestKey []byte

ManifestKey is an index entry for BuildSummary, which looks like

0 ++ project ++ console ++ manifest_name ++ url ++ revision.decode('hex')

This is used to index this BuildSummary as the row for any consoles that it shows up in that use the Manifest/RepoURL/Revision indexing scheme.

(++ is cmpbin concatenation)

Example:

0 ++ "chromium" ++ "main" ++ "UNPATCHED" ++ "https://.../src.git" ++ deadbeef

The list of interested consoles is compiled at build summarization time.

type ManifestLink struct {
	// The name of the manifest as the build annotated it.
	Name string

	// The manifest ID (sha256).
	ID []byte
}

ManifestLink is an in-MILO link to a named source manifest.

func (*ManifestLink) FromProperty

func (m *ManifestLink) FromProperty(p ds.Property) (err error)

FromProperty implements ds.PropertyConverter

func (*ManifestLink) ToProperty

func (m *ManifestLink) ToProperty() (ds.Property, error)

ToProperty implements ds.PropertyConverter

type PartialManifestKey

type PartialManifestKey []byte

PartialManifestKey is an incomplete ManifestKey key which can be made complete by calling AddRevision.

func NewPartialManifestKey

func NewPartialManifestKey(project, console, manifest, repoURL string) PartialManifestKey

NewPartialManifestKey generates a ManifestKey prefix corresponding to the given parameters.

func (PartialManifestKey) AddRevision

func (p PartialManifestKey) AddRevision(revision []byte) ManifestKey

AddRevision appends a git revision (as bytes) to the PartialManifestKey, returning a full index value for BuildSummary.ManifestKey.

type PatchInfo

type PatchInfo struct {
	// A link to the patch page (i.e. the gerrit/rietveld review page).
	Link Link

	// The email of the author of the Patch.
	AuthorEmail string
}

PatchInfo provides information about a patch included in a build.

type Status

type Status int

Status is a discrete status for the purpose of colorizing a component. These are based off the Material Design Bootstrap color palettes.

const (
	// NotRun if the component has not yet been run.
	NotRun Status = iota // 100 Gray

	// Running if the component is currently running.
	Running // 100 Teal

	// Success if the component has finished executing and is not noteworthy.
	Success // A200 Green

	// Failure if the component has finished executing and contains a failure.
	Failure // A200 Red

	// Warning just like from the buildbot days.
	Warning // 200 Yellow

	// InfraFailure if the component has finished incompletely due to a failure in infra.
	InfraFailure // A100 Purple

	// Exception if the component has finished incompletely and unexpectedly. This
	// is used for buildbot builds.
	Exception // A100 Purple

	// Expired if the component was never scheduled due to resource exhaustion.
	Expired // A200 Purple

	// DependencyFailure if the component has finished incompletely due to a failure in a
	// dependency.
	DependencyFailure // 100 Amber

	// WaitingDependency if the component has finished or paused execution due to an
	// incomplete dep.
	WaitingDependency // 100 Brown
)

func (Status) MarshalJSON

func (s Status) MarshalJSON() ([]byte, error)

MarshalJSON renders enums into String rather than an int when marshalling.

func (Status) String

func (i Status) String() string

func (Status) Terminal

func (s Status) Terminal() bool

Terminal returns true if the step status won't change.

type Summary

type Summary struct {
	// Status indicates the 'goodness' and lifetime of the thing. This usually
	// translates directly to a status color.
	Status Status

	// Start indicates when this thing started doing its action.
	Start time.Time

	// End indicates when this thing completed doing its action.
	End time.Time

	// Text is a possibly-multi-line summary of what happened.
	Text []string
}

Summary summarizes a thing (step, build, group of builds, whatever).

Jump to

Keyboard shortcuts

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