Documentation ¶
Index ¶
- Constants
- Variables
- type Bot
- type Build
- type BuildComponent
- type BuildPage
- func (bp *BuildPage) BuildSetLinks() []template.HTML
- func (bp *BuildPage) BuildSets() []string
- func (bp *BuildPage) BuildbucketLink() *Link
- func (bp *BuildPage) InputProperties() []property
- func (bp *BuildPage) OutputProperties() []property
- func (bp *BuildPage) Steps() []*Step
- func (bp *BuildPage) Timeline() string
- type BuildProgress
- type BuildSummaryLegacy
- type BuilderGroup
- type BuilderLegacy
- type BuilderPage
- 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 MiloBuildLegacy
- type Navigation
- type Oncall
- type Property
- type PropertyGroup
- type Search
- type Settings
- type Step
- 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 Build ¶
type Build struct { *buildbucketpb.Build // Now is the current time, used to generate durations that may depend // on the current time. Now *timestamp.Timestamp }
Build wraps a buildbucketpb.Build to provide useful templating functions. It is used in both BuildPage (in this file) and BuilderPage (builder.go).
func (*Build) Banners ¶
Banners returns names of icons to display next to the build number. Currently displayed: * OS, as determined by swarming dimensions. TODO(hinoka): For device builders, display device type, and number of devices.
func (*Build) BuilderLink ¶
BuilderLink returns a link to the builder in b.
func (*Build) ChangeLinks ¶
ChangeLinks returns a slice of links to build input gerrit changes.
func (*Build) CommitLinkHTML ¶
CommitLinkHTML returns an HTML link pointing to the output commit, or input commit if the output commit is not available.
func (*Build) HumanStatus ¶
HumanStatus returns a human friendly string for the status.
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 BuildPage ¶
type BuildPage struct { // Build is the underlying build proto for the build page. Build // RelatedBuilds are build summaries with the same buildset. RelatedBuilds []*Build // Related is a flag for turning on the related builds tab. Related bool // Blame is a list of people and commits that likely caused the build result. // It is usually used as the list of commits between the previous run of the // build on the same builder, and this run. Blame []*Commit // BuildBugLink is a URL to be used a feedback link for the build. If the // link could not be generated an empty string will be returned. There will be // no link, for example, if the project has not set up their build bug template. BuildBugLink string // BuildbucketHost is the hostname for the buildbucket instance this build came from. BuildbucketHost string // Errors contains any non-critical errors encountered while rendering the page. Errors []error // Mode to render the steps. StepDisplayPref StepDisplayPref // Iff true, show all log links whose name starts with '$'. ShowDebugLogsPref bool // BlamelistError holds errors related to the blamelist. // This determines the behavior of clicking the "blamelist" tab. BlamelistError error // ForcedBlamelist indicates that the user forced a blamelist load. ForcedBlamelist bool // contains filtered or unexported fields }
BuildPage represents a build page on Milo. The core of the build page is the underlying build proto, but can contain extra information depending on the context, for example a blamelist, and the user's display preferences.
func NewBuildPage ¶
func NewBuildPage(c context.Context, b *buildbucketpb.Build) *BuildPage
func (*BuildPage) BuildSetLinks ¶
func (*BuildPage) BuildbucketLink ¶
BuildbucketLink returns a link to the buildbucket version of the page.
func (*BuildPage) InputProperties ¶
func (bp *BuildPage) InputProperties() []property
func (*BuildPage) OutputProperties ¶
func (bp *BuildPage) OutputProperties() []property
type BuildProgress ¶
type BuildProgress struct {
// contains filtered or unexported fields
}
BuildProgress is a way to show progress. Percent should always be specified.
type BuildSummaryLegacy ¶
type BuildSummaryLegacy 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 }
BuildSummaryLegacy is a summary of a build, with just enough information for display on a builder page.
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
func (*BuilderGroup) Sort ¶
func (g *BuilderGroup) Sort()
Sort sorts Builders by the lowercase of their name.
type BuilderLegacy ¶
type BuilderLegacy 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 []*BuildSummaryLegacy PendingBuilds []*BuildSummaryLegacy // PendingBuildNum is the number of pending builds, since the slice above // may be a snapshot instead of the full set. PendingBuildNum int FinishedBuilds []*BuildSummaryLegacy // 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"` }
BuilderLegacy denotes an ordered list of MiloBuilds
type BuilderPage ¶
type BuilderPage struct { BuilderName string ScheduledBuilds []*Build ScheduledBuildsComplete bool StartedBuilds []*Build StartedBuildsComplete bool EndedBuilds []*Build MachinePool *MachinePool // Views is a list of links to milo views that reference this builder. Views []*Link // PrevPageToken is a token to the previous page. PrevPageToken string // NextPageToken is a token to the next page. NextPageToken string }
func (*BuilderPage) HasChanges ¶
func (bp *BuilderPage) HasChanges() bool
HasChanges returns true if at least one ended build has at least one CL.
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 // StepLegacy is a single step of a recipe. StepLegacy // 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.
func (*Console) HasCategory ¶
HasCategory returns true if there is at least a single category defined in the console.
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.GerritChange) *Link
NewPatchLink generates a URL to a 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.
func (LinkSet) IsDebugLink ¶
IsDebugLink returns true iff the first link in the linkset starts with "$".
type LogoBanner ¶
LogoBanner is a banner of logos that define the OS and devices that a component is associated with.
type MachinePool ¶
type MachinePool struct { Total int Offline int Idle int Busy int Bots []Bot Dimensions []string SwarmingHost string }
MachinePool represents the capacity and availability of a builder.
func NewMachinePool ¶
func NewMachinePool(c context.Context, botPool *model.BotPool) *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.
func (*MachinePool) SwarmingURL ¶
func (mp *MachinePool) SwarmingURL() string
SwarmingURL returns the swarming bot URL for the machine pool, if available.
type MiloBuildLegacy ¶
type MiloBuildLegacy 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 MiloBuildLegacy 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 // Iff true, show all log links whose name starts with '$'. ShowDebugLogsPref bool }
MiloBuildLegacy denotes a full renderable Milo build page. This is slated to be deprecated in April 2019 after the BuildBot turndown. This is to be replaced by a new BuildPage struct, which encapsulates a Buildbucket Build Proto.
func (*MiloBuildLegacy) BuildSummary ¶
func (b *MiloBuildLegacy) BuildSummary() *BuildSummaryLegacy
BuildSummary returns the BuildSummary representation of the MiloBuildLegacy. This is the subset of fields that is interesting to the builder view.
func (*MiloBuildLegacy) Fix ¶
func (b *MiloBuildLegacy) Fix(c context.Context)
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 Step ¶
Step encapsulates a buildbucketpb.Step, and also allows it to carry nesting information.
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.