 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- type Build
- type BuildInfo
- type BuildTrigger
- type Builder
- type ChangeSet
- type Client
- type Credential
- type Definition
- type Engine
- func (j Engine) GetStepLog(execution *v3.PipelineExecution, stage int, step int) (string, error)
- func (j *Engine) PreCheck() error
- func (j *Engine) RerunExecution(execution *v3.PipelineExecution) error
- func (j *Engine) RunPipelineExecution(execution *v3.PipelineExecution, triggerType string) error
- func (j *Engine) StopExecution(execution *v3.PipelineExecution) error
- func (j *Engine) SyncExecution(execution *v3.PipelineExecution) (bool, error)
 
- type FlowNode
- type GroovyScript
- type JobInfo
- type NodeError
- type PipelineJob
- type PostBuildTask
- type PreSCMBuildStepsWrapper
- type Project
- type Scm
- type Stage
- type TaskShell
- type TimeoutStrategy
- type TimeoutWrapperPlugin
- type TimestampWrapperPlugin
- type Trigger
- type WFBuildInfo
- type WFNodeInfo
- type WFNodeLog
Constants ¶
      View Source
      
  
    const ( CreateJobURI = "/createItem" UpdateJobURI = "/job/%s/config.xml" StopJobURI = "/job/%s/%d/stop" CancelQueueItemURI = "/queue/cancelItem?id=%d" DeleteBuildURI = "/job/%s/%d/doDelete" GetCrumbURI = "/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\",//crumb)" JenkinsJobBuildURI = "/job/%s/build" JenkinsJobInfoURI = "/job/%s/api/json" JenkinsSetCredURI = "/credentials/store/system/domain/_/createCredentials" JenkinsGetCredURI = "/credentials/store/system/domain/_/credential/%s/api/json" JenkinsDeleteCredURI = "/credentials/store/system/domain/_/credential/%s/doDelete" JenkinsBuildInfoURI = "/job/%s/lastBuild/api/json" JenkinsWFBuildInfoURI = "/job/%s/lastBuild/wfapi" JenkinsWFNodeInfoURI = "/job/%s/lastBuild/execution/node/%s/wfapi" JenkinsWFNodeLogURI = "/job/%s/lastBuild/execution/node/%s/wfapi/log" JenkinsBuildLogURI = "/job/%s/%d/timestamps/?elapsed=HH'h'mm'm'ss's'S'ms'&appendLog" ScriptURI = "/scriptText" PrepareWFNodeID = "5" )
      View Source
      
  
const ( GitScmClass = "hudson.plugins.git.GitSCM" GitScmPlugin = "git@3.3.1" ScmConfigVersion = 2 WorkflowJobPlugin = "workflow-job@2.17" FlowDefinitionClass = "org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" FlowDefinitionPlugin = "workflow-cps@2.43" JenkinsJobPrefix = "Rancher_Pipeline_" )
Variables ¶
      View Source
      
  
    var (
	ErrNotFound = errors.New("Not Found")
)
    
      View Source
      
  
    var JenkinsDefaultToken = "admin"
    
      View Source
      
  
var JenkinsDefaultUser = "admin"
    Functions ¶
This section is empty.
Types ¶
type Build ¶
type Build struct {
	ID                string    `json:"id,omitempty"`
	KeepLog           bool      `json:"keepLog,omitempty"`
	Number            int       `json:"number,omitempty"`
	QueueID           int       `json:"queueId,omitempty"`
	Result            string    `json:"result,omitempty"`
	TimeStamp         int64     `json:"timestamp,omitempty"`
	BuiltOn           string    `json:"builtOn,omitempty"`
	ChangeSet         ChangeSet `json:"chanSet,omitempty"`
	Duration          int       `json:"duration,omitempty"`
	EstimatedDuration int       `json:"estimatedDuration,omitempty"`
	Building          bool      `json:"building,omitempty"`
}
    type BuildInfo ¶
