Documentation
¶
Index ¶
- Constants
- func ParseJobPath(jobName string) (path string)
- func ParsePipelinePath(pipelines ...string) string
- func PrepareEmptyItems(roundTripper *mhttp.MockRoundTripper, rootURL, name, kind, user, token string)
- func PrepareForBuildWithNoParams(roundTripper *mhttp.MockRoundTripper, rootURL, jobName, user, password string) (request *http.Request, response *http.Response)
- func PrepareForBuildWithParams(roundTripper *mhttp.MockRoundTripper, rootURL, jobName, user, password string) (request *http.Request, response *http.Response)
- func PrepareForCreatePipelineJob(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string, ...)
- func PrepareForDisableJob(roundTripper *mhttp.MockRoundTripper, rootURL, name, user, token string)
- func PrepareForEnableJob(roundTripper *mhttp.MockRoundTripper, rootURL, name, user, token string)
- func PrepareForGetBuild(roundTripper *mhttp.MockRoundTripper, rootURL, jobName string, buildID int, ...)
- func PrepareForGetJob(roundTripper *mhttp.MockRoundTripper, rootURL, jobName, user, password string) (response *http.Response)
- func PrepareForGetJobInputActions(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, jobName string, ...) (request *http.Request, response *http.Response)
- func PrepareForGetJobWithParams(roundTripper *mhttp.MockRoundTripper, rootURL, jobName, user, password string)
- func PrepareForJobLog(roundTripper *mhttp.MockRoundTripper, rootURL, jobName string, buildID int, ...)
- func PrepareForSubmitInput(roundTripper *mhttp.MockRoundTripper, rootURL, jobPath, user, password string) (request *http.Request, response *http.Response)
- func PrepareForSubmitProcessInput(roundTripper *mhttp.MockRoundTripper, rootURL, jobPath, user, password string) (request *http.Request, response *http.Response)
- func PrepareOneItem(roundTripper *mhttp.MockRoundTripper, rootURL, name, kind, user, token string)
- type AgentLabel
- type BlueOceanClient
- func (boClient *BlueOceanClient) Build(organization string, pipelines ...string) (*PipelineBuild, error)
- func (boClient *BlueOceanClient) GetBuild(organization string, runID string, pipelines ...string) (*PipelineBuild, error)
- func (boClient *BlueOceanClient) Search(name string, start, limit int) (items []JenkinsItem, err error)
- type Build
- type Category
- type CategoryItem
- type Client
- func (q *Client) AddParameters(name, parameters string) (err error)
- func (q *Client) Build(jobName string) (err error)
- func (q *Client) BuildAndReturn(jobName, cause string, timeout, delay int) (build IdentityBuild, err error)
- func (q *Client) BuildWithParams(jobName string, parameters []ParameterDefinition) (err error)
- func (q *Client) Create(jobPayload CreateJobPayload) (err error)
- func (q *Client) CreateJobInFolder(jobPayload CreateJobPayload, path string) (err error)
- func (q *Client) Delete(jobName string) (err error)
- func (q *Client) DeleteHistory(jobName string, num int) (err error)
- func (q *Client) DisableJob(jobName string) (err error)
- func (q *Client) EnableJob(jobName string) (err error)
- func (q *Client) GetBuild(jobName string, id int) (job *Build, err error)
- func (q *Client) GetHistory(name string) (builds []*Build, err error)
- func (q *Client) GetJob(name string) (job *Job, err error)
- func (q *Client) GetJobInputActions(jobName string, buildID int) (actions []InputItem, err error)
- func (q *Client) GetJobTypeCategories() (jobCategories []Category, err error)
- func (q *Client) GetPipeline(name string) (pipeline *Pipeline, err error)
- func (q *Client) JobInputSubmit(jobName, inputID string, buildID int, abort bool, params map[string]string) (err error)
- func (q *Client) Log(jobName string, history int, start int64) (jobLog Log, err error)
- func (q *Client) RemoveParameters(name, parameters string) (err error)
- func (q *Client) Search(name, kind string, start, limit int) (items []JenkinsItem, err error)
- func (q *Client) SearchViaBlue(name string, start, limit int) (items []JenkinsItem, err error)deprecated
- func (q *Client) StopJob(jobName string, num int) (err error)
- func (q *Client) UpdatePipeline(name, script string) (err error)
- type CreateJobPayload
- type DefaultParameterValue
- type IdentityBuild
- type IdentityCause
- type InputItem
- type JenkinsInputParametersRequest
- type JenkinsItem
- type JenkinsStatus
- type JenkinsStatusClient
- type Job
- type Log
- type ParameterDefinition
- type ParametersDefinitionProperty
- type Pipeline
- type PipelineBuild
- type SimpleJobBuild
- type Time
- type View
Constants ¶
const ( // StringParameterDefinition is the definition for string parameter StringParameterDefinition = "StringParameterDefinition" // FileParameterDefinition is the definition for file parameter FileParameterDefinition = "FileParameterDefinition" )
Variables ¶
This section is empty.
Functions ¶
func ParsePipelinePath ¶
ParsePipelinePath parses multiple pipelines and leads with slash.
func PrepareEmptyItems ¶
func PrepareEmptyItems(roundTripper *mhttp.MockRoundTripper, rootURL, name, kind, user, token string)
PrepareEmptyItems only for test
func PrepareForBuildWithNoParams ¶
func PrepareForBuildWithNoParams(roundTripper *mhttp.MockRoundTripper, rootURL, jobName, user, password string) ( request *http.Request, response *http.Response)
PrepareForBuildWithNoParams only for test
func PrepareForBuildWithParams ¶
func PrepareForBuildWithParams(roundTripper *mhttp.MockRoundTripper, rootURL, jobName, user, password string) ( request *http.Request, response *http.Response)
PrepareForBuildWithParams only for test
func PrepareForCreatePipelineJob ¶
func PrepareForCreatePipelineJob(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string, jobPayload CreateJobPayload)
PrepareForCreatePipelineJob only for test
func PrepareForDisableJob ¶
func PrepareForDisableJob(roundTripper *mhttp.MockRoundTripper, rootURL, name, user, token string)
PrepareForDisableJob only for test
func PrepareForEnableJob ¶
func PrepareForEnableJob(roundTripper *mhttp.MockRoundTripper, rootURL, name, user, token string)
PrepareForEnableJob only for test
func PrepareForGetBuild ¶
func PrepareForGetBuild(roundTripper *mhttp.MockRoundTripper, rootURL, jobName string, buildID int, user, password string)
PrepareForGetBuild only for test
func PrepareForGetJob ¶
func PrepareForGetJob(roundTripper *mhttp.MockRoundTripper, rootURL, jobName, user, password string) ( response *http.Response)
PrepareForGetJob only for test
func PrepareForGetJobInputActions ¶
func PrepareForGetJobInputActions(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, jobName string, buildID int) ( request *http.Request, response *http.Response)
PrepareForGetJobInputActions only for test
func PrepareForGetJobWithParams ¶
func PrepareForGetJobWithParams(roundTripper *mhttp.MockRoundTripper, rootURL, jobName, user, password string)
PrepareForGetJobWithParams only for test
func PrepareForJobLog ¶
func PrepareForJobLog(roundTripper *mhttp.MockRoundTripper, rootURL, jobName string, buildID int, user, password string)
PrepareForJobLog only for test
func PrepareForSubmitInput ¶
func PrepareForSubmitInput(roundTripper *mhttp.MockRoundTripper, rootURL, jobPath, user, password string) ( request *http.Request, response *http.Response)
PrepareForSubmitInput only for test
func PrepareForSubmitProcessInput ¶
func PrepareForSubmitProcessInput(roundTripper *mhttp.MockRoundTripper, rootURL, jobPath, user, password string) ( request *http.Request, response *http.Response)
PrepareForSubmitProcessInput only for test
func PrepareOneItem ¶
func PrepareOneItem(roundTripper *mhttp.MockRoundTripper, rootURL, name, kind, user, token string)
PrepareOneItem only for test
Types ¶
type AgentLabel ¶
type AgentLabel struct {
Name string
}
AgentLabel represents the label of Jenkins agent
type BlueOceanClient ¶
type BlueOceanClient struct { core.JenkinsCore Organization string }
BlueOceanClient is client for operating pipelines via BlueOcean RESTful API.
func (*BlueOceanClient) Build ¶
func (boClient *BlueOceanClient) Build(organization string, pipelines ...string) (*PipelineBuild, error)
Build builds a pipeline for specific organization and pipelines.
func (*BlueOceanClient) GetBuild ¶
func (boClient *BlueOceanClient) GetBuild(organization string, runID string, pipelines ...string) (*PipelineBuild, error)
GetBuild gets build result for specific organization, run ID and pipelines.
func (*BlueOceanClient) Search ¶
func (boClient *BlueOceanClient) Search(name string, start, limit int) (items []JenkinsItem, err error)
Search searches jobs via the BlueOcean API
type Build ¶
type Build struct { SimpleJobBuild Building bool Description string DisplayName string Duration int64 EstimatedDuration int64 FullDisplayName string ID string KeepLog bool QueueID int Result string Timestamp int64 PreviousBuild SimpleJobBuild NextBuild SimpleJobBuild }
Build represents a job build
type Category ¶
type Category struct { Description string ID string Items []CategoryItem MinToShow int Name string Order int }
Category represents a job category
type CategoryItem ¶
CategoryItem represents a job category item
type Client ¶
type Client struct { core.JenkinsCore Parent string }
Client is client for operate jobs
func (*Client) AddParameters ¶
AddParameters add parameters to a Pipeline
func (*Client) BuildAndReturn ¶
func (q *Client) BuildAndReturn(jobName, cause string, timeout, delay int) (build IdentityBuild, err error)
BuildAndReturn trigger a job then returns the build info
func (*Client) BuildWithParams ¶
func (q *Client) BuildWithParams(jobName string, parameters []ParameterDefinition) (err error)
BuildWithParams build a job which has params
func (*Client) Create ¶
func (q *Client) Create(jobPayload CreateJobPayload) (err error)
Create can create a job
func (*Client) CreateJobInFolder ¶
func (q *Client) CreateJobInFolder(jobPayload CreateJobPayload, path string) (err error)
CreateJobInFolder creates a job in a specific folder and create folder first if the folder does not exist
func (*Client) DeleteHistory ¶
DeleteHistory returns the build history of a job
func (*Client) DisableJob ¶
DisableJob disable a job
func (*Client) GetHistory ¶
GetHistory returns the build history of a job
func (*Client) GetJobInputActions ¶
GetJobInputActions returns the all pending actions
func (*Client) GetJobTypeCategories ¶
GetJobTypeCategories returns all categories of jobs
func (*Client) GetPipeline ¶
GetPipeline return the pipeline object
func (*Client) JobInputSubmit ¶
func (q *Client) JobInputSubmit(jobName, inputID string, buildID int, abort bool, params map[string]string) (err error)
JobInputSubmit submit the pending input request
func (*Client) RemoveParameters ¶
RemoveParameters add parameters to a Pipeline
func (*Client) Search ¶
func (q *Client) Search(name, kind string, start, limit int) (items []JenkinsItem, err error)
Search find a set of jobs by name
func (*Client) SearchViaBlue
deprecated
func (q *Client) SearchViaBlue(name string, start, limit int) (items []JenkinsItem, err error)
SearchViaBlue searches jobs via the BlueOcean API
Deprecated: For clearer client of BlueOcean, please use BlueOceanClient#Search instead
func (*Client) UpdatePipeline ¶
UpdatePipeline updates the pipeline script
type CreateJobPayload ¶
type CreateJobPayload struct { Name string `json:"name"` Mode string `json:"mode"` From string `json:"from"` }
CreateJobPayload the payload for creating a job
type DefaultParameterValue ¶
type DefaultParameterValue struct { Description string Value interface{} }
DefaultParameterValue represents the default value for param
type IdentityBuild ¶
type IdentityBuild struct { Build Build Cause IdentityCause }
IdentityBuild is the build which carry the identity cause
type IdentityCause ¶
type IdentityCause struct { UUID string `json:"uuid"` ShortDescription string `json:"shortDescription"` Message string }
IdentityCause carray a identity cause
type InputItem ¶
type InputItem struct { ID string AbortURL string Message string ProceedText string ProceedURL string RedirectApprovalURL string Inputs []ParameterDefinition }
InputItem represents a job input action
type JenkinsInputParametersRequest ¶
type JenkinsInputParametersRequest struct {
Parameter []ParameterDefinition `json:"parameter"`
}
JenkinsInputParametersRequest represents the parameters for the Jenkins input request
type JenkinsItem ¶
type JenkinsItem struct { Name string DisplayName string URL string Description string Type string /** comes from Job */ Buildable bool Building bool InQueue bool /** comes from ParameterizedJob */ Parameterized bool Disabled bool /** comes from blueOcean */ FullName string WeatherScore int Parameters []ParameterDefinition }
JenkinsItem represents the item of Jenkins
type JenkinsStatus ¶
type JenkinsStatus struct { AssignedLabels []AgentLabel Description string Jobs []Job Mode string NodeDescription string NodeName string NumExecutors int PrimaryView View QuietingDown bool SlaveAgentPort int UseCrumbs bool UseSecurity bool Views []View Version string }
JenkinsStatus holds the status of Jenkins
type JenkinsStatusClient ¶
type JenkinsStatusClient struct {
core.JenkinsCore
}
JenkinsStatusClient use to connect with Jenkins status
func (*JenkinsStatusClient) Get ¶
func (q *JenkinsStatusClient) Get() (status *JenkinsStatus, err error)
Get returns status of Jenkins
type Job ¶
type Job struct { Type string `json:"_class"` Builds []Build Color string ConcurrentBuild bool Name string NextBuildNumber int URL string Buildable bool Property []ParametersDefinitionProperty }
Job represents a job
type ParameterDefinition ¶
type ParameterDefinition struct { Description string Name string `json:"name"` Type string Value string `json:"value"` Filepath string `json:"file"` DefaultParameterValue DefaultParameterValue }
ParameterDefinition holds the parameter definition
type ParametersDefinitionProperty ¶
type ParametersDefinitionProperty struct {
ParameterDefinitions []ParameterDefinition
}
ParametersDefinitionProperty holds the param definition property
type PipelineBuild ¶
type PipelineBuild struct { Actions []interface{} `json:"actions,omitempty" description:"the list of all actions"` ArtifactsZipFile interface{} `json:"artifactsZipFile,omitempty" description:"the artifacts zip file"` CauseOfBlockage string `json:"causeOfBlockage,omitempty" description:"the cause of blockage"` Causes []interface{} `json:"causes,omitempty"` ChangeSet []interface{} `json:"changeSet,omitempty" description:"changeset information"` Description interface{} `json:"description,omitempty" description:"description"` DurationInMillis interface{} `json:"durationInMillis,omitempty" description:"duration time in millis"` EnQueueTime Time `json:"enQueueTime,omitempty" description:"the time of enter the queue"` EndTime Time `json:"endTime,omitempty" description:"the time of end"` EstimatedDurationInMillis interface{} `json:"estimatedDurationInMillis,omitempty" description:"estimated duration time in millis"` ID string `json:"id,omitempty" description:"id"` Name interface{} `json:"name,omitempty" description:"name"` Organization string `json:"organization,omitempty" description:"the name of organization"` Pipeline string `json:"pipeline,omitempty" description:"pipeline"` Replayable bool `json:"replayable,omitempty" description:"replayable or not"` Result string `json:"result,omitempty" description:"the result of pipeline run. e.g. SUCCESS"` RunSummary interface{} `json:"runSummary,omitempty" description:"pipeline run summary"` StartTime Time `json:"startTime,omitempty" description:"the time of start"` State string `json:"state,omitempty" description:"run state. e.g. RUNNING"` Type string `json:"type,omitempty" description:"type"` QueueID string `json:"queueId,omitempty" description:"queue id"` }
PipelineBuild represents a build detail of Pipeline.
type SimpleJobBuild ¶
SimpleJobBuild represents a simple job build