Documentation ¶
Index ¶
- Constants
- 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, error)
- 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() float64
- 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) GetSecondsTimestamp() int64
- 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 BuildFilter
- type BuildParameters
- type BuildResponse
- type BuildRevision
- type Builds
- type Component
- func (c *Component) AddCredential(domain string, cred interface{}, folders ...string) error
- func (c *Component) BuildJob(JobName string, payload map[string]string) (int64, error)
- func (c *Component) CopyJob(copyFrom string, newName string) (*Job, error)
- func (c *Component) CreateFolder(name string, parents ...string) (*Folder, error)
- func (c *Component) CreateJob(config string, options ...interface{}) (*Job, error)
- func (c *Component) CreateJobInFolder(config string, jobName string, parentIDs ...string) (*Job, error)
- func (c *Component) CreateView(name string, viewType string) (*View, error)
- func (c *Component) DeleteCredential(domain string, id string, folders ...string) error
- func (c *Component) DeleteJob(name string, parentIDs ...string) (bool, error)
- func (c *Component) GetAllBuildIds(job string) ([]JobBuild, error)
- func (c *Component) GetAllJobNames() ([]InnerJob, error)
- func (c *Component) GetAllJobs() ([]*Job, error)
- func (c *Component) GetAllViews() ([]*View, error)
- func (c *Component) GetArtifactData(id string) (*FingerPrintResponse, error)
- func (c *Component) GetBuild(jobName string, number int64) (*Build, error)
- func (c *Component) GetBuildFromQueueID(job *Job, queueId int64) (*Build, error)
- func (c *Component) GetCredentialManager(folders ...string) *CredentialsManager
- func (c *Component) GetFolder(id string, parents ...string) (*Folder, error)
- func (c *Component) GetJob(id string, parentIDs ...string) (*Job, error)
- func (c *Component) GetLabel(name string) (*Label, error)
- func (c *Component) GetPlugins(depth int) (*Plugins, error)
- func (c *Component) GetQueue() (*Queue, error)
- func (c *Component) GetQueueItem(id int64) (*Task, error)
- func (c *Component) GetSingleCredential(domain string, id string, cred interface{}, folders ...string) error
- func (c *Component) GetSubJob(parentId string, childId string) (*Job, error)
- func (c *Component) GetView(name string) (*View, error)
- func (c *Component) HasPlugin(name string) (*Plugin, error)
- func (c *Component) Info() (*ExecutorResponse, error)
- func (c *Component) InstallPlugin(name string, version string) error
- func (c *Component) ListCredential(domain string, folders ...string) ([]string, error)
- func (c *Component) Logger() *elog.Component
- func (c *Component) RenameJob(job string, name string) (*Job, error)
- func (c *Component) SafeRestart() error
- func (c *Component) UninstallPlugin(name string) error
- func (c *Component) UpdateCredential(domain string, id string, cred interface{}, folders ...string) error
- func (c *Component) UpdateJob(job string, config string) (*Job, error)
- func (c *Component) UpdateJobInFolder(jobName string, config string, parentIDs ...string) (*Job, error)
- func (c *Component) ValidateFingerPrint(id string) (bool, error)
- type Config
- type ConsoleResponse
- type Container
- 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 FileCredentials
- type FingerPrint
- type FingerPrintResponse
- type Folder
- type FolderResponse
- type History
- type InnerJob
- type Jenkins
- func (j *Jenkins) BuildJob(JobName string, payload map[string]string) (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) CreateView(name string, viewType string) (*View, error)
- func (j *Jenkins) DeleteJob(name string, parentIDs ...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) GetAllViews() ([]*View, error)
- func (j *Jenkins) GetArtifactData(id string) (*FingerPrintResponse, error)
- func (j *Jenkins) GetBuild(jobName string, number int64) (*Build, error)
- func (j *Jenkins) GetBuildFromQueueID(job *Job, queueId 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) GetJobObj(name string) *Job
- func (j *Jenkins) GetLabel(name string) (*Label, 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) NewCredentialsManager(folders ...string) *CredentialsManager
- func (j *Jenkins) Poll() (int, error)
- func (j *Jenkins) RenameJob(job string, name string) (*Job, error)
- func (j *Jenkins) SafeRestart() error
- func (j *Jenkins) UninstallPlugin(name string) error
- func (j *Jenkins) UpdateJob(job string, config string) (*Job, error)
- func (j *Jenkins) UpdateJobInFolder(jobName string, config string, parentIDs ...string) (*Job, 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) GetBuildByFilter(filter *BuildFilter, intervalSeconds int, maxTryTimes uint) (targetBuild *Build, err error)
- func (j *Job) GetBuildsFields(fields []string, custom interface{}) 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) Invoke(payload map[string]string, buildParams *BuildParameters, securityToken string) (*Build, error)
- func (j *Job) InvokeSimple(payload 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 Option
- type ParameterDefinition
- type ParameterItem
- 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{}) (resp *resty.Response, err error)
- func (r *Requester) Get(endpoint string, payload map[string]string, responseStruct interface{}, ...) (*resty.Response, error)
- func (r *Requester) GetJSON(endpoint string, payload map[string]string, responseStruct interface{}, ...) (*resty.Response, error)
- func (r *Requester) GetXML(endpoint string, payload map[string]string, responseStruct interface{}, ...) (*resty.Response, error)
- func (r *Requester) NewAPIRequest(method string, endpoint string, payload map[string]string) *APIRequest
- func (r *Requester) Post(endpoint string, payload map[string]string, responseStruct interface{}, ...) (*resty.Response, error)
- func (r *Requester) PostFiles(endpoint string, payload map[string]string, responseStruct interface{}, ...) (*resty.Response, error)
- func (r *Requester) PostJSON(endpoint string, payload map[string]string, responseStruct interface{}, ...) (*resty.Response, error)
- func (r *Requester) PostXML(endpoint string, payload map[string]string, xml string, ...) (*resty.Response, error)
- func (r *Requester) ReadJSONResponse(response *resty.Response, responseStruct interface{}) (*resty.Response, error)
- func (r *Requester) ReadRawResponse(response *resty.Response, responseStruct interface{}) (*resty.Response, error)
- 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 ( StatusFail = "FAIL" StatusError = "ERROR" StatusAborted = "ABORTED" StatusRegression = "REGRESSION" StatusSuccess = "SUCCESS" StatusFixed = "FIXED" StatusPassed = "PASSED" ResultStatusFailure = "FAILURE" ResultStatusFailed = "FAILED" ResultStatusSkipped = "SKIPPED" StrReSplitView = "(.*)/view/([^/]*)/?" )
const ( ListView = "hudson.model.ListView" NestedView = "hudson.plugins.nested_view.NestedView" MyView = "hudson.model.MyView" DashboardView = "hudson.plugins.view.dashboard.Dashboard" PipelineView = "au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView" )
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
const PackageName = "component.ejenkins"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIRequest ¶
type APIRequest struct { RequestInst *resty.Request // request instance, init in Requester.NewAPIRequest func Method string Endpoint string Payload map[string]string Suffix string }
func (*APIRequest) SetHeader ¶
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 ¶
func (b *Build) GetAllFingerPrints() []*FingerPrint
func (*Build) GetArtifacts ¶
func (*Build) GetBuildNumber ¶
func (*Build) GetConsoleOutput ¶
func (*Build) GetConsoleOutputFromIndex ¶
func (b *Build) GetConsoleOutputFromIndex(startID int64) (ConsoleResponse, error)
func (*Build) GetCulprits ¶
func (*Build) GetDownstreamBuilds ¶
func (*Build) GetDownstreamJobNames ¶
func (*Build) GetDuration ¶
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 ¶
func (*Build) GetSecondsTimestamp ¶
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 ¶
type BuildFilter ¶
type BuildParameters ¶
type BuildParameters struct {
Parameter []ParameterItem `json:"parameter"`
}
type BuildResponse ¶
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 float64 `json:"duration"` EstimatedDuration float64 `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"` NextBuild struct { Number int64 `json:"number"` URL string `json:"url"` } `json:"nextBuild"` PreviousBuild struct { Number int64 `json:"number"` URL string `json:"url"` } `json:"previousBuild"` }
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 Component ¶
type Component struct {
// contains filtered or unexported fields
}
func (*Component) AddCredential ¶
func (*Component) CreateFolder ¶
func (*Component) CreateJobInFolder ¶
func (*Component) CreateView ¶
func (*Component) DeleteCredential ¶
func (*Component) GetAllBuildIds ¶
func (*Component) GetAllJobNames ¶
func (*Component) GetAllJobs ¶
func (*Component) GetAllViews ¶
func (*Component) GetArtifactData ¶
func (c *Component) GetArtifactData(id string) (*FingerPrintResponse, error)
func (*Component) GetBuildFromQueueID ¶
func (*Component) GetCredentialManager ¶
func (c *Component) GetCredentialManager(folders ...string) *CredentialsManager
func (*Component) GetSingleCredential ¶
func (*Component) Info ¶
func (c *Component) Info() (*ExecutorResponse, error)
exposes the jenkins REST api
func (*Component) InstallPlugin ¶
func (*Component) ListCredential ¶
func (*Component) SafeRestart ¶
func (*Component) UninstallPlugin ¶
func (*Component) UpdateCredential ¶
func (*Component) UpdateJobInFolder ¶
type Config ¶
type ConsoleResponse ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func DefaultContainer ¶
func DefaultContainer() *Container
type CredentialsManager ¶
CredentialsManager is utility to control credential plugin Credentials declared by it can be used in jenkins jobs
func (CredentialsManager) Add ¶
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 ¶
func (cm CredentialsManager) Delete(domain string, id string) error
Delete credential in given domain with given id
func (CredentialsManager) GetSingle ¶
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 ¶
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 ¶
type ExecutorResponse struct { AssignedLabels []map[string]string `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 FileCredentials ¶
type FileCredentials struct { XMLName xml.Name `xml:"org.jenkinsci.plugins.plaincredentials.impl.FileCredentialsImpl"` ID string `xml:"id"` Scope string `xml:"scope"` Description string `xml:"description"` Filename string `xml:"fileName"` SecretBytes string `xml:"secretBytes"` }
FileCredentials store a file "SecretBytes" is a base64 encoded file content
type FingerPrint ¶
type FingerPrint struct { Jenkins *Jenkins Base string Id string Raw *FingerPrintResponse }
func (FingerPrint) GetInfo ¶
func (f FingerPrint) GetInfo() (*FingerPrintResponse, error)
func (FingerPrint) Poll ¶
func (f FingerPrint) Poll() (int, error)
func (FingerPrint) Valid ¶
func (f FingerPrint) Valid() (bool, error)
func (FingerPrint) ValidateForBuild ¶
func (f FingerPrint) ValidateForBuild(filename string, build *Build) (bool, error)
type FingerPrintResponse ¶
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 ¶
type Folder struct { Raw *FolderResponse Jenkins *Jenkins Base string }
type FolderResponse ¶
type Jenkins ¶
type Jenkins struct { Server string Version string Raw *ExecutorResponse Requester *Requester // contains filtered or unexported fields }
func (*Jenkins) BuildJob ¶
Invoke a job. First parameter job name, second parameter is optional Build parameters. Returns queue id Node, this function cannot post file(s)
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 ¶
Create a new folder This folder can be nested in other parent folders Example: CreateFolder("newFolder", "grandparentFolder", "parentFolder")
func (*Jenkins) CreateJob ¶
Create a new job from config(xml) 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 CreateJob("<config></config>","newJobName")
func (*Jenkins) CreateJobInFolder ¶
func (j *Jenkins) CreateJobInFolder(config string, jobName string, parentIDs ...string) (*Job, error)
Create a new job in the folder
Example: CreateJobInFolder("<config></config>", "newJobName", "folder1", "folder2"); if create successfully, the url of the new job will be {JenkinsHost}/job/folder1/job/folder2/job/newJobName
func (*Jenkins) CreateView ¶
Create View First Parameter - name of the View Second parameter - Type Possible Types(const string of this pkg mops-be/pkg/service/jenkins/api):
ListView NestedView MyView DashboardView PipelineView
Example: CreateView("newView", LIST_VIEW)
func (*Jenkins) GetAllBuildIds ¶
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 GetBuild(job,buildNumber) or job.GetBuild(buildNumber)
func (*Jenkins) GetAllJobNames ¶
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) GetAllViews ¶
func (*Jenkins) GetArtifactData ¶
func (j *Jenkins) GetArtifactData(id string) (*FingerPrintResponse, error)
Get Artifact data by Hash
func (*Jenkins) GetBuildFromQueueID ¶
A task in queue will be assigned a build number in a job after a few seconds. this function will return the build object.
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 ¶
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) InstallPlugin ¶
InstallPlugin with given version and name
func (*Jenkins) NewCredentialsManager ¶
func (j *Jenkins) NewCredentialsManager(folders ...string) *CredentialsManager
func (*Jenkins) RenameJob ¶
Rename a job. First parameter job old name, Second parameter job new name.
func (*Jenkins) SafeRestart ¶
SafeRestart jenkins, restart will be done when there are no jobs running
func (*Jenkins) UninstallPlugin ¶
UninstallPlugin plugin otherwise returns error
func (*Jenkins) UpdateJobInFolder ¶
func (j *Jenkins) UpdateJobInFolder(jobName string, config string, parentIDs ...string) (*Job, error)
Update job in folder if parents is empty, this function equal to UpdateJob func. Example: UpdateJobInFolder("<xml></xml>", "jobName", "myFolder", "parentFolder", "grandparentFolder",...)
type Job ¶
type Job struct { Raw *JobResponse Jenkins *Jenkins Base string }
func (*Job) GetAllBuildIds ¶
Returns All Builds with Number and URL
func (*Job) GetBuildByFilter ¶
func (*Job) GetBuildsFields ¶
func (*Job) GetDescription ¶
func (*Job) GetDetails ¶
func (j *Job) GetDetails() *JobResponse
func (*Job) GetDownstreamJobs ¶
func (*Job) GetDownstreamJobsMetadata ¶
func (*Job) GetFirstBuild ¶
func (*Job) GetInnerJobs ¶
func (*Job) GetInnerJobsMetadata ¶
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 ¶
func (job *Job) GetPipelineRun(id string) (pr *PipelineRun, err error)
func (*Job) GetPipelineRuns ¶
func (job *Job) GetPipelineRuns() (pr []PipelineRun, err error)
func (*Job) GetUpstreamJobs ¶
func (*Job) GetUpstreamJobsMetadata ¶
func (*Job) Invoke ¶
func (j *Job) Invoke(payload map[string]string, buildParams *BuildParameters, securityToken string) (*Build, error)
Job.Invoke function will invoke a new build of the Job based on the "payload"(formData) and "buildParams"(support files) return:
error: nil or the error encountered in invoking *build: the pointer which point to the invoked build; nil if error != nil
Note:
- the value of the same key of payload will be replaced by corresponding value of the same key which in buildParams
- this function support post(upload) file(s), please set file(s) in buildParams
- about the return. the *Build can be nil, even if the error is nil! the error is nil, just means the job has been invoked successfully, but the invoked build may not be found currently. so, if using the result *Build which this function returned, please check it is not nil before using it, even the error which this function returned is nil
func (*Job) UpdateConfig ¶
type JobResponse ¶
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 ¶
type Label struct { Raw *LabelResponse Jenkins *Jenkins Base string }
type LabelResponse ¶
type Option ¶
type Option func(c *Container)
func WithLogger ¶
WithLogger assign specific logger to ejenkins component. Optional
type ParameterDefinition ¶
type ParameterItem ¶
type PipelineArtifact ¶
type PipelineInputAction ¶
type PipelineNode ¶
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 ¶
func (node *PipelineNode) GetLog() (log *PipelineNodeLog, err error)
type PipelineNodeLog ¶
type PipelineRun ¶
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 ¶
func (pr *PipelineRun) AbortInput() (bool, error)
func (*PipelineRun) GetArtifacts ¶
func (pr *PipelineRun) GetArtifacts() (artifacts []PipelineArtifact, err error)
func (*PipelineRun) GetNode ¶
func (pr *PipelineRun) GetNode(id string) (node *PipelineNode, err error)
func (*PipelineRun) GetPendingInputActions ¶
func (pr *PipelineRun) GetPendingInputActions() (PIAs []PipelineInputAction, err error)
func (*PipelineRun) ProceedInput ¶
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 ¶
type PluginResponse struct {
Plugins []Plugin `json:"plugins"`
}
type PrivateKey ¶
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 ¶
type Requester ¶
type Requester struct { Base string BasicAuth *BasicAuth Client *ehttp.Component SslVerify bool // contains filtered or unexported fields }
func (*Requester) Do ¶
func (r *Requester) Do(ar *APIRequest, responseStruct interface{}, options ...interface{}) (resp *resty.Response, err error)
func (*Requester) GetXML ¶
func (r *Requester) GetXML(endpoint string, payload map[string]string, responseStruct interface{}, query map[string]string) (*resty.Response, error)
GetXML note, golang not support xml1.1, if jenkins returned the xml with version 1.1, will cause an error.
func (*Requester) NewAPIRequest ¶
func (*Requester) PostFiles ¶
func (r *Requester) PostFiles(endpoint string, payload map[string]string, responseStruct interface{}, querystring map[string]string, params *BuildParameters) (*resty.Response, error)
Note, files in BuildParameters
func (*Requester) ReadJSONResponse ¶
func (*Requester) ReadRawResponse ¶
func (*Requester) SetCrumb ¶
func (r *Requester) SetCrumb(ar *APIRequest) error
type SSHCredentials ¶
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 ¶
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 float64 `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 float64 `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 float64 `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 ¶
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
Source Files ¶
- component.go
- config.go
- constants.go
- container.go
- options.go
- service_artifact.go
- service_build.go
- service_credentials.go
- service_executor.go
- service_fingerprint.go
- service_folder.go
- service_jenkins.go
- service_job.go
- service_label.go
- service_pipeline.go
- service_plugin.go
- service_queue.go
- service_request.go
- service_views.go
- utils.go