type BuildInfo struct {
	Class   string `json:"_class"`
	Actions []struct {
		Class              string `json:"_class"`
		BuildsByBranchName struct {
			OriginMaster struct {
				Class       string      `json:"_class"`
				BuildNumber int64       `json:"buildNumber"`
				BuildResult interface{} `json:"buildResult"`
				Marked      struct {
					SHA1   string `json:"SHA1"`
					Branch []struct {
						SHA1 string `json:"SHA1"`
						Name string `json:"name"`
					} `json:"branch"`
				} `json:"marked"`
				Revision struct {
					SHA1   string `json:"SHA1"`
					Branch []struct {
						SHA1 string `json:"SHA1"`
						Name string `json:"name"`
					} `json:"branch"`
				} `json:"revision"`
			} `json:"origin/master"`
		} `json:"buildsByBranchName"`
		Causes []struct {
			Class            string `json:"_class"`
			ShortDescription string `json:"shortDescription"`
			UserID           string `json:"userId"`
			UserName         string `json:"userName"`
		} `json:"causes"`
		LastBuiltRevision struct {
			SHA1   string `json:"SHA1"`
			Branch []struct {
				SHA1 string `json:"SHA1"`
				Name string `json:"name"`
			} `json:"branch"`
		} `json:"lastBuiltRevision"`
		RemoteUrls []string `json:"remoteUrls"`
		ScmName    string   `json:"scmName"`
	} `json:"actions"`
	Artifacts []interface{} `json:"artifacts"`
	Building  bool          `json:"building"`
	BuiltOn   string        `json:"builtOn"`
	ChangeSet struct {
		Class string        `json:"_class"`
		Items []interface{} `json:"items"`
		Kind  string        `json:"kind"`
	} `json:"changeSet"`
	Description       interface{} `json:"description"`
	DisplayName       string      `json:"displayName"`
	Duration          int64       `json:"duration"`
	EstimatedDuration int64       `json:"estimatedDuration"`
	Executor          interface{} `json:"executor"`
	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"`
}
    type BuildTrigger ¶
type BuildTrigger struct {
	Spec                     string `xml:"spec"`
	Plugin                   string `xml:"plugin,attr"`
	UpstreamProjects         string `xml:"upstreamProjects"`
	UpsteamProjects          string `xml:"upsteamProjects"`
	WatchUpstreamRecursively bool   `xml:"watchUpstreamRecursively"`
	ThresholdName            string `xml:"threshold>name"`
	ThresholdOrdinal         int    `xml:"threshold>ordinal"`
	ThresholdColor           string `xml:"threshold>color"`
	ThresholdCompleteBuild   bool   `xml:"threshold>completeBuild"`
}
    type Client ¶
type Credential ¶
type Definition ¶
type Engine ¶
type Engine struct {
	Client *Client
	ServiceLister v1.ServiceLister
	Secrets                    v1.SecretInterface
	SecretLister               v1.SecretLister
	ManagementSecretLister     v1.SecretLister
	SourceCodeCredentialLister v3.SourceCodeCredentialLister
	ClusterName string
	Dialer      dialer.Factory
}
    func (Engine) GetStepLog ¶
func (*Engine) RerunExecution ¶
func (j *Engine) RerunExecution(execution *v3.PipelineExecution) error
func (*Engine) RunPipelineExecution ¶
func (j *Engine) RunPipelineExecution(execution *v3.PipelineExecution, triggerType string) error
func (*Engine) StopExecution ¶
func (j *Engine) StopExecution(execution *v3.PipelineExecution) error
func (*Engine) SyncExecution ¶
func (j *Engine) SyncExecution(execution *v3.PipelineExecution) (bool, error)
type FlowNode ¶
type FlowNode struct {
	ID                   string    `json:"id"`
	Name                 string    `json:"name"`
	ExecNode             string    `json:"execNode"`
	Status               string    `json:"status"`
	ParameterDescription string    `json:"parameterDescription"`
	StartTimeMillis      int64     `json:"startTimeMillis"`
	DurationMillis       int64     `json:"durationMillis"`
	PauseDurationMillis  int64     `json:"pauseDurationMillis"`
	Error                NodeError `json:"error"`
}
    type GroovyScript ¶
