Documentation ¶
Index ¶
- func FullJobPath(path ...string) string
- func FullPath(job string) string
- func JobToXml(jobItem JobItem) ([]byte, error)
- func Poll(pollPeriod time.Duration, timeout time.Duration, timeoutFailureMessage string, ...) error
- func RetryAfter(attempts int, callback func() error, d time.Duration) (err error)
- type APIError
- type Action
- type Artifact
- type Auth
- type Branches
- type BranchesSpec
- type Build
- type BuildButtonColumn
- type Cause
- type ChangeSetItem
- type Column
- type Columns
- type Computer
- type ComputerObject
- type ConditionFunc
- type Credential
- type Credentials
- type GitBrowser
- type GitExtensions
- type GitSubmoduleCfg
- type Health
- type Item
- type Jenkins
- func (jenkins *Jenkins) AddJobToView(viewName string, job Job) error
- func (jenkins *Jenkins) BaseURL() string
- func (jenkins *Jenkins) Build(job Job, params url.Values) error
- func (jenkins *Jenkins) CreateCredential(id, username, pass string) error
- func (jenkins *Jenkins) CreateFolderJobWithXML(jobItemXml string, folder string, jobName string) error
- func (jenkins *Jenkins) CreateJob(jobItem JobItem, jobName string) error
- func (jenkins *Jenkins) CreateJobWithXML(jobItemXml string, jobName string) error
- func (jenkins *Jenkins) CreateView(listView ListView) error
- func (jenkins *Jenkins) DeleteJob(job Job) error
- func (jenkins *Jenkins) GetArtifact(build Build, artifact Artifact) ([]byte, error)
- func (jenkins *Jenkins) GetBuild(job Job, number int) (build Build, err error)
- func (jenkins *Jenkins) GetBuildConsoleOutput(build Build) ([]byte, error)
- func (jenkins *Jenkins) GetBuildURL(job Job, buildNumber int) string
- func (jenkins *Jenkins) GetComputer(name string) (computer Computer, err error)
- func (jenkins *Jenkins) GetComputerObject() (co ComputerObject, err error)
- func (jenkins *Jenkins) GetComputers() ([]Computer, error)
- func (jenkins *Jenkins) GetCredential(id string) (c *Credentials, err error)
- func (jenkins *Jenkins) GetJob(name string) (job Job, err error)
- func (jenkins *Jenkins) GetJobByPath(path ...string) (job Job, err error)
- func (jenkins *Jenkins) GetJobConfig(name string) (job JobItem, err error)
- func (jenkins *Jenkins) GetJobURLPath(name string) string
- func (jenkins *Jenkins) GetJobs() ([]Job, error)
- func (jenkins *Jenkins) GetLastBuild(job Job) (build Build, err error)
- func (jenkins *Jenkins) GetLogFromURL(buildUrl string, start int64, logData *LogData) error
- func (jenkins *Jenkins) GetMultiBranchJob(organisationJobName, multibranchJobName, branch string) (job Job, err error)
- func (jenkins *Jenkins) GetOrganizationScanResult(retries int, job Job) (status string, err error)
- func (jenkins *Jenkins) GetQueue() (queue Queue, err error)
- func (jenkins *Jenkins) IsErrNotFound(err error) bool
- func (jenkins *Jenkins) NewLogPoller(buildUrl string, writer io.Writer) *LogPoller
- func (jenkins *Jenkins) Post(path string, params url.Values, body interface{}) (err error)
- func (jenkins *Jenkins) QuietDown() error
- func (jenkins *Jenkins) Reload() error
- func (jenkins *Jenkins) RemoveJob(jobName string) error
- func (jenkins *Jenkins) Restart() error
- func (jenkins *Jenkins) SafeRestart() error
- func (jenkins *Jenkins) SetBuildDescription(build Build, description string) error
- func (jenkins *Jenkins) SetHTTPClient(client *http.Client)
- func (jenkins *Jenkins) StopBuild(job Job, number int) error
- func (jenkins *Jenkins) TailLog(buildUrl string, writer io.Writer, pollTime time.Duration, ...) error
- func (jenkins *Jenkins) TailLogFunc(buildUrl string, writer io.Writer) ConditionFunc
- func (jenkins *Jenkins) UpdateJob(jobItem JobItem, jobName string) error
- type JenkinsClient
- type Job
- type JobColumn
- type JobItem
- type JobProperties
- type JobSetting
- type JobSettings
- type LastDurationColumn
- type LastFailureColumn
- type LastSuccessColumn
- type ListView
- type LocalBranch
- type Locations
- type LogData
- type LogPoller
- type MavenJobItem
- type MultiBranchProject
- type MultiError
- type Parameter
- type ParameterDefinition
- type PipelineDefinition
- type PipelineJobItem
- type PostBuilder
- type PostBuilders
- type Queue
- type RunPostStepsIfResult
- type Scm
- type ScmAuthor
- type ScmChangeSet
- type ScmChangeSetPath
- type ScmContent
- type ScmGit
- type ScmSvn
- type ScmSvnLocation
- type ScmTrigger
- type ShellBuilder
- type StatusColumn
- type Task
- type Trigger
- type Triggers
- type UpstreamCause
- type UserRemoteConfig
- type UserRemoteConfigs
- type WeatherColumn
- type WorkspaceUpdater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FullJobPath ¶
FullJobPath returns the full job path URL for the given paths
Types ¶
type Action ¶
type Action struct { Causes []Cause `json:"causes"` Parameter []Parameter `json:"parameters"` ParameterDefinitions []ParameterDefinition `json:"parameterDefinitions"` }
type Branches ¶
type Branches struct {
BranchesSpec []BranchesSpec `xml:"hudson.plugins.git.BranchSpec"`
}
type BranchesSpec ¶
type BranchesSpec struct {
Name string `xml:"name"`
}
type Build ¶
type Build struct { Id string `json:"id"` Number int `json:"number"` Url string `json:"url"` FullDisplayName string `json:"fullDisplayName"` Description string `json:"description"` Timestamp int `json:"timestamp"` Duration int `json:"duration"` EstimatedDuration int `json:"estimatedDuration"` Building bool `json:"building"` KeepLog bool `json:"keepLog"` Result string `json:"result"` Artifacts []Artifact `json:"artifacts"` Actions []Action `json:"actions"` ChangeSet ScmChangeSet `json:"changeSet"` }
type BuildButtonColumn ¶
type Cause ¶
type Cause struct { ShortDescription string `json:"shortDescription"` UserId string `json:"userId"` UserName string `json:"userName"` UpstreamCause }
type ChangeSetItem ¶
type ChangeSetItem struct { AffectedPaths []string `json:"affectedPaths"` CommitId string `json:"commitId"` Timestamp int `json:"timestamp"` Author ScmAuthor `json:"author"` Comment string `json:"comment"` Date string `json:"date"` Id string `json:"id"` Message string `json:"msg"` Paths []ScmChangeSetPath `json:"paths"` }
type Computer ¶
type Computer struct { Actions []struct{} `json:"actions"` DisplayName string `json:"displayName"` Executors []struct{} `json:"executors"` Idle bool `json:"idle"` JnlpAgent bool `json:"jnlpAgent"` LaunchSupported bool `json:"launchSupported"` ManualLaunchAllowed bool `json:"manualLaunchAllowed"` MonitorData struct { SwapSpaceMonitor struct { AvailablePhysicalMemory int64 `json:"availablePhysicalMemory"` AvailableSwapSpace int64 `json:"availableSwapSpace"` TotalPhysicalMemory int64 `json:"totalPhysicalMemory"` TotalSwapSpace int64 `json:"totalSwapSpace"` } `json:"hudson.node_monitors.SwapSpaceMonitor"` TemporarySpaceMonitor struct { Timestamp int64 `json:"timestamp"` Path string `json:"path"` Size int64 `json:"size"` } `json:"hudson.node_monitors.TemporarySpaceMonitor"` DiskSpaceMonitor struct { Timestamp int64 `json:"timestamp"` Path string `json:"path"` Size int64 `json:"size"` } `json:"hudson.node_monitors.DiskSpaceMonitor"` ArchitectureMonitor string `json:"hudson.node_monitors.ArchitectureMonitor"` ResponseTimeMonitor struct { Timestamp int64 `json:"timestamp"` Average int64 `json:"average"` } `json:"hudson.node_monitors.ResponseTimeMonitor"` ClockMonitor struct { Diff int64 `json:"diff"` } `json:"hudson.node_monitors.ClockMonitor"` } `json:"monitorData"` NumExecutors int `json:"numExecutors"` Offline bool `json:"offline"` OfflineCauseReason string `json:"offlineCauseReason"` TemporarilyOffline bool `json:"temporarilyOffline"` }
type ComputerObject ¶
type ConditionFunc ¶
ConditionFunc returns true if the condition is satisfied, or an error if the loop should be aborted.
func NewConditionFunc ¶
func NewConditionFunc(functions ...ConditionFunc) ConditionFunc
NewConditionFunc combines the functions into a single function that can be used when polling
type Credential ¶
type Credential struct {
Credentials Credentials `json:"credentials"`
}
type Credentials ¶
type GitBrowser ¶
type GitExtensions ¶
type GitExtensions struct { Class string `xml:"class,attr"` LocalBranch LocalBranch `xml:"hudson.plugins.git.extensions.impl.LocalBranch"` }
type GitSubmoduleCfg ¶
type GitSubmoduleCfg struct {
Class string `xml:"class,attr"`
}
type Item ¶
type Item struct { Actions []Action `json:"actions"` Blocked bool `json:"blocked"` Buildable bool `json:"buildable"` Id int64 `json:"id"` InQueueSince int64 `json:"inQueueSince"` Params string `json:"params"` Stuck bool `json:"stuck"` Task Task `json:"task"` URL string `json:"url"` Why string `json:"why"` BuildableStartMilliseconds int64 `json:"buildableStartMilliseconds"` Pending bool `json:"pending"` }
type Jenkins ¶
type Jenkins struct {
// contains filtered or unexported fields
}
func NewJenkins ¶
func (*Jenkins) AddJobToView ¶
Add job to view
func (*Jenkins) CreateCredential ¶
Create a new credentials
func (*Jenkins) CreateFolderJobWithXML ¶
func (jenkins *Jenkins) CreateFolderJobWithXML(jobItemXml string, folder string, jobName string) error
Create a new job in a folder
func (*Jenkins) CreateJobWithXML ¶
Create a new job
func (*Jenkins) CreateView ¶
Create a new view
func (*Jenkins) GetArtifact ¶
GetArtifact return the content of a build artifact
func (*Jenkins) GetBuildConsoleOutput ¶
Get the console output from a build.
func (*Jenkins) GetComputer ¶
GetComputer returns a Computer object with a specified name.
func (*Jenkins) GetComputerObject ¶
func (jenkins *Jenkins) GetComputerObject() (co ComputerObject, err error)
GetComputerObject returns the main ComputerObject
func (*Jenkins) GetComputers ¶
GetComputers returns the list of all Computer objects
func (*Jenkins) GetCredential ¶
func (jenkins *Jenkins) GetCredential(id string) (c *Credentials, err error)
Get a credentials
func (*Jenkins) GetJobByPath ¶
GetJobByPath looks up the jenkins job via the one or more paths
func (*Jenkins) GetJobConfig ¶
GetJobConfig returns a maven job, has the one used to create Maven job
func (*Jenkins) GetJobURLPath ¶
GetJobUrl returns the URL path for the job with the specified name.
func (*Jenkins) GetLastBuild ¶
GetLastBuild returns the last build of specified job.
func (*Jenkins) GetLogFromURL ¶
GetLog returns the log from the given start port (default to zero for all of it)
func (*Jenkins) GetMultiBranchJob ¶
func (*Jenkins) GetOrganizationScanResult ¶
GetLastBuild returns the last build of specified job.
func (*Jenkins) IsErrNotFound ¶
func (*Jenkins) NewLogPoller ¶
NewLogPoller returns a LogPoller for polling the log on the given URL to the given writer
func (*Jenkins) SafeRestart ¶
SafeRestart waits for the jenkins server to be quiet then restarts it
func (*Jenkins) SetBuildDescription ¶
SetBuildDescription sets the description of a build
func (*Jenkins) SetHTTPClient ¶
SetHTTPClient with timeouts or insecure transport, etc.
func (*Jenkins) TailLog ¶
func (jenkins *Jenkins) TailLog(buildUrl string, writer io.Writer, pollTime time.Duration, timeoutPeriod time.Duration) error
TailLog tails the jenkins log to the given writer polling until there is no more output if timeoutPeriod is specified as a positive value then the tail will terminate if the timeout is reached before the log is completely fetched
func (*Jenkins) TailLogFunc ¶
func (jenkins *Jenkins) TailLogFunc(buildUrl string, writer io.Writer) ConditionFunc
TailLogFunc returns a ConditionFunc for polling the log on the given URL to the given writer
type JenkinsClient ¶
type JenkinsClient interface { GetJobs() ([]Job, error) GetJob(string) (Job, error) GetJobURLPath(string) string IsErrNotFound(error) bool BaseURL() string SetHTTPClient(*http.Client) Post(string, url.Values, interface{}) (err error) GetJobConfig(string) (JobItem, error) GetBuild(Job, int) (Build, error) GetLastBuild(Job) (Build, error) StopBuild(Job, int) error GetMultiBranchJob(string, string, string) (Job, error) GetJobByPath(...string) (Job, error) GetOrganizationScanResult(int, Job) (string, error) CreateJob(JobItem, string) error Reload() error Restart() error SafeRestart() error QuietDown() error CreateJobWithXML(string, string) error CreateFolderJobWithXML(string, string, string) error GetCredential(string) (*Credentials, error) CreateCredential(string, string, string) error DeleteJob(Job) error UpdateJob(JobItem, string) error RemoveJob(string) error AddJobToView(string, Job) error CreateView(ListView) error Build(Job, url.Values) error GetBuildConsoleOutput(Build) ([]byte, error) GetQueue() (Queue, error) GetArtifact(Build, Artifact) ([]byte, error) SetBuildDescription(Build, string) error GetComputerObject() (ComputerObject, error) GetComputers() ([]Computer, error) GetComputer(string) (Computer, error) GetBuildURL(Job, int) string GetLogFromURL(string, int64, *LogData) error TailLog(string, io.Writer, time.Duration, time.Duration) error TailLogFunc(string, io.Writer) ConditionFunc NewLogPoller(string, io.Writer) *LogPoller }
JenkinsClient is the interface for interacting with jenkins
type Job ¶
type Job struct { Actions []Action `json:"actions"` Class string `json:"_class"` Name string `json:"name"` FullName string `json:"fullName"` Url string `json:"url"` Color string `json:"color"` Buildable bool `json:"buildable"` DisplayName string `json:"displayName"` Description string `json:"description"` HealthReport []Health `json:"healthReport"` Jobs []Job `json:"jobs"` // for folders LastBuild Build `json:"lastBuild"` LastCompletedBuild Build `json:"lastCompletedBuild"` LastFailedBuild Build `json:"lastFailedBuild"` LastStableBuild Build `json:"lastStableBuild"` LastSuccessfulBuild Build `json:"lastSuccessfulBuild"` LastUnstableBuild Build `json:"lastUnstableBuild"` LastUnsuccessfulBuild Build `json:"lastUnsuccessfulBuild"` }
type JobItem ¶
type JobItem struct { XMLName struct{} `xml:"item"` MavenJobItem *MavenJobItem `xml:"maven2-moduleset"` PipelineJobItem *PipelineJobItem `xml:"flow-definition"` }
type JobProperties ¶
type JobProperties struct { }
type JobSetting ¶
type JobSetting struct { }
type JobSettings ¶
type JobSettings struct { Class string `xml:"class,attr"` JobSetting []JobSetting }
type LastDurationColumn ¶
type LastFailureColumn ¶
type LastSuccessColumn ¶
type ListView ¶
type ListView struct { XMLName xml.Name `xml:"hudson.model.ListView"` Name string `xml:"name"` FilterExecutors bool `xml:"filterExecutors"` FilterQueue bool `xml:"filterQueue"` Columns Columns `xml:"columns"` }
func NewListView ¶
type LocalBranch ¶
type LocalBranch struct {
LocalBranch string `xml:"localBranch"`
}
type Locations ¶
type Locations struct {
Location []ScmSvnLocation `xml:"hudson.scm.SubversionSCM_-ModuleLocation"`
}
type MavenJobItem ¶
type MavenJobItem struct { XMLName struct{} `xml:"maven2-moduleset"` Plugin string `xml:"plugin,attr"` Actions string `xml:"actions"` Description string `xml:"description"` KeepDependencies string `xml:"keepDependencies"` Properties JobProperties `xml:"properties"` Scm Scm `xml:"scm"` CanRoam string `xml:"canRoam"` Disabled string `xml:"disabled"` BlockBuildWhenDownstreamBuilding string `xml:"blockBuildWhenDownstreamBuilding"` BlockBuildWhenUpstreamBuilding string `xml:"blockBuildWhenUpstreamBuilding"` Triggers Triggers `xml:"triggers"` ConcurrentBuild string `xml:"concurrentBuild"` Goals string `xml:"goals"` AggregatorStyleBuild string `xml:"aggregatorStyleBuild"` IncrementalBuild string `xml:"incrementalBuild"` IgnoreUpstremChanges string `xml:"ignoreUpstremChanges"` ArchivingDisabled string `xml:"archivingDisabled"` SiteArchivingDisabled string `xml:"siteArchivingDisabled"` FingerprintingDisabled string `xml:"fingerprintingDisabled"` ResolveDependencies string `xml:"resolveDependencies"` ProcessPlugins string `xml:"processPlugins"` MavenName string `xml:"mavenName"` MavenValidationLevel string `xml:"mavenValidationLevel"` DefaultGoals string `xml:"defaultGoals"` RunHeadless string `xml:"runHeadless"` DisableTriggerDownstreamProjects string `xml:"disableTriggerDownstreamProjects"` Settings JobSettings `xml:"settings"` GlobalSettings JobSettings `xml:"globalSettings"` RunPostStepsIfResult RunPostStepsIfResult `xml:"runPostStepsIfResult"` Postbuilders PostBuilders `xml:"postbuilders"` }
type MultiBranchProject ¶
type MultiError ¶
type MultiError struct {
Errors []error
}
func (*MultiError) Collect ¶
func (m *MultiError) Collect(err error)
func (MultiError) ToError ¶
func (m MultiError) ToError() error
type Parameter ¶
type Parameter struct { Name string `json:"name"` Value interface{} `json:"value"` }
Parameter for a build
type ParameterDefinition ¶
type ParameterDefinition struct {
Name string `json:"name"`
}
type PipelineDefinition ¶
type PipelineJobItem ¶
type PipelineJobItem struct { XMLName struct{} `xml:"flow-definition"` /* Plugin string `xml:"plugin,attr"` */ Actions string `xml:"actions"` Description string `xml:"description"` KeepDependencies string `xml:"keepDependencies"` Properties JobProperties `xml:"properties"` Definition PipelineDefinition `xml:"definition"` Triggers Triggers `xml:"triggers"` }
type PostBuilder ¶
type PostBuilder interface { }
type PostBuilders ¶
type PostBuilders struct { XMLName xml.Name `xml:"postbuilders"` PostBuilder []PostBuilder }
type RunPostStepsIfResult ¶
type Scm ¶
type Scm struct { ScmContent Class string `xml:"class,attr"` Plugin string `xml:"plugin,attr"` }
func (*Scm) MarshalXML ¶
MarshalXML implements xml.MarshalXML interface Encodes the multiple types of Scm
func (*Scm) UnmarshalXML ¶
UnmarshalXML implements xml.UnmarshalXML interface Decode between multiple types of Scm
type ScmChangeSet ¶
type ScmChangeSet struct { Kind string `json:"kind"` Items []ChangeSetItem `json:"items"` }
type ScmChangeSetPath ¶
type ScmContent ¶
type ScmContent interface{}
type ScmGit ¶
type ScmGit struct { UserRemoteConfigs UserRemoteConfigs `xml:"userRemoteConfigs"` Branches Branches `xml:"branches"` DoGenerateSubmoduleConfigurations bool `xml:"doGenerateSubmoduleConfigurations"` GitBrowser GitBrowser `xml:"browser"` GitSubmoduleCfg GitSubmoduleCfg `xml:"submoduleCfg"` GitExtensions GitExtensions `xml:"extensions"` }
type ScmSvn ¶
type ScmSvn struct { Locations Locations `xml:"locations"` ExcludedRegions string `xml:"excludedRegions"` IncludedRegions string `xml:"includedRegions"` ExcludedUsers string `xml:"excludedUsers"` ExcludedRevprop string `xml:"excludedRevprop"` ExcludedCommitMessages string `xml:"excludedCommitMessages"` WorkspaceUpdater WorkspaceUpdater `xml:"workspaceUpdater"` IgnoreDirPropChanges string `xml:"ignoreDirPropChanges"` FilterChangelog string `xml:"filterChangelog"` }
type ScmSvnLocation ¶
type ScmTrigger ¶
type ShellBuilder ¶
type StatusColumn ¶
type UpstreamCause ¶
type UserRemoteConfig ¶
type UserRemoteConfig struct {
Urls []string `xml:"url"`
}
type UserRemoteConfigs ¶
type UserRemoteConfigs struct {
UserRemoteConfig UserRemoteConfig `xml:"hudson.plugins.git.UserRemoteConfig"`
}
type WeatherColumn ¶
type WorkspaceUpdater ¶
type WorkspaceUpdater struct {
Class string `xml:"class,attr"`
}