Documentation ¶
Overview ¶
Gojenkins is a Jenkins Client in Go, that exposes the jenkins REST api in a more developer friendly way.
Index ¶
- Constants
- Variables
- type ActionsObject
- type Artifact
- type BasicAuth
- type Branch
- type Build
- func (b *Build) GetActions() []GeneralObj
- func (b *Build) GetAllFingerprints() []*Fingerprint
- func (b *Build) GetArtifacts() []Artifact
- func (b *Build) GetBuildNumber() int
- func (b *Build) GetCauses() []map[string]interface{}
- func (b *Build) GetConsoleOutput() string
- func (b *Build) GetCulprits() []Culprit
- func (b *Build) GetDownstreamBuilds() []*Build
- func (b *Build) GetDownstreamJobNames() []string
- func (b *Build) GetDuration() int
- func (b *Build) GetMatrixRuns() []*Build
- func (b *Build) GetParameters() []Parameter
- func (b *Build) GetResult() string
- func (b *Build) GetResultSet() *TestResult
- func (b *Build) GetRevision() string
- func (b *Build) GetRevistionBranch() string
- func (b *Build) GetTimestamp() time.Time
- func (b *Build) GetUpstreamBuild() *Build
- func (b *Build) GetUpstreamBuildNumber() int64
- func (b *Build) GetUpstreamJob() *Job
- func (b *Build) GetUrl() string
- func (b *Build) Info() *buildResponse
- func (b *Build) IsGood() bool
- func (b *Build) IsRunning() bool
- func (b *Build) Poll(options ...interface{}) int
- func (b *Build) Stop() bool
- type BuildRevision
- type Builds
- type Computers
- type Culprit
- type Executor
- type Fingerprint
- type GeneralObj
- type Jenkins
- func (j *Jenkins) BuildJob(name string, options ...interface{}) bool
- func (j *Jenkins) CopyJob(copyFrom string, newName string) *Job
- func (j *Jenkins) CreateJob(config string, options ...interface{}) *Job
- func (j *Jenkins) CreateNode(name string, numExecutors int, description string, remoteFS string, ...) *Node
- func (j *Jenkins) DeleteJob(name string) bool
- func (j *Jenkins) GetAllBuilds(job string, options ...interface{}) []*Build
- func (j *Jenkins) GetAllJobs(preload bool) []*Job
- func (j *Jenkins) GetAllNodes() []*Node
- func (j *Jenkins) GetArtifactData(id string) *fingerPrintResponse
- func (j *Jenkins) GetBuild(job string, number string) *Build
- func (j *Jenkins) GetJob(id string) *Job
- func (j *Jenkins) GetNode(name string) *Node
- func (j *Jenkins) GetPlugins(depth int) *Plugins
- func (j *Jenkins) GetQueue() *Queue
- func (j *Jenkins) GetQueueUrl() string
- func (j *Jenkins) HasPlugin(name string) *Plugin
- func (j *Jenkins) Info() *executorResponse
- func (j *Jenkins) Init() *Jenkins
- func (j *Jenkins) RenameJob(job string, name string) *Job
- func (j *Jenkins) ValidateFingerPrint(id string) bool
- type Job
- func (j *Job) Copy(from string, newName string) *Job
- func (j *Job) Create(config string, qr ...interface{}) *Job
- func (j *Job) Delete() bool
- func (j *Job) Disable() bool
- func (j *Job) Enable() bool
- func (j *Job) GetAllBuilds()
- func (j *Job) GetBuild(id int64) *Build
- func (j *Job) GetConfig() string
- func (j *Job) GetDescription() string
- func (j *Job) GetDetails() *jobResponse
- func (j *Job) GetDownstreamJobs() []*Job
- func (j *Job) GetDownstreamJobsMetadata() []updownProject
- func (j *Job) GetFirstBuild() *Build
- func (j *Job) GetLastBuild() *Build
- func (j *Job) GetLastCompletedBuild() *Build
- func (j *Job) GetLastFailedBuild() *Build
- func (j *Job) GetLastStableBuild() *Build
- func (j *Job) GetLastSuccessfulBuild() *Build
- func (j *Job) GetName() string
- func (j *Job) GetParameters() []parameterDefinition
- func (j *Job) GetUpstreamJobs() []*Job
- func (j *Job) GetUpstreamJobsMetadata() []updownProject
- func (j *Job) HasQueuedBuild()
- func (j *Job) Invoke(files []string, skipIfRunning bool, params map[string]string, cause string, ...) bool
- func (j *Job) InvokeSimple(params map[string]string) bool
- func (j *Job) IsEnabled() bool
- func (j *Job) IsQueued() bool
- func (j *Job) IsRunning() bool
- func (j *Job) Poll() int
- func (j *Job) Rename(name string)
- type Node
- func (n *Node) Delete() bool
- func (n *Node) GetName() string
- func (n *Node) Info() *nodeResponse
- func (n *Node) IsIdle() bool
- func (n *Node) IsJnlpAgent() bool
- func (n *Node) IsOnline() bool
- func (n *Node) IsTemporarilyOffline() bool
- func (n *Node) Poll() int
- func (n *Node) SetOffline()
- func (n *Node) SetOnline()
- func (n *Node) ToggleTemporarilyOffline(options ...interface{})
- type Parameter
- type Plugin
- type Plugins
- type Queue
- type Requester
- func (r *Requester) Do(method string, endpoint string, payload io.Reader, responseStruct interface{}, ...) *http.Response
- func (r *Requester) Get(endpoint string, responseStruct interface{}, querystring map[string]string) *http.Response
- func (r *Requester) GetJSON(endpoint string, responseStruct interface{}, querystring map[string]string) *http.Response
- func (r *Requester) GetXML(endpoint string, responseStruct interface{}, querystring map[string]string) *http.Response
- func (r *Requester) Post(endpoint string, payload io.Reader, responseStruct interface{}, ...) *http.Response
- func (r *Requester) PostFiles(endpoint string, payload io.Reader, responseStruct interface{}, ...) *http.Response
- func (r *Requester) PostXML(endpoint string, xml string, responseStruct interface{}, ...) *http.Response
- func (r *Requester) SetClient(client *http.Client) *Requester
- func (r *Requester) SetHeader(key string, value string) *Requester
- type Task
- type TestResult
Constants ¶
const ( STATUS_FAIL = "FAIL" STATUS_ERROR = "ERROR" STATUS_ABORTED = "ABORTED" STATUS_REGRESSION = "REGRESSION" STATUS_SUCCESS = "SUCCESS" STATUS_FIXED = "FIXED" STATUS_PASSED = "PASSED" RESULT_STATUS_FAILURE = "FAILURE" RESULT_STATUS_FAILED = "FAILED" RESULT_STATUS_SKIPPED = "SKIPPED" STR_RE_SPLIT_VIEW = "(.*)/view/([^/]*)/?" )
Variables ¶
Loggers
Functions ¶
This section is empty.
Types ¶
type ActionsObject ¶
type Artifact ¶
Represents an Artifact
type Build ¶
func (*Build) GetActions ¶
func (b *Build) GetActions() []GeneralObj
func (*Build) GetAllFingerprints ¶
func (b *Build) GetAllFingerprints() []*Fingerprint
func (*Build) GetArtifacts ¶
func (*Build) GetBuildNumber ¶
func (*Build) GetConsoleOutput ¶
func (*Build) GetCulprits ¶
func (*Build) GetDownstreamBuilds ¶
func (*Build) GetDownstreamJobNames ¶
func (*Build) GetDuration ¶
func (*Build) GetMatrixRuns ¶
func (*Build) GetParameters ¶
func (*Build) GetResultSet ¶
func (b *Build) GetResultSet() *TestResult
func (*Build) GetRevision ¶
func (*Build) GetRevistionBranch ¶
func (*Build) GetTimestamp ¶
func (*Build) GetUpstreamBuild ¶
func (*Build) GetUpstreamBuildNumber ¶
func (*Build) GetUpstreamJob ¶
func (*Build) Poll ¶
Poll for current data. Optional parameter - depth. More about depth here: https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API
type BuildRevision ¶
type Builds ¶
type Builds struct { BuildNumber int `json:"buildNumber"` BuildResult interface{} `json:"buildResult"` Marked BuildRevision `json:"marked"` Revision BuildRevision `json:"revision"` }
type Fingerprint ¶
func (Fingerprint) GetInfo ¶
func (f Fingerprint) GetInfo() *fingerPrintResponse
func (Fingerprint) Poll ¶
func (f Fingerprint) Poll() int
func (Fingerprint) Valid ¶
func (f Fingerprint) Valid() bool
func (Fingerprint) ValidateForBuild ¶
func (f Fingerprint) ValidateForBuild(filename string, build *Build) bool
type GeneralObj ¶
type GeneralObj struct { Parameters []Parameter `json:"parameters"` Causes []map[string]interface{} `json:"causes"` BuildsByBranchName map[string]Builds `json:"buildsByBranchName"` LastBuiltRevision BuildRevision `json:"lastBuiltRevision"` RemoteUrls []string `json:"remoteUrls"` ScmName string `json:"scmName"` MercurialNodeName string `json:"mercurialNodeName"` MercurialRevisionNumber string `json:"mercurialRevisionNumber"` Subdir interface{} `json:"subdir"` TotalCount int UrlName string }
type Jenkins ¶
func CreateJenkins ¶
Creates a new Jenkins Instance Optional parameters are: username, password After creating an instance call init method.
func (*Jenkins) BuildJob ¶
Invoke a job. First parameter job name, second parameter is optional Build parameters.
func (*Jenkins) CopyJob ¶
Create a copy of a job. First parameter Name of the job to copy from, Second parameter new job name.
func (*Jenkins) CreateJob ¶
Create a new job from config File Method takes XML string as first parameter, and if the name is not specified in the config file takes name as string as second parameter e.g jenkins.CreateJob("<config></config>","newJobName")
func (*Jenkins) CreateNode ¶
func (j *Jenkins) CreateNode(name string, numExecutors int, description string, remoteFS string, options ...interface{}) *Node
Create a new Node
func (*Jenkins) GetAllBuilds ¶
Get all builds for a specific job. If second parameter is bool, then the Build objects will be preloaded before return e.g jenkins.GetAllBuilds("job",true) By Default preloading is turned off.
func (*Jenkins) GetAllJobs ¶
Get All Possible jobs If preload is true, the Job object will be preloaded before returning.
func (*Jenkins) GetAllNodes ¶
func (*Jenkins) GetArtifactData ¶
Get Artifact data by Hash
func (*Jenkins) GetPlugins ¶
Returns the list of all plugins installed on the Jenkins server. You can supply depth parameter, to limit how much data is returned.
func (*Jenkins) GetQueueUrl ¶
func (*Jenkins) HasPlugin ¶
Check if the plugin is installed on the server. Depth level 1 is used. If you need to go deeper, you can use GetPlugins, and iterate through them.
func (*Jenkins) Info ¶
func (j *Jenkins) Info() *executorResponse
Get Basic Information About Jenkins
func (*Jenkins) Init ¶
Init Method. Should be called after creating a Jenkins Instance. e.g jenkins := CreateJenkins("url").Init() HTTP Client is set here, Connection to jenkins is tested here.
func (*Jenkins) RenameJob ¶
Rename a job. First parameter job old name, Second parameter job new name.
func (*Jenkins) ValidateFingerPrint ¶
Verify Fingerprint
type Job ¶
func (*Job) GetAllBuilds ¶
func (j *Job) GetAllBuilds()
func (*Job) GetDescription ¶
func (*Job) GetDetails ¶
func (j *Job) GetDetails() *jobResponse
func (*Job) GetDownstreamJobs ¶
func (*Job) GetDownstreamJobsMetadata ¶
func (j *Job) GetDownstreamJobsMetadata() []updownProject
func (*Job) GetFirstBuild ¶
func (*Job) GetLastBuild ¶
func (*Job) GetLastCompletedBuild ¶
func (*Job) GetLastFailedBuild ¶
func (*Job) GetLastStableBuild ¶
func (*Job) GetLastSuccessfulBuild ¶
func (*Job) GetParameters ¶
func (j *Job) GetParameters() []parameterDefinition
func (*Job) GetUpstreamJobs ¶
func (*Job) GetUpstreamJobsMetadata ¶
func (j *Job) GetUpstreamJobsMetadata() []updownProject
func (*Job) HasQueuedBuild ¶
func (j *Job) HasQueuedBuild()
type Node ¶
func (*Node) IsJnlpAgent ¶
func (*Node) IsTemporarilyOffline ¶
func (*Node) SetOffline ¶
func (n *Node) SetOffline()
func (*Node) ToggleTemporarilyOffline ¶
func (n *Node) ToggleTemporarilyOffline(options ...interface{})
type Plugin ¶
type Plugin struct { Active bool `json:"active"` BackupVersion interface{} `json:"backupVersion"` Bundled bool `json:"bundled"` Deleted bool `json:"deleted"` Dependencies []struct { Optional string `json:"optional"` ShortName string `json:"shortname"` Version string `json:"version"` } `json:"dependencies"` Downgradable bool `json:"downgradable"` Enabled bool `json:"enabled"` HasUpdate bool `json:"hasUpdate"` LongName string `json:"longName"` Pinned bool `json:"pinned"` ShortName string `json:"shortName"` SupportsDynamicLoad string `json:"supportsDynamicLoad"` URL string `json:"url"` Version string `json:"version"` }
type Requester ¶
type Requester struct { Base string BasicAuth *BasicAuth Headers http.Header Client *http.Client SslVerify bool LastResponse *http.Response Suffix string }
type Task ¶
func (*Task) GetParameters ¶
type TestResult ¶
type TestResult struct { Duration int64 `json:"duration"` Empty bool `json:"empty"` FailCount int64 `json:"failCount"` PassCount int64 `json:"passCount"` SkipCount int64 `json:"skipCount"` Suites []struct { Cases []struct { Age int64 `json:"age"` ClassName string `json:"className"` Duration int64 `json:"duration"` ErrorDetails interface{} `json:"errorDetails"` ErrorStackTrace interface{} `json:"errorStackTrace"` FailedSince int64 `json:"failedSince"` Name string `json:"name"` Skipped bool `json:"skipped"` SkippedMessage interface{} `json:"skippedMessage"` Status string `json:"status"` Stderr interface{} `json:"stderr"` Stdout interface{} `json:"stdout"` } `json:"cases"` Duration int64 `json:"duration"` ID interface{} `json:"id"` Name string `json:"name"` Stderr interface{} `json:"stderr"` Stdout interface{} `json:"stdout"` Timestamp interface{} `json:"timestamp"` } `json:"suites"` }