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 APIRequest
- type Artifact
- type BasicAuth
- type Build
- func (b *Build) GetActions() []generalObj
- func (b *Build) GetAllFingerPrints() []*FingerPrint
- func (b *Build) GetArtifacts() []Artifact
- func (b *Build) GetBuildNumber() int64
- func (b *Build) GetCauses() ([]map[string]interface{}, error)
- func (b *Build) GetConsoleOutput() string
- func (b *Build) GetConsoleOutputFromIndex(startID int64) (consoleResponse, error)
- func (b *Build) GetCulprits() []Culprit
- func (b *Build) GetDownstreamBuilds() ([]*Build, error)
- func (b *Build) GetDownstreamJobNames() []string
- func (b *Build) GetDuration() int64
- func (b *Build) GetInjectedEnvVars() (map[string]string, error)
- func (b *Build) GetMatrixRuns() ([]*Build, error)
- func (b *Build) GetParameters() []parameter
- func (b *Build) GetResult() string
- func (b *Build) GetResultSet() (*TestResult, error)
- func (b *Build) GetRevision() string
- func (b *Build) GetRevisionBranch() string
- func (b *Build) GetTimestamp() time.Time
- func (b *Build) GetUpstreamBuild() (*Build, error)
- func (b *Build) GetUpstreamBuildNumber() (int64, error)
- func (b *Build) GetUpstreamJob() (*Job, error)
- 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, error)
- func (b *Build) SetDescription(description string) error
- func (b *Build) Stop() (bool, error)
- type BuildResponse
- type BuildRevision
- type Builds
- type Computers
- type CredentialsManager
- func (cm CredentialsManager) Add(domain string, creds interface{}) error
- func (cm CredentialsManager) Delete(domain string, id string) error
- func (cm CredentialsManager) GetSingle(domain string, id string, creds interface{}) error
- func (cm CredentialsManager) List(domain string) ([]string, error)
- func (cm CredentialsManager) Update(domain string, id string, creds interface{}) error
- type Culprit
- type DockerServerCredentials
- type Executor
- type ExecutorResponse
- type FingerPrint
- type FingerPrintResponse
- type Folder
- type FolderResponse
- type History
- type InnerJob
- type Jenkins
- func (j *Jenkins) BuildJob(name string, options ...interface{}) (int64, error)
- func (j *Jenkins) CopyJob(copyFrom string, newName string) (*Job, error)
- func (j *Jenkins) CreateFolder(name string, parents ...string) (*Folder, error)
- func (j *Jenkins) CreateJob(config string, options ...interface{}) (*Job, error)
- func (j *Jenkins) CreateJobInFolder(config string, jobName string, parentIDs ...string) (*Job, error)
- func (j *Jenkins) CreateNode(name string, numExecutors int, description string, remoteFS string, ...) (*Node, error)
- func (j *Jenkins) CreateView(name string, viewType string) (*View, error)
- func (j *Jenkins) DeleteJob(name string) (bool, error)
- func (j *Jenkins) DeleteNode(name string) (bool, error)
- func (j *Jenkins) GetAllBuildIds(job string) ([]JobBuild, error)
- func (j *Jenkins) GetAllJobNames() ([]InnerJob, error)
- func (j *Jenkins) GetAllJobs() ([]*Job, error)
- func (j *Jenkins) GetAllNodes() ([]*Node, error)
- func (j *Jenkins) GetAllViews() ([]*View, error)
- func (j *Jenkins) GetArtifactData(id string) (*FingerPrintResponse, error)
- func (j *Jenkins) GetBuild(jobName string, number int64) (*Build, error)
- func (j *Jenkins) GetFolder(id string, parents ...string) (*Folder, error)
- func (j *Jenkins) GetJob(id string, parentIDs ...string) (*Job, error)
- func (j *Jenkins) GetLabel(name string) (*Label, error)
- func (j *Jenkins) GetNode(name string) (*Node, error)
- func (j *Jenkins) GetPlugins(depth int) (*Plugins, error)
- func (j *Jenkins) GetQueue() (*Queue, error)
- func (j *Jenkins) GetQueueItem(id int64) (*Task, error)
- func (j *Jenkins) GetQueueUrl() string
- func (j *Jenkins) GetSubJob(parentId string, childId string) (*Job, error)
- func (j *Jenkins) GetView(name string) (*View, error)
- func (j *Jenkins) HasPlugin(name string) (*Plugin, error)
- func (j *Jenkins) Info() (*ExecutorResponse, error)
- func (j *Jenkins) Init() (*Jenkins, error)
- func (j *Jenkins) InstallPlugin(name string, version string) error
- func (j *Jenkins) Poll() (int, error)
- func (j *Jenkins) RenameJob(job string, name string) *Job
- func (j *Jenkins) SafeRestart() error
- func (j *Jenkins) UninstallPlugin(name string) error
- func (j *Jenkins) ValidateFingerPrint(id string) (bool, error)
- type Job
- func (j *Job) Copy(destinationName string) (*Job, error)
- func (j *Job) Create(config string, qr ...interface{}) (*Job, error)
- func (j *Job) Delete() (bool, error)
- func (j *Job) Disable() (bool, error)
- func (j *Job) Enable() (bool, error)
- func (j *Job) GetAllBuildIds() ([]JobBuild, error)
- func (j *Job) GetBuild(id int64) (*Build, error)
- func (j *Job) GetConfig() (string, error)
- func (j *Job) GetDescription() string
- func (j *Job) GetDetails() *JobResponse
- func (j *Job) GetDownstreamJobs() ([]*Job, error)
- func (j *Job) GetDownstreamJobsMetadata() []InnerJob
- func (j *Job) GetFirstBuild() (*Build, error)
- func (j *Job) GetInnerJob(id string) (*Job, error)
- func (j *Job) GetInnerJobs() ([]*Job, error)
- func (j *Job) GetInnerJobsMetadata() []InnerJob
- func (j *Job) GetLastBuild() (*Build, error)
- func (j *Job) GetLastCompletedBuild() (*Build, error)
- func (j *Job) GetLastFailedBuild() (*Build, error)
- func (j *Job) GetLastStableBuild() (*Build, error)
- func (j *Job) GetLastSuccessfulBuild() (*Build, error)
- func (j *Job) GetName() string
- func (j *Job) GetParameters() ([]ParameterDefinition, error)
- func (job *Job) GetPipelineRun(id string) (pr *PipelineRun, err error)
- func (job *Job) GetPipelineRuns() (pr []PipelineRun, err error)
- func (j *Job) GetUpstreamJobs() ([]*Job, error)
- func (j *Job) GetUpstreamJobsMetadata() []InnerJob
- func (j *Job) HasQueuedBuild()
- func (j *Job) History() ([]*History, error)
- func (j *Job) Invoke(files []string, skipIfRunning bool, params map[string]string, cause string, ...) (bool, error)
- func (j *Job) InvokeSimple(params map[string]string) (int64, error)
- func (j *Job) IsEnabled() (bool, error)
- func (j *Job) IsQueued() (bool, error)
- func (j *Job) IsRunning() (bool, error)
- func (j *Job) Poll() (int, error)
- func (j *Job) Rename(name string) (bool, error)
- func (j *Job) UpdateConfig(config string) error
- type JobBuild
- type JobResponse
- type Label
- type LabelNode
- type LabelResponse
- type MODE
- type Node
- func (n *Node) Delete() (bool, error)
- func (n *Node) Disconnect() (int, error)
- func (n *Node) GetLogText() (string, error)
- func (n *Node) GetName() string
- func (n *Node) Info() (*NodeResponse, error)
- func (n *Node) IsIdle() (bool, error)
- func (n *Node) IsJnlpAgent() (bool, error)
- func (n *Node) IsOnline() (bool, error)
- func (n *Node) IsTemporarilyOffline() (bool, error)
- func (n *Node) LaunchNodeBySSH() (int, error)
- func (n *Node) Poll() (int, error)
- func (n *Node) SetOffline(options ...interface{}) (bool, error)
- func (n *Node) SetOnline() (bool, error)
- func (n *Node) ToggleTemporarilyOffline(options ...interface{}) (bool, error)
- type NodeResponse
- type ParameterDefinition
- type PipelineArtifact
- type PipelineInputAction
- type PipelineNode
- type PipelineNodeLog
- type PipelineRun
- func (pr *PipelineRun) AbortInput() (bool, error)
- func (pr *PipelineRun) GetArtifacts() (artifacts []PipelineArtifact, err error)
- func (pr *PipelineRun) GetNode(id string) (node *PipelineNode, err error)
- func (pr *PipelineRun) GetPendingInputActions() (PIAs []PipelineInputAction, err error)
- func (pr *PipelineRun) ProceedInput() (bool, error)
- type Plugin
- type PluginResponse
- type Plugins
- type PrivateKey
- type PrivateKeyFile
- type Queue
- type Requester
- func (r *Requester) Do(ar *APIRequest, responseStruct interface{}, options ...interface{}) (*http.Response, error)
- func (r *Requester) Get(endpoint string, responseStruct interface{}, querystring map[string]string) (*http.Response, error)
- func (r *Requester) GetJSON(endpoint string, responseStruct interface{}, query map[string]string) (*http.Response, error)
- func (r *Requester) GetXML(endpoint string, responseStruct interface{}, query map[string]string) (*http.Response, error)
- func (r *Requester) Post(endpoint string, payload io.Reader, responseStruct interface{}, ...) (*http.Response, error)
- func (r *Requester) PostFiles(endpoint string, payload io.Reader, responseStruct interface{}, ...) (*http.Response, error)
- func (r *Requester) PostJSON(endpoint string, payload io.Reader, responseStruct interface{}, ...) (*http.Response, error)
- func (r *Requester) PostXML(endpoint string, xml string, responseStruct interface{}, ...) (*http.Response, error)
- func (r *Requester) ReadJSONResponse(response *http.Response, responseStruct interface{}) (*http.Response, error)
- func (r *Requester) ReadRawResponse(response *http.Response, responseStruct interface{}) (*http.Response, error)
- func (r *Requester) SetClient(client *http.Client) *Requester
- func (r *Requester) SetCrumb(ar *APIRequest) error
- type SSHCredentials
- type StringCredentials
- type Task
- type TestResult
- type UsernameCredentials
- type View
- type ViewData
- type ViewResponse
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/([^/]*)/?" )
const ClassUsernameCredentials = "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl"
ClassUsernameCredentials is name if java class which implements credentials that store username-password pair
const KeySourceDirectEntryType = "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource"
KeySourceDirectEntryType is used when secret in provided directly as private key value
const KeySourceOnMasterType = "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$FileOnMasterPrivateKeySource"
KeySourceOnMasterType is used when private key value is path to file on jenkins master
Variables ¶
Loggers
var ( LIST_VIEW = "hudson.model.ListView" NESTED_VIEW = "hudson.plugins.nested_view.NestedView" MY_VIEW = "hudson.model.MyView" DASHBOARD_VIEW = "hudson.plugins.view.dashboard.Dashboard" PIPELINE_VIEW = "au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView" )
Functions ¶
This section is empty.
Types ¶
type APIRequest ¶ added in v1.0.1
type APIRequest struct { Method string Endpoint string Payload io.Reader Headers http.Header Suffix string }
func NewAPIRequest ¶ added in v1.0.1
func NewAPIRequest(method string, endpoint string, payload io.Reader) *APIRequest
func (*APIRequest) SetHeader ¶ added in v1.0.1
func (ar *APIRequest) SetHeader(key string, value string) *APIRequest
type Artifact ¶
Represents an Artifact
type Build ¶
type Build struct { Raw *BuildResponse Job *Job Jenkins *Jenkins Base string Depth int }
func (*Build) GetActions ¶
func (b *Build) GetActions() []generalObj
func (*Build) GetAllFingerPrints ¶ added in v1.0.1
func (b *Build) GetAllFingerPrints() []*FingerPrint
func (*Build) GetArtifacts ¶
func (*Build) GetBuildNumber ¶
func (*Build) GetConsoleOutput ¶
func (*Build) GetConsoleOutputFromIndex ¶ added in v1.0.1
func (*Build) GetCulprits ¶
func (*Build) GetDownstreamBuilds ¶
func (*Build) GetDownstreamJobNames ¶
func (*Build) GetDuration ¶
func (*Build) GetInjectedEnvVars ¶ added in v1.0.1
func (*Build) GetMatrixRuns ¶
func (*Build) GetParameters ¶
func (b *Build) GetParameters() []parameter
func (*Build) GetResultSet ¶
func (b *Build) GetResultSet() (*TestResult, error)
func (*Build) GetRevision ¶
func (*Build) GetRevisionBranch ¶ added in v1.0.1
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
func (*Build) SetDescription ¶ added in v1.0.1
type BuildResponse ¶ added in v1.0.1
type BuildResponse struct { Actions []generalObj Artifacts []struct { DisplayPath string `json:"displayPath"` FileName string `json:"fileName"` RelativePath string `json:"relativePath"` } `json:"artifacts"` Building bool `json:"building"` BuiltOn string `json:"builtOn"` ChangeSet struct { Items []struct { AffectedPaths []string `json:"affectedPaths"` Author struct { AbsoluteUrl string `json:"absoluteUrl"` FullName string `json:"fullName"` } `json:"author"` Comment string `json:"comment"` CommitID string `json:"commitId"` Date string `json:"date"` ID string `json:"id"` Msg string `json:"msg"` Paths []struct { EditType string `json:"editType"` File string `json:"file"` } `json:"paths"` Timestamp int64 `json:"timestamp"` } `json:"items"` Kind string `json:"kind"` Revisions []struct { Module string Revision int } `json:"revision"` } `json:"changeSet"` ChangeSets []struct { Items []struct { AffectedPaths []string `json:"affectedPaths"` Author struct { AbsoluteUrl string `json:"absoluteUrl"` FullName string `json:"fullName"` } `json:"author"` Comment string `json:"comment"` CommitID string `json:"commitId"` Date string `json:"date"` ID string `json:"id"` Msg string `json:"msg"` Paths []struct { EditType string `json:"editType"` File string `json:"file"` } `json:"paths"` Timestamp int64 `json:"timestamp"` } `json:"items"` Kind string `json:"kind"` Revisions []struct { Module string Revision int } `json:"revision"` } `json:"changeSets"` Culprits []Culprit `json:"culprits"` Description interface{} `json:"description"` Duration int64 `json:"duration"` EstimatedDuration int64 `json:"estimatedDuration"` Executor interface{} `json:"executor"` DisplayName string `json:"displayName"` FullDisplayName string `json:"fullDisplayName"` ID string `json:"id"` KeepLog bool `json:"keepLog"` Number int64 `json:"number"` QueueID int64 `json:"queueId"` Result string `json:"result"` Timestamp int64 `json:"timestamp"` URL string `json:"url"` MavenArtifacts interface{} `json:"mavenArtifacts"` MavenVersionUsed string `json:"mavenVersionUsed"` FingerPrint []FingerPrintResponse Runs []struct { Number int64 URL string } `json:"runs"` }
type BuildRevision ¶
type BuildRevision struct { SHA1 string `json:"SHA1"` Branch []branch `json:"branch"` }
type Builds ¶
type Builds struct { BuildNumber int64 `json:"buildNumber"` BuildResult interface{} `json:"buildResult"` Marked BuildRevision `json:"marked"` Revision BuildRevision `json:"revision"` }
type Computers ¶
type Computers struct { BusyExecutors int `json:"busyExecutors"` Computers []*NodeResponse `json:"computer"` DisplayName string `json:"displayName"` TotalExecutors int `json:"totalExecutors"` }
type CredentialsManager ¶ added in v1.0.1
CredentialsManager is utility to control credential plugin Credentials declared by it can be used in jenkins jobs
func (CredentialsManager) Add ¶ added in v1.0.1
func (cm CredentialsManager) Add(domain string, creds interface{}) error
Add credential to given domain, creds must be struct which is parsable to xml
func (CredentialsManager) Delete ¶ added in v1.0.1
func (cm CredentialsManager) Delete(domain string, id string) error
Delete credential in given domain with given id
func (CredentialsManager) GetSingle ¶ added in v1.0.1
func (cm CredentialsManager) GetSingle(domain string, id string, creds interface{}) error
GetSingle searches for credential in given domain with given id, if credential is found it will be parsed as xml to creds parameter(creds must be pointer to struct)
type DockerServerCredentials ¶ added in v1.0.1
type DockerServerCredentials struct { XMLName xml.Name `xml:"org.jenkinsci.plugins.docker.commons.credentials.DockerServerCredentials"` ID string `xml:"id"` Scope string `xml:"scope"` Username string `xml:"username"` Description string `xml:"description,omitempty"` ClientKey string `xml:"clientKey"` ClientCertificate string `xml:"clientCertificate"` ServerCaCertificate string `xml:"serverCaCertificate"` }
DockerServerCredentials store credentials for docker keys.
type Executor ¶
type Executor struct { Raw *ExecutorResponse Jenkins *Jenkins }
type ExecutorResponse ¶ added in v1.0.1
type ExecutorResponse struct { AssignedLabels []struct{} `json:"assignedLabels"` Description interface{} `json:"description"` Jobs []InnerJob `json:"jobs"` Mode string `json:"mode"` NodeDescription string `json:"nodeDescription"` NodeName string `json:"nodeName"` NumExecutors int64 `json:"numExecutors"` OverallLoad struct{} `json:"overallLoad"` PrimaryView struct { Name string `json:"name"` URL string `json:"url"` } `json:"primaryView"` QuietingDown bool `json:"quietingDown"` SlaveAgentPort int64 `json:"slaveAgentPort"` UnlabeledLoad struct{} `json:"unlabeledLoad"` UseCrumbs bool `json:"useCrumbs"` UseSecurity bool `json:"useSecurity"` Views []ViewData `json:"views"` }
type FingerPrint ¶ added in v1.0.1
type FingerPrint struct { Jenkins *Jenkins Base string Id string Raw *FingerPrintResponse }
func (FingerPrint) GetInfo ¶ added in v1.0.1
func (f FingerPrint) GetInfo() (*FingerPrintResponse, error)
func (FingerPrint) Poll ¶ added in v1.0.1
func (f FingerPrint) Poll() (int, error)
func (FingerPrint) Valid ¶ added in v1.0.1
func (f FingerPrint) Valid() (bool, error)
func (FingerPrint) ValidateForBuild ¶ added in v1.0.1
func (f FingerPrint) ValidateForBuild(filename string, build *Build) (bool, error)
type FingerPrintResponse ¶ added in v1.0.1
type FingerPrintResponse struct { FileName string `json:"fileName"` Hash string `json:"hash"` Original struct { Name string Number int64 } `json:"original"` Timestamp int64 `json:"timestamp"` Usage []struct { Name string `json:"name"` Ranges struct { Ranges []struct { End int64 `json:"end"` Start int64 `json:"start"` } `json:"ranges"` } `json:"ranges"` } `json:"usage"` }
type Folder ¶ added in v1.0.1
type Folder struct { Raw *FolderResponse Jenkins *Jenkins Base string }
type FolderResponse ¶ added in v1.0.1
type Jenkins ¶
type Jenkins struct { Server string Version string Raw *ExecutorResponse Requester *Requester }
func CreateJenkins ¶
Creates a new Jenkins Instance Optional parameters are: client, username, password or token 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) CreateFolder ¶ added in v1.0.1
Create a new folder This folder can be nested in other parent folders Example: jenkins.CreateFolder("newFolder", "grandparentFolder", "parentFolder")
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) CreateJobInFolder ¶ added in v1.0.1
func (j *Jenkins) CreateJobInFolder(config string, jobName string, parentIDs ...string) (*Job, error)
Create a new job in the folder Example: jenkins.CreateJobInFolder("<config></config>", "newJobName", "myFolder", "parentFolder")
func (*Jenkins) CreateNode ¶
func (j *Jenkins) CreateNode(name string, numExecutors int, description string, remoteFS string, label string, options ...interface{}) (*Node, error)
Create a new Node Can be JNLPLauncher or SSHLauncher Example : jenkins.CreateNode("nodeName", 1, "Description", "/var/lib/jenkins", "jdk8 docker", map[string]string{"method": "JNLPLauncher"}) By Default JNLPLauncher is created Multiple labels should be separated by blanks
func (*Jenkins) CreateView ¶ added in v0.2.0
Create View First Parameter - name of the View Second parameter - Type Possible Types:
gojenkins.LIST_VIEW gojenkins.NESTED_VIEW gojenkins.MY_VIEW gojenkins.DASHBOARD_VIEW gojenkins.PIPELINE_VIEW
Example: jenkins.CreateView("newView",gojenkins.LIST_VIEW)
func (*Jenkins) DeleteNode ¶ added in v1.0.1
Delete a Jenkins slave node
func (*Jenkins) GetAllBuildIds ¶ added in v0.2.0
Get all builds Numbers and URLS for a specific job. There are only build IDs here, To get all the other info of the build use jenkins.GetBuild(job,buildNumber) or job.GetBuild(buildNumber)
func (*Jenkins) GetAllJobNames ¶ added in v1.0.1
Get Only Array of Job Names, Color, URL Does not query each single Job.
func (*Jenkins) GetAllJobs ¶
Get All Possible Job Objects. Each job will be queried.
func (*Jenkins) GetAllNodes ¶
func (*Jenkins) GetAllViews ¶ added in v0.2.0
func (*Jenkins) GetArtifactData ¶
func (j *Jenkins) GetArtifactData(id string) (*FingerPrintResponse, error)
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) GetQueueItem ¶ added in v1.0.1
GetQueueItem returns a single queue Task
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, error)
Get Basic Information About Jenkins
func (*Jenkins) Init ¶
Init Method. Should be called after creating a Jenkins Instance. e.g jenkins,err := CreateJenkins("url").Init() HTTP Client is set here, Connection to jenkins is tested here.
func (*Jenkins) InstallPlugin ¶ added in v1.0.1
InstallPlugin with given version and name
func (*Jenkins) RenameJob ¶
Rename a job. First parameter job old name, Second parameter job new name.
func (*Jenkins) SafeRestart ¶ added in v1.0.1
SafeRestart jenkins, restart will be done when there are no jobs running
func (*Jenkins) UninstallPlugin ¶ added in v1.0.1
UninstallPlugin plugin otherwise returns error
type Job ¶
type Job struct { Raw *JobResponse Jenkins *Jenkins Base string }
func (*Job) GetAllBuildIds ¶ added in v0.2.0
Returns All Builds with Number and URL
func (*Job) GetDescription ¶
func (*Job) GetDetails ¶
func (j *Job) GetDetails() *JobResponse
func (*Job) GetDownstreamJobs ¶
func (*Job) GetDownstreamJobsMetadata ¶
func (*Job) GetFirstBuild ¶
func (*Job) GetInnerJobs ¶ added in v1.0.1
func (*Job) GetInnerJobsMetadata ¶ added in v1.0.1
func (*Job) GetLastBuild ¶
func (*Job) GetLastCompletedBuild ¶
func (*Job) GetLastFailedBuild ¶
func (*Job) GetLastStableBuild ¶
func (*Job) GetLastSuccessfulBuild ¶
func (*Job) GetParameters ¶
func (j *Job) GetParameters() ([]ParameterDefinition, error)
func (*Job) GetPipelineRun ¶ added in v1.0.1
func (job *Job) GetPipelineRun(id string) (pr *PipelineRun, err error)
func (*Job) GetPipelineRuns ¶ added in v1.0.1
func (job *Job) GetPipelineRuns() (pr []PipelineRun, err error)
func (*Job) GetUpstreamJobs ¶
func (*Job) GetUpstreamJobsMetadata ¶
func (*Job) HasQueuedBuild ¶
func (j *Job) HasQueuedBuild()
func (*Job) UpdateConfig ¶ added in v1.0.1
type JobResponse ¶ added in v1.0.1
type JobResponse struct { Class string `json:"_class"` Actions []generalObj Buildable bool `json:"buildable"` Builds []JobBuild Color string `json:"color"` ConcurrentBuild bool `json:"concurrentBuild"` Description string `json:"description"` DisplayName string `json:"displayName"` DisplayNameOrNull interface{} `json:"displayNameOrNull"` DownstreamProjects []InnerJob `json:"downstreamProjects"` FirstBuild JobBuild FullName string `json:"fullName"` FullDisplayName string `json:"fullDisplayName"` HealthReport []struct { Description string `json:"description"` IconClassName string `json:"iconClassName"` IconUrl string `json:"iconUrl"` Score int64 `json:"score"` } `json:"healthReport"` InQueue bool `json:"inQueue"` KeepDependencies bool `json:"keepDependencies"` LastBuild JobBuild `json:"lastBuild"` LastCompletedBuild JobBuild `json:"lastCompletedBuild"` LastFailedBuild JobBuild `json:"lastFailedBuild"` LastStableBuild JobBuild `json:"lastStableBuild"` LastSuccessfulBuild JobBuild `json:"lastSuccessfulBuild"` LastUnstableBuild JobBuild `json:"lastUnstableBuild"` LastUnsuccessfulBuild JobBuild `json:"lastUnsuccessfulBuild"` Name string `json:"name"` NextBuildNumber int64 `json:"nextBuildNumber"` Property []struct { ParameterDefinitions []ParameterDefinition `json:"parameterDefinitions"` } `json:"property"` QueueItem interface{} `json:"queueItem"` Scm struct{} `json:"scm"` UpstreamProjects []InnerJob `json:"upstreamProjects"` URL string `json:"url"` Jobs []InnerJob `json:"jobs"` PrimaryView *ViewData `json:"primaryView"` Views []ViewData `json:"views"` }
type Label ¶ added in v1.0.1
type Label struct { Raw *LabelResponse Jenkins *Jenkins Base string }
type LabelResponse ¶ added in v1.0.1
type MODE ¶ added in v1.0.1
type MODE string
const ( NORMAL MODE = "NORMAL" EXCLUSIVE = "EXCLUSIVE" )
type Node ¶
type Node struct { Raw *NodeResponse Jenkins *Jenkins Base string }
func (*Node) Disconnect ¶ added in v1.0.1
func (*Node) GetLogText ¶ added in v1.0.1
func (*Node) Info ¶
func (n *Node) Info() (*NodeResponse, error)
func (*Node) IsJnlpAgent ¶
func (*Node) IsTemporarilyOffline ¶
func (*Node) LaunchNodeBySSH ¶ added in v1.0.1
func (*Node) SetOffline ¶
func (*Node) ToggleTemporarilyOffline ¶
type NodeResponse ¶ added in v1.0.1
type NodeResponse struct { Actions []interface{} `json:"actions"` DisplayName string `json:"displayName"` Executors []struct { CurrentExecutable struct { Number int `json:"number"` URL string `json:"url"` SubBuilds []struct { Abort bool `json:"abort"` Build interface{} `json:"build"` BuildNumber int `json:"buildNumber"` Duration string `json:"duration"` Icon string `json:"icon"` JobName string `json:"jobName"` ParentBuildNumber int `json:"parentBuildNumber"` ParentJobName string `json:"parentJobName"` PhaseName string `json:"phaseName"` Result string `json:"result"` Retry bool `json:"retry"` URL string `json:"url"` } `json:"subBuilds"` } `json:"currentExecutable"` } `json:"executors"` Icon string `json:"icon"` IconClassName string `json:"iconClassName"` Idle bool `json:"idle"` JnlpAgent bool `json:"jnlpAgent"` LaunchSupported bool `json:"launchSupported"` LoadStatistics struct{} `json:"loadStatistics"` ManualLaunchAllowed bool `json:"manualLaunchAllowed"` MonitorData struct { Hudson_NodeMonitors_ArchitectureMonitor interface{} `json:"hudson.node_monitors.ArchitectureMonitor"` Hudson_NodeMonitors_ClockMonitor interface{} `json:"hudson.node_monitors.ClockMonitor"` Hudson_NodeMonitors_DiskSpaceMonitor interface{} `json:"hudson.node_monitors.DiskSpaceMonitor"` Hudson_NodeMonitors_ResponseTimeMonitor struct { Average int64 `json:"average"` } `json:"hudson.node_monitors.ResponseTimeMonitor"` Hudson_NodeMonitors_SwapSpaceMonitor interface{} `json:"hudson.node_monitors.SwapSpaceMonitor"` Hudson_NodeMonitors_TemporarySpaceMonitor interface{} `json:"hudson.node_monitors.TemporarySpaceMonitor"` } `json:"monitorData"` NumExecutors int64 `json:"numExecutors"` Offline bool `json:"offline"` OfflineCause struct{} `json:"offlineCause"` OfflineCauseReason string `json:"offlineCauseReason"` OneOffExecutors []interface{} `json:"oneOffExecutors"` TemporarilyOffline bool `json:"temporarilyOffline"` }
type ParameterDefinition ¶ added in v1.0.1
type PipelineArtifact ¶ added in v1.0.1
type PipelineInputAction ¶ added in v1.0.1
type PipelineNode ¶ added in v1.0.1
type PipelineNode struct { Run *PipelineRun Base string URLs map[string]map[string]string `json:"_links"` ID string Name string Status string StartTime int64 `json:"startTimeMillis"` Duration int64 `json:"durationMillis"` StageFlowNodes []PipelineNode ParentNodes []int64 }
func (*PipelineNode) GetLog ¶ added in v1.0.1
func (node *PipelineNode) GetLog() (log *PipelineNodeLog, err error)
type PipelineNodeLog ¶ added in v1.0.1
type PipelineRun ¶ added in v1.0.1
type PipelineRun struct { Job *Job Base string URLs map[string]map[string]string `json:"_links"` ID string Name string Status string StartTime int64 `json:"startTimeMillis"` EndTime int64 `json:"endTimeMillis"` Duration int64 `json:"durationMillis"` Stages []PipelineNode }
func (*PipelineRun) AbortInput ¶ added in v1.0.1
func (pr *PipelineRun) AbortInput() (bool, error)
func (*PipelineRun) GetArtifacts ¶ added in v1.0.1
func (pr *PipelineRun) GetArtifacts() (artifacts []PipelineArtifact, err error)
func (*PipelineRun) GetNode ¶ added in v1.0.1
func (pr *PipelineRun) GetNode(id string) (node *PipelineNode, err error)
func (*PipelineRun) GetPendingInputActions ¶ added in v1.0.1
func (pr *PipelineRun) GetPendingInputActions() (PIAs []PipelineInputAction, err error)
func (*PipelineRun) ProceedInput ¶ added in v1.0.1
func (pr *PipelineRun) ProceedInput() (bool, error)
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 PluginResponse ¶ added in v1.0.1
type PluginResponse struct {
Plugins []Plugin `json:"plugins"`
}
type PrivateKey ¶ added in v1.0.1
PrivateKey used in SSHCredentials type, type can be either: KeySourceDirectEntryType - then value should be text with secret KeySourceOnMasterType - then value should be path on master jenkins where secret is stored
type PrivateKeyFile ¶ added in v1.0.1
type Requester ¶
type Requester struct { Base string BasicAuth *BasicAuth Client *http.Client CACert []byte SslVerify bool }
func (*Requester) Do ¶
func (r *Requester) Do(ar *APIRequest, responseStruct interface{}, options ...interface{}) (*http.Response, error)
func (*Requester) ReadJSONResponse ¶ added in v1.0.1
func (*Requester) ReadRawResponse ¶ added in v1.0.1
func (*Requester) SetCrumb ¶ added in v1.0.1
func (r *Requester) SetCrumb(ar *APIRequest) error
type SSHCredentials ¶ added in v1.0.1
type SSHCredentials struct { XMLName xml.Name `xml:"com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey"` ID string `xml:"id"` Scope string `xml:"scope"` Username string `xml:"username"` Description string `xml:"description,omitempty"` PrivateKeySource interface{} `xml:"privateKeySource"` Passphrase string `xml:"passphrase,omitempty"` }
SSHCredentials store credentials for ssh keys.
type StringCredentials ¶ added in v1.0.1
type StringCredentials struct { XMLName xml.Name `xml:"org.jenkinsci.plugins.plaincredentials.impl.StringCredentialsImpl"` ID string `xml:"id"` Scope string `xml:"scope"` Description string `xml:"description"` Secret string `xml:"secret"` }
StringCredentials store only secret text
type Task ¶
func (*Task) GetParameters ¶
func (t *Task) GetParameters() []parameter
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"` }
type UsernameCredentials ¶ added in v1.0.1
type UsernameCredentials struct { XMLName xml.Name `xml:"com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl"` ID string `xml:"id"` Scope string `xml:"scope"` Description string `xml:"description"` Username string `xml:"username"` Password string `xml:"password"` }
UsernameCredentials struct representing credential for storing username-password pair
type View ¶ added in v0.2.0
type View struct { Raw *ViewResponse Jenkins *Jenkins Base string }