jenkins

package
v0.0.0-...-abfb8b1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2016 License: BSD-3-Clause Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenBuildSpec

func GenBuildSpec(jobName string, axisValues map[string]string, suffix string) string

GenBuildSpec returns a spec string for the given Jenkins build.

If the main job is a multi-configuration job, the spec is in the form of: <jobName>/axis1Label=axis1Value,axis2Label=axis2Value,.../<suffix> The axis values are taken from the given axisValues map.

If no axisValues are provides, the spec will be: <jobName>/<suffix>.

Types

type BuildInfo

type BuildInfo struct {
	Actions   []BuildInfoAction
	Building  bool
	Number    int
	Result    string
	Id        string
	Timestamp int64
}

func (*BuildInfo) ParseRefs

func (bi *BuildInfo) ParseRefs() string

ParseRefs parses the REFS parameter from a BuildInfo object.

type BuildInfoAction

type BuildInfoAction struct {
	Parameters []BuildInfoParameter
}

type BuildInfoParameter

type BuildInfoParameter struct {
	Name  string
	Value string
}

type Jenkins

type Jenkins struct {
	// contains filtered or unexported fields
}

func New

func New(host string) (*Jenkins, error)

func NewForTesting

func NewForTesting() *Jenkins

NewForTesting creates a Jenkins instance in test mode.

func (*Jenkins) AddBuild

func (j *Jenkins) AddBuild(jobName string) error

AddBuild adds a build to the given job.

func (*Jenkins) AddBuildWithParameter

func (j *Jenkins) AddBuildWithParameter(jobName string, params url.Values) error

AddBuildWithParameter adds a parameterized build to the given job.

func (*Jenkins) AddNodeToJenkins

func (j *Jenkins) AddNodeToJenkins(name, host, description, credentialsId string) error

AddNodeToJenkins sends an HTTP request to Jenkins that prompts it to add a new machine to its configuration.

NOTE: Jenkins REST API is not documented anywhere and the particular HTTP request used to add a new machine to Jenkins configuration has been crafted using trial and error.

func (*Jenkins) BuildInfo

func (j *Jenkins) BuildInfo(jobName string, buildNumber int) (*BuildInfo, error)

BuildInfo returns a build's info for the given jobName and buildNumber.

func (*Jenkins) BuildInfoForSpec

func (j *Jenkins) BuildInfoForSpec(buildSpec string) (*BuildInfo, error)

BuildInfoWithBuildURL returns a build's info for the given build's URL.

func (*Jenkins) CancelOngoingBuild

func (j *Jenkins) CancelOngoingBuild(jobName string, buildNumber int) error

CancelOngoingBuild cancels the ongoing build by given jobName and buildNumber.

func (*Jenkins) CancelQueuedBuild

func (j *Jenkins) CancelQueuedBuild(id string) error

CancelQueuedBuild cancels the queued build by given id.

func (*Jenkins) FailedTestCasesForBuildSpec

func (j *Jenkins) FailedTestCasesForBuildSpec(buildSpec string) ([]TestCase, error)

FailedTestCasesForBuildSpec returns failed test cases for the given build spec.

func (*Jenkins) IsNodeIdle

func (j *Jenkins) IsNodeIdle(node string) (bool, error)

IsNodeIdle checks whether the given node is idle.

func (*Jenkins) LastCompletedBuildStatus

func (j *Jenkins) LastCompletedBuildStatus(jobName string, axisValues map[string]string) (*BuildInfo, error)

LastCompletedBuildStatus returns the most recent completed BuildInfo for the given job.

axisValues can be set to nil if the job is not multi-configuration.

func (*Jenkins) MockAPI

func (j *Jenkins) MockAPI(suffix, result string)

MockAPI mocks "invoke" with the given API suffix.

func (*Jenkins) OngoingBuilds

func (j *Jenkins) OngoingBuilds(jobName string) (_ []BuildInfo, err error)

OngoingBuilds returns a slice of BuildInfo for current ongoing builds for the given job.

func (*Jenkins) QueuedBuilds

func (j *Jenkins) QueuedBuilds(jobName string) (_ []QueuedBuild, err error)

QueuedBuilds returns the queued builds.

func (*Jenkins) RemoveNodeFromJenkins

func (j *Jenkins) RemoveNodeFromJenkins(node string) error

RemoveNodeFromJenkins sends an HTTP request to Jenkins that prompts it to remove an existing machine from its configuration.

type JenkinsMachine

type JenkinsMachine struct {
	Name string `json:"displayName"`
	Idle bool   `json:"idle"`
}

JenkinsMachine stores information about a Jenkins machine.

type JenkinsMachines

type JenkinsMachines struct {
	Machines []JenkinsMachine `json:"computer"`
}

JenkinsMachines stores information about Jenkins machines.

type QueuedBuild

type QueuedBuild struct {
	Id     int
	Params string `json:"params,omitempty"`
	Task   QueuedBuildTask
}

func (*QueuedBuild) ParseRefs

func (qb *QueuedBuild) ParseRefs() string

ParseRefs parses refs from a QueuedBuild object's Params field.

type QueuedBuildTask

type QueuedBuildTask struct {
	Name string
}

type TestCase

type TestCase struct {
	ClassName string
	Name      string
	Status    string
}

func (TestCase) Equal

func (t TestCase) Equal(t2 TestCase) bool

Jump to

Keyboard shortcuts

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