luci: Index | Files

package buildbotapi

import ""

package buildbotapi defines types used in Buildbot build protocol, e.g. build, step, log, etc. The types can used together with encoding/json package.


Package Files

buildid.go log.go result.go result_string.go structs.go time.go


var ErrPropertyNotFound = errors.New("property not found")

ErrPropertyNotFound is returned by (*Build).PropertyValue if a property is no found.

type Build Uses

type Build struct {
    Master      string
    Blame       []string `json:"blame"` // email addresses
    Buildername string   `json:"builderName"`
    // This needs to be reflected.  This can be either a String or a Step.
    Currentstep interface{} `json:"currentStep"`
    // We don't care about this one.
    Eta    interface{} `json:"eta"`
    Logs   []Log       `json:"logs"`
    Number int         `json:"number"`
    // This is a slice of tri-tuples of [property name, value, source].
    // property name is always a string
    // value can be a string or float
    // source is optional, but is always a string if present
    Properties  []*Property  `json:"properties"`
    Reason      string       `json:"reason"`
    Results     Result       `json:"results"`
    Slave       string       `json:"slave"`
    Sourcestamp *SourceStamp `json:"sourceStamp"`
    Steps       []Step       `json:"steps"`
    Text        []string     `json:"text"`
    Times       TimeRange    `json:"times"`
    // This one is injected by Milo.  Does not exist in a normal json query.
    TimeStamp Time `json:"timeStamp"`
    // This one is marked by Milo, denotes whether or not the build is internal.
    Internal bool `json:"internal"`
    // This one is computed by Milo for indexing purposes.  It does so by
    // checking to see if times[1] is null or not.
    Finished bool `json:"finished"`
    // OS is a string representation of the OS the build ran on.  This is
    // derived best-effort from the slave information in the master JSON.
    // This information is injected into the buildbot builds via puppet, and
    // comes as Family + Version.  Family is (windows, Darwin, Debian), while
    // Version is the version of the OS, such as (XP, 7, 10) for windows.
    OSFamily  string `json:"osFamily"`
    OSVersion string `json:"osVersion"`

    // Emulated indicates that this Buildbot build was emulated from non-Buildbot
    // e.g. from LUCI.
    Emulated bool `json:"emulated"`
    // ViewPath is an absolute path, relative to this milo host, which can be used
    // to display this Build. This Path includes a leading "/". Callers can turn
    // this into a URL by:
    //   "https://" + MiloHost + Build.ViewPath
    ViewPath string `json:"view_path"`

Build is a single build json on buildbotapi.

func (*Build) Experimental Uses

func (b *Build) Experimental() bool

Experimental returns true if b is experimental.

func (*Build) ID Uses

func (b *Build) ID() BuildID

ID returns b's BuildID.

func (*Build) PropertyValue Uses

func (b *Build) PropertyValue(name string) interface{}

PropertyValue returns the named property value. If such property does not exist, returns ErrPropertyNotFound.

func (*Build) Status Uses

func (b *Build) Status() model.Status

type BuildID Uses

type BuildID struct {
    Master  string
    Builder string
    Number  int

BuildID identifies a buildbot build.

func (BuildID) String Uses

func (id BuildID) String() string

String returns a string "{master}/{builder}/{number}".

func (BuildID) Validate Uses

func (id BuildID) Validate() error

Validate returns an error if id is invalid.

type Builder Uses

type Builder struct {
    Buildername   string `json:"builderName,omitempty"`
    Basedir       string `json:"basedir"`
    CachedBuilds  []int  `json:"cachedBuilds"`
    PendingBuilds int    `json:"pendingBuilds"`
    // This one is specific to the pubsub interface.  This is limited to 75,
    // so it could differ from PendingBuilds
    PendingBuildStates []*Pending `json:"pendingBuildStates"`
    Category           string     `json:"category"`
    CurrentBuilds      []int      `json:"currentBuilds"`
    Slaves             []string   `json:"slaves"`
    State              string     `json:"state"`

Builder is a builder struct from the master json, _not_ the builder json.

type Change Uses

type Change struct {
    At       string  `json:"at"`
    Branch   *string `json:"branch"`
    Category string  `json:"category"`
    Comments string  `json:"comments"`
    // This could be a list of strings or list of struct { Name string } .
    Files      []interface{}   `json:"files"`
    Number     int             `json:"number"`
    Project    string          `json:"project"`
    Properties [][]interface{} `json:"properties"`
    Repository string          `json:"repository"`
    Rev        string          `json:"rev"`
    Revision   string          `json:"revision"`
    Revlink    string          `json:"revlink"`
    When       int             `json:"when"`
    Who        string          `json:"who"` // email address

Change describes a commit in a repository as part of a changesource of blamelist.

func (*Change) GetFiles Uses

func (bc *Change) GetFiles() []string

type ChangeSource Uses

type ChangeSource struct {
    Description string `json:"description"`

ChangeSource is a changesource (ie polling source) usually tied to a master's scheduler.

type LinkAlias Uses

type LinkAlias struct {
    URL  string `json:"url"`
    Text string `json:"text"`
func (a *LinkAlias) Link() *ui.Link

type Log Uses

type Log struct {
    Name, URL string

func (*Log) MarshalJSON Uses

func (l *Log) MarshalJSON() ([]byte, error)

func (*Log) UnmarshalJSON Uses

func (l *Log) UnmarshalJSON(data []byte) error

type Master Uses

type Master struct {
    AcceptingBuilds struct {
        AcceptingBuilds bool `json:"accepting_builds"`
    }   `json:"accepting_builds"`

    Builders map[string]*Builder `json:"builders"`

    Buildstate struct {
        AcceptingBuilds bool      `json:"accepting_builds"`
        Builders        []Builder `json:"builders"`
        Project         Project   `json:"project"`
        Timestamp       Time      `json:"timestamp"`
    }   `json:"buildstate"`

    ChangeSources map[string]ChangeSource `json:"change_sources"`

    Changes map[string]Change `json:"changes"`

    Clock struct {
        Current struct {
            Local string `json:"local"`
            Utc   string `json:"utc"`
            UtcTs Time   `json:"utc_ts"`
        }   `json:"current"`
        ServerStarted struct {
            Local string `json:"local"`
            Utc   string `json:"utc"`
            UtcTs Time   `json:"utc_ts"`
        }   `json:"server_started"`
        ServerUptime Time `json:"server_uptime"`
    }   `json:"clock"`

    Project Project `json:"project"`

    Slaves map[string]*Slave `json:"slaves"`

    Varz struct {
        AcceptingBuilds bool `json:"accepting_builds"`
        Builders        map[string]struct {
            ConnectedSlaves int    `json:"connected_slaves"`
            CurrentBuilds   int    `json:"current_builds"`
            PendingBuilds   int    `json:"pending_builds"`
            State           string `json:"state"`
            TotalSlaves     int    `json:"total_slaves"`
        }   `json:"builders"`
        ServerUptime Time `json:"server_uptime"`
    }   `json:"varz"`

    // This is injected by the pubsub publisher on the buildbot side.
    Name string `json:"name"`

Master This is json definition for<master>/json endpoints.

type Pending Uses

type Pending struct {
    Source      SourceStamp `json:"source"`
    Reason      string      `json:"reason"`
    SubmittedAt int         `json:"submittedAt"`
    BuilderName string      `json:"builderName"`

type Project Uses

type Project struct {
    BuildbotURL string `json:"buildbotURL"`
    Title       string `json:"title"`
    Titleurl    string `json:"titleURL"`

type Property Uses

type Property struct {
    Name   string
    Value  interface{}
    Source string

func (*Property) MarshalJSON Uses

func (p *Property) MarshalJSON() ([]byte, error)

func (*Property) UnmarshalJSON Uses

func (p *Property) UnmarshalJSON(d []byte) error

type Result Uses

type Result int
const (
    NoResult Result = iota - 1

func (*Result) MarshalJSON Uses

func (r *Result) MarshalJSON() ([]byte, error)

func (Result) Status Uses

func (r Result) Status() model.Status

Status converts r into a model.Status.

func (Result) String Uses

func (i Result) String() string

func (*Result) UnmarshalJSON Uses

func (r *Result) UnmarshalJSON(data []byte) error

type Slave Uses

type Slave struct {
    // RecentBuilds is a map of builder name to a list of recent finished build
    // numbers on that builder.
    RecentBuilds  map[string][]int `json:"builders"`
    Connected     bool             `json:"connected"`
    Host          string           `json:"host"`
    Name          string           `json:"name"`
    Runningbuilds []*Build         `json:"runningBuilds"`
    Version       string           `json:"version"`
    // This is like runningbuilds, but instead of storing the full build,
    // just reference the build by builder: build num.
    RunningbuildsMap map[string][]int `json:"runningBuildsMap"`

Slave describes a slave on a master from a master json, and also includes the full builds of any currently running builds.

type SourceStamp Uses

type SourceStamp struct {
    Branch     *string  `json:"branch"`
    Changes    []Change `json:"changes"`
    Haspatch   bool     `json:"hasPatch"`
    Project    string   `json:"project"`
    Repository string   `json:"repository"`
    Revision   string   `json:"revision"`

SourceStamp is a list of changes (commits) tagged with where the changes came from, ie. the project/repository. Also includes a "main" revision."

type Step Uses

type Step struct {
    // We actually don't care about ETA.  This is represented as a string if
    // it's fetched from a build json, but a float if it's dug out of the
    // slave portion of a master json.  We'll just set it to interface and
    // ignore it.
    Eta          interface{}     `json:"eta"`
    Expectations [][]interface{} `json:"expectations"`
    Hidden       bool            `json:"hidden"`
    IsFinished   bool            `json:"isFinished"`
    IsStarted    bool            `json:"isStarted"`
    Logs         []Log           `json:"logs"`
    Name         string          `json:"name"`
    Results      StepResults     `json:"results"`
    Statistics   struct {
    }   `json:"statistics"`
    StepNumber int               `json:"step_number"`
    Text       []string          `json:"text"`
    Times      TimeRange         `json:"times"`
    Urls       map[string]string `json:"urls"`

    // Log link aliases.  The key is a log name that is being aliases. It should,
    // generally, exist within the Logs. The value is the set of aliases attached
    // to that key.
    Aliases map[string][]*LinkAlias `json:"aliases"`

Step represents a single step in a buildbot build.

type StepResults Uses

type StepResults struct {
    // contains filtered or unexported fields

func (*StepResults) MarshalJSON Uses

func (r *StepResults) MarshalJSON() ([]byte, error)

func (*StepResults) UnmarshalJSON Uses

func (r *StepResults) UnmarshalJSON(data []byte) error

type Time Uses

type Time struct {

func (*Time) MarshalJSON Uses

func (t *Time) MarshalJSON() ([]byte, error)

MarshalJSON marshals t to JSON at microsecond resolution.

func (*Time) UnmarshalJSON Uses

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals t from JSON at microsecond resolution.

type TimeRange Uses

type TimeRange struct {
    Start, Finish Time

func (*TimeRange) MarshalJSON Uses

func (t *TimeRange) MarshalJSON() ([]byte, error)

func (*TimeRange) UnmarshalJSON Uses

func (t *TimeRange) UnmarshalJSON(data []byte) error

Package buildbotapi imports 9 packages (graph) and is imported by 6 packages. Updated 2020-03-29. Refresh now. Tools for package owners.