type JobInfo ¶
type JobInfo struct {
	Class   string `json:"_class"`
	Actions []struct {
		Class string `json:"_class"`
	} `json:"actions"`
	Buildable bool `json:"buildable"`
	Builds    []struct {
		Class  string `json:"_class"`
		Number int64  `json:"number"`
		URL    string `json:"url"`
	} `json:"builds"`
	Color              string      `json:"color"`
	ConcurrentBuild    bool        `json:"concurrentBuild"`
	Description        string      `json:"description"`
	DisplayName        string      `json:"displayName"`
	DisplayNameOrNull  interface{} `json:"displayNameOrNull"`
	DownstreamProjects []struct {
		Class string `json:"_class"`
		Color string `json:"color"`
		Name  string `json:"name"`
		URL   string `json:"url"`
	} `json:"downstreamProjects"`
	FirstBuild struct {
		Class  string `json:"_class"`
		Number int64  `json:"number"`
		URL    string `json:"url"`
	} `json:"firstBuild"`
	FullDisplayName string `json:"fullDisplayName"`
	FullName        string `json:"fullName"`
	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        struct {
		Class  string `json:"_class"`
		Number int64  `json:"number"`
		URL    string `json:"url"`
	} `json:"lastBuild"`
	LastCompletedBuild struct {
		Class  string `json:"_class"`
		Number int64  `json:"number"`
		URL    string `json:"url"`
	} `json:"lastCompletedBuild"`
	LastFailedBuild struct {
		Class  string `json:"_class"`
		Number int64  `json:"number"`
		URL    string `json:"url"`
	} `json:"lastFailedBuild"`
	LastStableBuild       interface{} `json:"lastStableBuild"`
	LastSuccessfulBuild   interface{} `json:"lastSuccessfulBuild"`
	LastUnstableBuild     interface{} `json:"lastUnstableBuild"`
	LastUnsuccessfulBuild struct {
		Class  string `json:"_class"`
		Number int64  `json:"number"`
		URL    string `json:"url"`
	} `json:"lastUnsuccessfulBuild"`
	Name            string        `json:"name"`
	NextBuildNumber int64         `json:"nextBuildNumber"`
	Property        []interface{} `json:"property"`
	QueueItem       interface{}   `json:"queueItem"`
	Scm             struct {
		Class string `json:"_class"`
	} `json:"scm"`
	UpstreamProjects []interface{} `json:"upstreamProjects"`
	URL              string        `json:"url"`
}
    type PipelineJob ¶
type PipelineJob struct {
	XMLName    xml.Name   `xml:"flow-definition"`
	Plugin     string     `xml:"plugin,attr"`
	Definition Definition `xml:"definition"`
}
    func ConvertPipelineExecutionToJenkinsPipeline ¶
func ConvertPipelineExecutionToJenkinsPipeline(execution *v3.PipelineExecution) (PipelineJob, error)
type PostBuildTask ¶
type PostBuildTask struct {
	Plugin             string       `xml:"plugin,attr"`
	GroovyScript       GroovyScript `xml:"script"`
	Behavior           int          `xml:"behavior"`
	RunForMatrixParent bool         `xml:"runForMatrixParent"`
}
    type PreSCMBuildStepsWrapper ¶
