Documentation
¶
Overview ¶
TODO(rjeczalik): Agents.Filter{,Out} and Messages.Filter{,Out} share the same
implementation, but because of lack of generics it is duplicated right now. If it turns out it must be duplicated for even more types it would be nice to find out whether it's possible to create cheap implementation using reflect package.
Index ¶
- Constants
- Variables
- type Agent
- type AgentStatus
- type Agents
- type ArtifactFetcher
- type BuildArtifact
- type BuildRequestStatus
- type BuildResult
- type BuildState
- type BuildStatus
- type BuildType
- type CheckoutType
- type Client
- type CommandResult
- type CommandResultProperties
- type InvalidBuildError
- type Message
- type Messages
- type ProjectBootstrap
- type ProjectCleanup
- type ProjectStage
- type Severity
- type StageResult
- type TestSummary
- type TriggerOptions
Constants ¶
const (
// AgentPending TODO(rjeczalik): document
AgentPending = "[pending]"
)
const ProjectPersonal = "personal"
Variables ¶
var ErrTimeout = errors.New("pulse: request has timed out")
var Error = func(m *Message) bool { return m.Severity == SeverityError }
Error predicate returns true when the message is of an error kind.
var Info = func(m *Message) bool { return m.Severity == SeverityInfo }
Info predicate returns true when the message is of an information kind.
var Offline = func(agent *Agent) bool { return agent.Status == AgentOffline }
Offline predicate returns true when the agent has an offline state.
var Sync = func(agent *Agent) bool { return agent.Status == AgentSync }
Sync predicate returns true when the agent has a synchronizing state.
var Warning = func(m *Message) bool { return m.Severity == SeverityWarning }
Warning predicate returns true when the message is of a warning kind.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct { Name string Status AgentStatus `xmlrpc:"status"` Host string `xmlrpc:"location"` }
Agent TODO(rjeczalik): document
type AgentStatus ¶
type AgentStatus string
AgentStatus TODO(rjeczalik): document
const ( AgentOffline AgentStatus = "offline" AgentSync AgentStatus = "Synchronizing" AgentIdle AgentStatus = "idle" AgentBuilding AgentStatus = "building" AgentDisabled AgentStatus = "disabled" )
type Agents ¶
type Agents []Agent
Agents is an utility wrapper for a slice of agents, which extends it with a filtering functionality.
type ArtifactFetcher ¶
ArtifactFetcher is type for fetching artifacts based on info from BuildArtifact type
func NewArtifactFetcher ¶
func NewArtifactFetcher(url, tok, dir string) *ArtifactFetcher
NewArtifactFetcher returns new ArtifactFetcher
func (*ArtifactFetcher) Fetch ¶
func (af *ArtifactFetcher) Fetch(a *BuildArtifact, project string) (err error)
Fetch prepares file paths to save artifact files and calls downloadFile
type BuildArtifact ¶
type BuildArtifact struct { Stage string `xmlrpc:"stage"` Command string `xmlrpc:"command"` Name string `xmlrpc:"name"` DataPath string `xmlrpc:"dataPath"` Explicit bool `xmlrpc:"explicit"` Featured bool `xmlrpc:"featured"` Permalink string `xmlrpc:"permalink"` Files []string }
BuildArtifact holds infromation about project's artifacts
type BuildRequestStatus ¶
type BuildRequestStatus struct { Status BuildStatus `xmlrpc:"status"` // TODO(rjeczalik): According to the API documentation ID and AssimID must // both be int, but Pulse sends it as strings. ID string `xmlrpc:"buildId"` AssimID string `xmlrpc:"assimilatedId"` RejectReason string `xmlrpc:"rejectionReason"` }
BuildRequestStatus TODO(rjeczalik): document
type BuildResult ¶
type BuildResult struct { ID int64 `xmlrpc:"id"` Complete bool `xmlrpc:"completed"` End time.Time `xmlrpc:"endTime"` EndUnix string `xmlrpc:"endTimeMillis"` Errors int `xmlrpc:"errorCount"` Maturity string `xmlrpc:"maturity"` Owner string `xmlrpc:"owner"` Personal bool `xmlrpc:"personal"` Pinned bool `xmlrpc:"pinned"` Progress int `xmlrpc:"progress"` Project string `xmlrpc:"project"` Revision string `xmlrpc:"revision"` Reason string `xmlrpc:"reason"` Stages []StageResult `xmlrpc:"stages"` Start time.Time `xmlrpc:"startTime"` StartUnix string `xmlrpc:"startTimeMillis"` State BuildState `xmlrpc:"status"` Test TestSummary `xmlrpc:"tests"` Success bool `xmlrpc:"succeeded"` Version string `xmlrpc:"version"` Warnings int `xmlrpc:"warningCount"` }
BuildResult TODO(rjeczalik): document
type BuildState ¶
type BuildState string
BuildState TODO(rjeczalik): document
const ( BuildCancelling BuildState = "cancelling" BuildError BuildState = "error" BuildFailure BuildState = "failure" BuildInProgress BuildState = "in progress" BuildPending BuildState = "pending" BuildSkipped BuildState = "skipped" BuildSuccess BuildState = "success" BuildTerminating BuildState = "terminating" BuildTerminated BuildState = "terminated" BuildWarnings BuildState = "warnings" )
type BuildStatus ¶
type BuildStatus string
BuildStatus TODO(rjeczalik): document
const ( BuildUnknown BuildStatus = "UNKNOWN" BuildNeverBuilt BuildStatus = "NEVER BUILT" BuildUnhandled BuildStatus = "UNHANDLED" BuildRejected BuildStatus = "REJECTED" BuildAssimilated BuildStatus = "ASSIMILATED" BuildQueued BuildStatus = "QUEUED" BuildCancelled BuildStatus = "CANCELLED" BuildActivated BuildStatus = "ACTIVATED" )
type CheckoutType ¶
type CheckoutType string
CheckoutType TODO(rjeczalik): document
const ( CheckoutClean CheckoutType = "CLEAN_CHECKOUT" CheckoutIncremental CheckoutType = "INCREMENTAL_CHECKOUT" CheckoutNone CheckoutType = "NO_CHECKOUT" )
type Client ¶
type Client interface { // Agents returns every machine registred with Pulse server that the user // holding the session has an access to. Agents() (Agents, error) // BuildID gives a build ID associated with given request ID. If a build // is queued and not started yet it waits up to 15 seconds before timing out. BuildID(reqid string) (int64, error) // BuildResults gives full statistics and information for a build with given // ID and project name. BuildResult(project string, id int64) ([]BuildResult, error) // Clear clears a working directories on agents for a given project name. Clear(project string) error // Close terminates the user session. Close() error // ConfigStage TODO(rjeczalik): document ConfigStage(project, stage string) (ProjectStage, error) // Init (re-)initializes the project with a given name. It stops the SCM polling, // clears Pulse server's local clone of a repository, configured for // a given project, and checks it out again. Init(project string) (bool, error) // LastestBuildResult returns statistics for a latest completed build of // a given project. LatestBuildResult(project string) ([]BuildResult, error) // Messages returns all info, warning and error messages for a particular // build of a given project. Messages(project string, id int64) (Messages, error) // Projects gives every project name that the user holding the session // has an access to. Projects() ([]string, error) // Stages gives every stage name for a given project. Stages(project string) ([]string, error) // SetTimeout TODO(rjeczalik): document SetTimeout(d time.Duration) // SetConfigStage TODO(rjeczalik): document SetConfigStage(project string, s ProjectStage) error // Trigger triggers a build for a given project returning request IDs // of builds caused by that trigger. Trigger(project string) ([]string, error) // Artifact downloads artifacts for given project and build number Artifact(id int64, project, dir, url string) error }
Client is a RPC client for talking with Pulse Remote API endpoint. It is expected that Client holds valid user session, which can be terminated by a call to Close method.
type CommandResult ¶
type CommandResult struct { Complete bool `xmlrpc:"completed"` End time.Time `xmlrpc:"endTime"` Errors int `xmlrpc:"errorCount"` Name string `xmlrpc:"name"` Progress int `xmlrpc:"progress"` Start time.Time `xmlrpc:"startTime"` Status BuildStatus `xmlrpc:"status"` Success bool `xmlrpc:"succeeded"` Properties CommandResultProperties `xmlrpc:"properties"` Warnings int `xmlrpc:"warningCount"` }
CommandResult TODO(rjeczalik): document
type CommandResultProperties ¶
type CommandResultProperties struct { // TODO(rjeczalik): According to the API documentation Exit must be int, // but Pulse sends it as string. Exit string `xmlrpc:"exit code"` CmdLine string `xmlrpc:"command line"` WorkDir string `xmlrpc:"working directory"` }
CommandResultProperties TODO(rjeczalik): document
type InvalidBuildError ¶
type InvalidBuildError struct { ID int64 Status BuildStatus ReqID string }
InvalidBuildError TODO(rjeczalik): document
func (InvalidBuildError) Error ¶
func (e InvalidBuildError) Error() string
type Message ¶
type Message struct { Severity Severity `xmlrpc:"level"` Message string `xmlrpc:"message"` StageName string `xmlrpc:"stage"` CommandName string `xmlrpc:"command"` ArtifactName string `xmlrpc:"artifact"` Path string `xmlrpc:"path"` }
Message TODO(rjeczalik): document
type Messages ¶
type Messages []Message
Messages is an utility wrapper for a slice of messages, which extends it with a filtering functionality.
func (Messages) Filter ¶
Filter returns a slice which is a subset of Messages. Every message in the subset fulfills every predicate. A predicate must not modify the Message struct. The method returns nil as soon as resulting set becomes empty, which may cause that not all the predicates might get called.
type ProjectBootstrap ¶
type ProjectBootstrap struct { Meta string `xmlrpc:"meta.symbolicName"` Build BuildType `xmlrpc:"buildType"` Checkout CheckoutType `xmlrpc:"checkoutType"` TempDir string `xmlrpc:"tempDirPattern"` PersistentDir string `xmlrpc:"persistentDirPattern"` }
ProjectBootstrap TODO(rjeczalik): document 'projects/$PROJECT/bootstrap'
type ProjectCleanup ¶
type ProjectCleanup struct { }
ProjectCleanup TODO(rjeczalik): document 'projects/$PROJECT/cleanup'
type ProjectStage ¶
type ProjectStage struct { Meta string `xmlrpc:"meta.symbolicName"` Name string `xmlrpc:"name"` Recipe string `xmlrpc:"recipe"` Agent string `xmlrpc:"agent"` Enabled bool `xmlrpc:"enabled"` Terminate bool `xmlrpc:"terminateBuildOnFailure"` }
ProjectStage TODO(rjeczalik): document 'projects/$PROJECT/stages'
type StageResult ¶
type StageResult struct { Agent string `xmlrpc:"agent"` Complete bool `xmlrpc:"completed"` End time.Time `xmlrpc:"endTime"` Errors int `xmlrpc:"errorCount"` Name string `xmlrpc:"name"` Progress int `xmlrpc:"progress"` Start time.Time `xmlrpc:"startTime"` State BuildState `xmlrpc:"status"` Success bool `xmlrpc:"succeeded"` Test TestSummary `xmlrpc:"tests"` Command []CommandResult `xmlrpc:"commands"` Warnings int `xmlrpc:"warningCount"` }
StageResult TODO(rjeczalik): document
type TestSummary ¶
type TestSummary struct { Total int `xmlrpc:"total"` Errors int `xmlrpc:"errors"` ExpectedFailures int `xmlrpc:"expectedFailures"` Failures int `xmlrpc:"failures"` Passed int `xmlrpc:"passed"` Skipped int `xmlrpc:"skipped"` }
TestSummary TODO(rjeczalik): document
type TriggerOptions ¶
type TriggerOptions struct { Force bool `xmlrpc:"force"` // TODO(rjeczalik): github.com/kolo/xmlrpc/issues/17 Properties interface{} `xmlrpc:"properties"` Rebuild bool `xmlrpc:"rebuild"` Replace bool `xmlrpc:"replaceable"` Revision string `xmlrpc:"revision"` Status string `xmlrpc:"status"` }
TriggerOptions TODO(rjeczalik): document TODO(rjeczalik): TriggerOptions should be a map, because of the way Pulse
handles optional fields - if a option is intended to not be overwritten it must not be sent in the request - Pulse does not treat empty values as a default ones. A map[string]interface{} is ideal to model this, but kolo/xmlrpc does not support maps.