Documentation ¶
Index ¶
- Constants
- Variables
- type Bot
- type BuildComponent
- type BuildProgress
- type BuildSummary
- type Builder
- type BuilderGroup
- type BuilderRef
- type BuilderSummaryGroup
- type CIService
- type Category
- type Choices
- type Commit
- type ComponentType
- type Console
- type ConsoleElement
- type ConsoleGroup
- type ConsoleHeader
- type Frontpage
- type Interval
- type Link
- type LinkGroup
- type LinkSet
- type Logo
- type LogoBanner
- type LogoBase
- type MachinePool
- type MiloBuild
- type Navigation
- type Oncall
- type Property
- type PropertyGroup
- type Search
- type Settings
- type StepDisplayPref
- type TreeStatus
- type TreeStatusState
- type Trigger
Constants ¶
const ( // TreeMaintenance means the tree is under maintenance and is not open. // This has a color of purple. TreeMaintenance TreeStatusState = "maintenance" // TreeThrottled means the tree is backed up, and commits are throttled // to allow the tree to catch up. This has a color of yellow. TreeThrottled = "throttled" // TreeClosed means the tree is broken, and commits other than reverts // or fixes are not accepted at the time. This has a color of red. TreeClosed = "closed" // TreeOpen means the tree is not broken, and commits can happen freely. // This has a color of green. TreeOpen = "open" )
Variables ¶
var ( Windows = LogoBase{ Img: "windows.svg", Alt: "Microsoft Windows", } OSX = LogoBase{ Img: "apple.svg", Alt: "Apple OSX", } Ubuntu = LogoBase{ Img: "ubuntu.svg", Alt: "Canonical Ubuntu", } // These are devices. IOS = LogoBase{ Img: "ios_device.png", Alt: "Apple iOS", } Android = LogoBase{ Img: "android_device.png", Alt: "Google Android", } ChromeOS = LogoBase{ Img: "cros_device.png", Alt: "Google ChromeOS", } )
Define our known base logos
Functions ¶
This section is empty.
Types ¶
type BuildComponent ¶
type BuildComponent struct { // The parent of this component. For buildbot and swarmbucket builds, this // refers to the builder. For DM, this refers to whatever triggered the Quest. ParentLabel *Link `json:",omitempty"` // The main label for the component. Label *Link // Status of the build. Status model.Status // Banner is a banner of logos that define the OS and devices this // component is associated with. Banner *LogoBanner `json:",omitempty"` // Bot is the machine or execution instance that this component ran on. Bot *Link `json:",omitempty"` // Recipe is a link to the recipe this component is based on. Recipe *Link `json:",omitempty"` // Source is a link to the external (buildbot, swarming, dm, etc) data // source that this component relates to. Source *Link `json:",omitempty"` // Links to show adjacent to the main label. MainLink LinkSet `json:",omitempty"` // Links to show right below the main label. Top-level slice are rows of // links, second level shows up as SubLink []LinkSet `json:",omitempty"` // Designates the progress of the current component. Set null for no progress. Progress *BuildProgress `json:",omitempty"` // Pending is time interval that this build was pending. PendingTime Interval // Execution is time interval that this build was executing. ExecutionTime Interval // The type of component. This manifests itself as a little label on the // top left corner of the component. // This is either "RECIPE" or "STEP". An attempt is considered a recipe. Type ComponentType // Arbitrary text to display below links. One line per entry, // newlines are stripped. Text []string // Children of the step. Undefined for other types of build components. Children []*BuildComponent // Render a step as collapsed or expanded. Undefined for other types of build // components. Collapsed bool }
BuildComponent represents a single Step, subsetup, attempt, or recipe.
func (*BuildComponent) TextBR ¶
func (bc *BuildComponent) TextBR() []string
TextBR returns Text, but also splits each line by <br>
type BuildProgress ¶
type BuildProgress struct {
// contains filtered or unexported fields
}
BuildProgress is a way to show progress. Percent should always be specified.
type BuildSummary ¶
type BuildSummary struct { // Link to the build. Link *Link // Status of the build. Status model.Status // Pending is time interval that this build was pending. PendingTime Interval // Execution is time interval that this build was executing. ExecutionTime Interval // Revision is the main revision of the build. Revision *Commit // Arbitrary text to display below links. One line per entry, // newlines are stripped. Text []string // Blame is for tracking whose change the build belongs to, if any. Blame []*Commit }
BuildSummary is a summary of a build, with just enough information for display on a builder page.
type Builder ¶
type Builder struct { // Name of the builder Name string // Indicates that this Builder should render a blamelist for each build. // This is only supported for Buildbot (crbug.com/807846) HasBlamelist bool // Warning text, if any. Warning string CurrentBuilds []*BuildSummary PendingBuilds []*BuildSummary // PendingBuildNum is the number of pending builds, since the slice above // may be a snapshot instead of the full set. PendingBuildNum int FinishedBuilds []*BuildSummary // MachinePool is primarily used by buildbot builders to list the set of // machines that can run in a builder. It has no meaning in buildbucket or dm // and is expected to be nil. MachinePool *MachinePool // Groups is a list of links to builder groups that contain this builder. Groups []*Link // PrevCursor is a cursor to the previous page. PrevCursor string `json:",omitempty"` // NextCursor is a cursor to the next page. NextCursor string `json:",omitempty"` }
Builder denotes an ordered list of MiloBuilds
type BuilderGroup ¶
type BuilderGroup struct { // Name is the name of the group. Name string // Builders is a list of links to the builder page for that builder. Builders []Link }
BuilderGroup is a container to describe a named cluster of builders. This takes on other names in each CI services: Buildbot: Master Buildbucket: Bucket Dungeon Master: Bucket
type BuilderRef ¶
type BuilderRef struct { // ID is the canonical reference to a specific builder. ID string // ShortName is a string of length 1-3 used to label the builder. ShortName string // The most recent build summaries for this builder. Build []*model.BuildSummary // The most recent builder summary for this builder. Builder *model.BuilderSummary }
BuilderRef is an unambiguous reference to a builder.
It represents a single column of builds in the console view.
Implements ConsoleElement.
func (*BuilderRef) BuilderName ¶
func (br *BuilderRef) BuilderName() string
BuilderName returns the last component of ID (which is the Builder Name).
func (BuilderRef) NumLeafNodes ¶
func (br BuilderRef) NumLeafNodes() int
NumLeafNodes always returns 1 for BuilderDef since it is a leaf node.
func (BuilderRef) RenderHTML ¶
func (br BuilderRef) RenderHTML(buffer *bytes.Buffer, depth int, maxDepth int)
RenderHTML renders a BuilderRef as HTML with its builds in a column. If maxDepth is negative, render the HTML as flat rather than nested.
type BuilderSummaryGroup ¶
type BuilderSummaryGroup struct { // Name is a Link that contains the name of the console as well as a relative URL // to the console's page. Name *Link // Builders contains a list of builders for a given console and some data about // the latest state for each builder. Builders []*model.BuilderSummary }
BuilderSummaryGroup represents the summary of a console, including its name and the latest status of each of its builders.
type CIService ¶
type CIService struct { // Name is the display name of the service, which could be "Buildbot", // "SwarmBucket", or "Dungeon Master" Name string // Host points to the specific instance of this CI Service. Host *Link // BuilderGroups lists all of the known named groups of builders within this service. BuilderGroups []BuilderGroup }
CIService is a backing service for a Continuous Integration system, such as "buildbot", "swarmbucket", or "dm".
type Category ¶
type Category struct { Name string // contains filtered or unexported fields }
Category represents an interior node in a category tree for builders.
Implements ConsoleElement.
func NewCategory ¶
NewCategory allocates a new Category struct with no children.
func (*Category) AddBuilder ¶
func (c *Category) AddBuilder(categories []string, builder *BuilderRef)
AddBuilder inserts the builder into this Category tree.
AddBuilder will create new subcategories as a chain of Category structs as needed until there are no categories remaining. The builder is then made a child of the deepest such Category.
func (*Category) Children ¶
func (c *Category) Children() []ConsoleElement
Children returns a list of child console elements.
func (*Category) NumLeafNodes ¶
NumLeafNodes calculates the number of leaf nodes in Category.
type Choices ¶
type Choices struct { // A list of all possible choices. Choices []string // The selected choice. Selected string }
Choices - A dropdown menu showing all possible choices.
type Commit ¶
type Commit struct { // Who made the commit? AuthorName string // Email of the committer. AuthorEmail string // Time of the commit. CommitTime time.Time // Full URL of the main source repository. Repo string // Branch of the repo. Branch string // Requested revision of the commit or base commit. RequestRevision *Link // Revision of the commit or base commit. Revision *Link // The commit message. Description string // Rietveld or Gerrit URL if the commit is a patch. Changelist *Link // Browsable URL of the commit. CommitURL string // List of changed filenames. File []string }
Commit represents a single commit to a repository, rendered as part of a blamelist.
func (*Commit) RevisionHTML ¶
RevisionHTML returns a single rendered link for the revision, prioritizing Revision over RequestRevision.
type ComponentType ¶
type ComponentType int
ComponentType is the type of build component.
const ( // Recipe corresponds to a full recipe run. Dependencies are recipes. Recipe ComponentType = iota // Step is a single step of a recipe. Step // Summary denotes that this does not pretain to any particular step. Summary )
func (ComponentType) MarshalJSON ¶
func (c ComponentType) MarshalJSON() ([]byte, error)
MarshalJSON renders enums into String rather than an int when marshalling.
func (ComponentType) String ¶
func (i ComponentType) String() string
type Console ¶
type Console struct { Name string // Project is the LUCI project for which this console is defined. Project string // Header is an optional header for the console which contains links, oncall info, // and summaries of other, presumably related consoles. // // This field may be nil, which simply indicates to the renderer to not render a // header. Header *ConsoleHeader // Commit is a list of commits representing the list of commits to the left of the // console. Commit []Commit // Table is a tree of builder categories used to generate the console's main table. // // Leaf nodes must always be of concrete type BuilderRef, interior nodes must // always be of type Category. The root node is a dummy node without a name // to simplify the implementation. Table Category // MaxDepth represents the maximum tree depth of Table. MaxDepth int // FaviconURL is the URL to the favicon for this console. FaviconURL string }
Console represents a console view. Commit contains a list of commits to be displayed in this console. Table contains a tree of categories whose leaves are builders. The builders maintain information regarding the builds for the corresponding commits in Commit. MaxDepth is a useful piece of metadata for adding in empty rows in the console's header.
type ConsoleElement ¶
type ConsoleElement interface { // Writes HTML into the given byte buffer. // // The two integer parameters represent useful pieces of metadata in // rendering: current depth, and maximum depth. RenderHTML(*bytes.Buffer, int, int) // Returns number of leaf nodes in this console element. NumLeafNodes() int }
ConsoleElement represents a single renderable console element.
type ConsoleGroup ¶
type ConsoleGroup struct { // Title is the title for this group of consoles and may link to anywhere. Title *Link // Consoles is the list of console summaries contained without this group. Consoles []*BuilderSummaryGroup }
ConsoleGroup represents a group of console summaries which may optionally be titled. Logically, it represents a group of consoles with some shared quality (e.g. tree closers).
type ConsoleHeader ¶
type ConsoleHeader struct { // Oncalls is a list of oncall roles and the current people who fill that role // that will be displayed in the header.. Oncalls []Oncall // Links is a list of link groups to be displayed in the header. Links []LinkGroup // ConsoleGroups is a list of groups of console summaries to be displayed in // the header. // // A console group without a title will have all of its console summaries // appear "ungrouped" when rendered. ConsoleGroups []ConsoleGroup // TreeStatus indicates the status of the tree if it is not nil. TreeStatus *TreeStatus }
ConsoleHeader represents the header of a console view, containing a set of links, oncall details, as well as a set of console summaries for other, relevant consoles.
type Interval ¶
type Interval struct { // Started denotes the start time of this interval. Started time.Time // Finished denotest the end time of this interval. Finished time.Time // Duration is the length of the interval. Duration time.Duration }
Interval is a time interval which has a start, an end and a duration.
func NewInterval ¶
NewInterval returns a new interval struct. If end time is empty (eg. Not completed) set end time to empty but set duration to the difference between start and now. Getting called with an empty start time and non-empty end time is undefined.
type Link ¶
type Link struct { model.Link // AriaLabel is a spoken label for the link. Used as aria-label under the anchor tag. AriaLabel string `json:",omitempty"` // Img is an icon for the link. Not compatible with label. Rendered as <img> Img string `json:",omitempty"` // Alt text for the image, or title text with text link. Alt string `json:",omitempty"` // Alias, if true, means that this link is an [alias link]. Alias bool `json:",omitempty"` }
Link denotes a single labeled link.
JSON tags here are for test expectations.
func NewEmptyLink ¶
NewEmptyLink creates a Link struct acting as a pure text label.
func NewPatchLink ¶
func NewPatchLink(cl buildbucketpb.BuildSet) *Link
NewPatchLink is the right way (TM) to generate links to Rietveld/Gerrit CLs.
Returns nil if provided buildset is not Rietveld or Gerrit CL.
type LinkGroup ¶
type LinkGroup struct { // Name is the name of the category this group of links belongs to. Name *Link // Links is a list of links in this link group. Links []*Link }
LinkGroup represents a set of links grouped together by some category.
type LinkSet ¶
type LinkSet []*Link
LinkSet is an ordered collection of Link objects that will be rendered on the same line.
type LogoBanner ¶
LogoBanner is a banner of logos that define the OS and devices that a component is associated with.
type MachinePool ¶
MachinePool represents the capacity and availability of a builder.
func NewMachinePool ¶
func NewMachinePool(c context.Context, bots []model.Bot) *MachinePool
NewMachinePool calculates stats from a model.Bot and generates a MachinePool. This requires a context because setting the UI Status field requires the current time.
type MiloBuild ¶
type MiloBuild struct { // Summary is a top level summary of the page. Summary BuildComponent // Trigger gives information about how and with what information // the build was triggered. Trigger *Trigger // Components is a detailed list of components and subcomponents of the page. // This is most often used for steps (buildbot/luci) or deps (luci). Components []*BuildComponent // PropertyGroup is a list of input and output property of this page. // This is used for build and emitted properties (buildbot) and quest // information (luci). This is also grouped by the "type" of property // so different categories of properties can be separated and sorted. // // This is not a map so code that constructs MiloBuild can control the // order of property groups, for example show important properties // first. PropertyGroup []*PropertyGroup // Blame is a list of people and commits that is likely to be in relation to // the thing displayed on this page. Blame []*Commit // Mode to render the steps. StepDisplayPref StepDisplayPref }
MiloBuild denotes a full renderable Milo build page.
func (*MiloBuild) BuildSummary ¶
func (b *MiloBuild) BuildSummary() *BuildSummary
BuildSummary returns the BuildSummary representation of the MiloBuild. This is the subset of fields that is interesting to the builder view.
func (*MiloBuild) Fix ¶
Fix fixes various inconsistencies that users expect to see as part of the Build, but didn't make sense as part of the individual components, including: * If the build is complete, all open steps should be closed. * Parent steps containing failed steps should also be marked as failed. * Components' Collapsed field is set based on StepDisplayPref field. * Parent step name prefix is trimmed from the nested substeps. * Enforce correct values for StepDisplayPref (set to Default if incorrect). * Set parent step durations to be the combination of all children.
type Navigation ¶
Navigation is the top bar of the page, used for navigating out of the page.
type Oncall ¶
type Oncall struct { // Name is the name of the oncall role. This is set by Milo. Name string `json:"-"` // Primary is the username of the primary oncall. This is used in lieu of emails. // This is filled in from the remote JSON. Primary string // Secondaries are the usernames of the secondary oncalls. This is used in lieu of emails. // This is filled in from the remote JSON. Secondaries []string // Emails is a list of email addresses for the individuals who are currently in // that role. This is loaded from the sheriffing json. Emails []string }
Oncall represents an oncall role with the current individuals in that role, represented by their email addresses.
type Property ¶
Property specifies k/v pair representing some sort of property, such as buildbot property, quest property, etc.
type PropertyGroup ¶
PropertyGroup is a cluster of similar properties. In buildbot land this would be the "source". This is a way to segregate different types of properties such as Quest properties, swarming properties, emitted properties, revision properties, etc.
func (PropertyGroup) Len ¶
func (p PropertyGroup) Len() int
func (PropertyGroup) Less ¶
func (p PropertyGroup) Less(i, j int) bool
func (PropertyGroup) Swap ¶
func (p PropertyGroup) Swap(i, j int)
type Search ¶
type Search struct { // CIServices is a backing service for a Continuous Integration system, // such as "buildbot", "swarmbucket", or "dm". CIServices []CIService }
type Settings ¶
type Settings struct { // Where the form should go. ActionURL string // Themes is a list of usable themes for Milo Theme *Choices }
Settings denotes a full renderable Milo settings page.
type StepDisplayPref ¶
type StepDisplayPref string
StepDisplayPref is the display preference for the steps.
const ( // StepDisplayDefault means that all steps are visible, green steps are // collapsed. StepDisplayDefault StepDisplayPref = "default" // StepDisplayExpanded means that all steps are visible, nested steps are // expanded. StepDisplayExpanded StepDisplayPref = "expanded" // StepDisplayNonGreen means that only non-green steps are visible, nested // steps are expanded. StepDisplayNonGreen StepDisplayPref = "non-green" )
type TreeStatus ¶
type TreeStatus struct { // Username is the name of the user who changed the status last. Username string `json:"username"` CanCommitFreely bool `json:"can_commit_freely"` // GeneralState is the general state of the tree, which also indicates // the color of the tree. GeneralState TreeStatusState `json:"general_state"` Key int64 `json:"key"` // Date is when the tree was last updated. The format is YYYY-mm-DD HH:MM:SS.ssssss // and implicitly UTC. eg. "2017-11-10 14:29:21.804080" Date string `json:"date"` // Message is a human readable description of the tree. Message string `json:"message"` // URL is a link to the root status page. This is generated on the Milo side, // not provided by the status app. URL *url.URL }
TreeStatus represents the very top bar of the console, above the header.
type Trigger ¶
type Trigger struct { Commit // Source is the trigger source. In buildbot, this would be the "Reason". // This has no meaning in SwarmBucket and DM yet. Source string // Project is the name of the LUCI project responsible for // triggering the build. Project string }
Trigger is the combination of pointing to a single commit, with information about where that commit came from (e.g. the repository), and the project that triggered it.