type Project ¶
type Project struct {
	XMLName                          xml.Name `xml:"project"`
	Actions                          string   `xml:"actions"`
	Description                      string   `xml:"description"`
	KeepDependencies                 bool     `xml:"keepDependencies"`
	Properties                       string
	Scm                              Scm                     `xml:"scm"`
	AssignedNode                     string                  `xml:"assignedNode"`
	CanRoam                          bool                    `xml:"canRoam"`
	Disabled                         bool                    `xml:"disabled"`
	BlockBuildWhenDownstreamBuilding bool                    `xml:"blockBuildWhenDownstreamBuilding"`
	BlockBuildWhenUpstreamBuilding   bool                    `xml:"blockBuildWhenUpstreamBuilding"`
	Triggers                         Trigger                 `xml:"triggers"`
	ConcurrentBuild                  bool                    `xml:"concurrentBuild"`
	CustomWorkspace                  string                  `xml:"customWorkspace"`
	Builders                         Builder                 `xml:"builders,omitempty"`
	Publishers                       PostBuildTask           `xml:"publishers>org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder"`
	TimeStampWrapper                 TimestampWrapperPlugin  `xml:"buildWrappers>hudson.plugins.timestamper.TimestamperBuildWrapper"`
	TimeoutWrapper                   *TimeoutWrapperPlugin   `xml:"buildWrappers>hudson.plugins.build__timeout.BuildTimeoutWrapper"`
	PreSCMBuildStepsWrapper          PreSCMBuildStepsWrapper `xml:"buildWrappers>org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper"`
}
    type Scm ¶
type Scm struct {
	Class                             string `xml:"class,attr"`
	Plugin                            string `xml:"plugin,attr"`
	ConfigVersion                     int    `xml:"configVersion"`
	GitRepo                           string `xml:"userRemoteConfigs>hudson.plugins.git.UserRemoteConfig>url"`
	GitCredentialID                   string `xml:"userRemoteConfigs>hudson.plugins.git.UserRemoteConfig>credentialsId"`
	GitBranch                         string `xml:"branches>hudson.plugins.git.BranchSpec>name"`
	DoGenerateSubmoduleConfigurations bool   `xml:"doGenerateSubmoduleConfigurations"`
	SubmodelCfg                       string `xml:"submoduleCfg,omitempty"`
	Extensions                        string `xml:"extensions"`
}
    type TimeoutStrategy ¶
type TimeoutWrapperPlugin ¶
type TimeoutWrapperPlugin struct {
	Plugin    string          `xml:"plugin,attr"`
	Strategy  TimeoutStrategy `xml:"strategy"`
	Operation string          `xml:"operationList>hudson.plugins.build__timeout.operations.FailOperation"`
}
    type TimestampWrapperPlugin ¶
type TimestampWrapperPlugin struct {
	Plugin string `xml:"plugin,attr"`
}
    type Trigger ¶
type Trigger struct {
	BuildTrigger             *BuildTrigger `xml:"jenkins.triggers.ReverseBuildTrigger,omitempty"`
	FanInReverseBuildTrigger *BuildTrigger `xml:"org.lonkar.jobfanin.FanInReverseBuildTrigger,omitempty"`
}
    type WFBuildInfo ¶
type WFBuildInfo struct {
	ID                  string  `json:"id"`
	Name                string  `json:"name"`
	Status              string  `json:"status"`
	StartTimeMillis     int64   `json:"startTimeMillis"`
	EndTimeMillis       int64   `json:"endTimeMillis"`
	DurationMillis      int64   `json:"durationMillis"`
	QueueDurationMillis int64   `json:"queueDurationMillis"`
	PauseDurationMillis int64   `json:"pauseDurationMillis"`
	Stages              []Stage `json:"stages"`
}
    type WFNodeInfo ¶
type WFNodeInfo struct {
	ID                  string  `json:"id"`
	Name                string  `json:"name"`
	Status              string  `json:"status"`
	StartTimeMillis     int64   `json:"startTimeMillis"`
	EndTimeMillis       int64   `json:"endTimeMillis"`
	DurationMillis      int64   `json:"durationMillis"`
	ParseDurationMillis int64   `json:"parseDurationMillis"`
	PauseDurationMillis int64   `json:"pauseDurationMillis"`
	StageFlowNodes      []Stage `json:"stageFlowNodes"`
}
     Click to show internal directories. 
   Click to hide internal directories.