Documentation
¶
Index ¶
- Constants
- Variables
- func FindJenkinsServers(f *ClientFactory, jenkinsSelector *JenkinsSelectorOptions) (map[string]*JenkinsServer, []string, error)
- func PopulateAuth(secret *v1.Secret) *gojenkins.Auth
- type ClientFactory
- type JenkinsOptions
- func (o *JenkinsOptions) AddJenkinsJobs(jenkins gojenkins.JenkinsClient, jobMap *map[string]gojenkins.Job, ...)
- func (o *JenkinsOptions) CreateJenkinsClientFromSelector(jenkinsSelector *JenkinsSelectorOptions) (gojenkins.JenkinsClient, error)
- func (o *JenkinsOptions) FindGitInfo(dir string) (*gits.GitRepository, error)
- func (o *JenkinsOptions) GetAllPipelineJobNames(jenkinsClient gojenkins.JenkinsClient, jobNames *[]string, jobName string) error
- func (o *JenkinsOptions) GetBranchName(dir string) string
- func (o *JenkinsOptions) GetIOFileHandles() util.IOFileHandles
- func (o *JenkinsOptions) GetJenkinsJobName() string
- func (o *JenkinsOptions) GetJenkinsJobs(jenkinsSelector *JenkinsSelectorOptions, filter string) (map[string]gojenkins.Job, error)
- func (o *JenkinsOptions) Git() gits.Gitter
- func (o *JenkinsOptions) PickCustomJenkinsName(jenkinsSelector *JenkinsSelectorOptions, failIfNone bool) (string, *JenkinsServer, error)
- func (o *JenkinsOptions) SetGit(git gits.Gitter)
- func (o *JenkinsOptions) TailJenkinsBuildLog(jenkinsSelector *JenkinsSelectorOptions, jobName string, ...) error
- type JenkinsSelectorOptions
- type JenkinsServer
Constants ¶
const (
// TriggerJenkinsServerEnv the environment variable used to choose the jenkins server to trigger
TriggerJenkinsServerEnv = "TRIGGER_JENKINS_SERVER"
// JenkinsSelector the default selector to find Jenkins services as Kubernetes Services
JenkinsSelector = "app=jenkins-operator"
// JenkinsNameLabel default label to indicate the name of the Jenkins service
JenkinsNameLabel = "jenkins-cr"
)
Variables ¶
var (
// DefaultJenkinsSelector default selector options to use if finding Jenkins services
DefaultJenkinsSelector = JenkinsSelectorOptions{
Selector: JenkinsSelector,
NameLabel: JenkinsNameLabel,
}
)
Functions ¶
func FindJenkinsServers ¶
func FindJenkinsServers(f *ClientFactory, jenkinsSelector *JenkinsSelectorOptions) (map[string]*JenkinsServer, []string, error)
FindJenkinsServers discovers the jenkins services
func PopulateAuth ¶
func PopulateAuth(secret *v1.Secret) *gojenkins.Auth
PopulateAuth populates the gojenkins Auth
Types ¶
type ClientFactory ¶
type ClientFactory struct {
KubeClient kubernetes.Interface
Namespace string
Batch bool
InCluster bool
DevelopmentJenkinsURL string
}
func (*ClientFactory) CreateJenkinsClient ¶
func (f *ClientFactory) CreateJenkinsClient(jenkinsName string) (gojenkins.JenkinsClient, error)
CreateJenkinsClient creates a new Jenkins client for the given custom Jenkins App
func (*ClientFactory) JenkinsURL ¶
func (f *ClientFactory) JenkinsURL(jenkinsServiceName string) (string, error)
JenkinsURL gets a given jenkins service's URL
type JenkinsOptions ¶
type JenkinsOptions struct {
ClientFactory *ClientFactory
BatchMode bool
IOFileHandles *util.IOFileHandles
// contains filtered or unexported fields
}
func (*JenkinsOptions) AddJenkinsJobs ¶
func (o *JenkinsOptions) AddJenkinsJobs(jenkins gojenkins.JenkinsClient, jobMap *map[string]gojenkins.Job, filter string, prefix string, jobs []gojenkins.Job)
AddJenkinsJobs add the given jobs to Jenkins
func (*JenkinsOptions) CreateJenkinsClientFromSelector ¶
func (o *JenkinsOptions) CreateJenkinsClientFromSelector(jenkinsSelector *JenkinsSelectorOptions) (gojenkins.JenkinsClient, error)
CreateJenkinsClientFromSelector is given either a specific jenkins service name to use, uses the selector to find it or prompts the user to pick one if not in batch mode.
func (*JenkinsOptions) FindGitInfo ¶
func (o *JenkinsOptions) FindGitInfo(dir string) (*gits.GitRepository, error)
FindGitInfo parses the git information from the given directory
func (*JenkinsOptions) GetAllPipelineJobNames ¶
func (o *JenkinsOptions) GetAllPipelineJobNames(jenkinsClient gojenkins.JenkinsClient, jobNames *[]string, jobName string) error
GetAllPipelineJobNames returns all the pipeline job names
func (*JenkinsOptions) GetBranchName ¶
func (o *JenkinsOptions) GetBranchName(dir string) string
func (*JenkinsOptions) GetIOFileHandles ¶
func (o *JenkinsOptions) GetIOFileHandles() util.IOFileHandles
GetIOFileHandles returns In, Out, and Err as an IOFileHandles struct
func (*JenkinsOptions) GetJenkinsJobName ¶
func (o *JenkinsOptions) GetJenkinsJobName() string
GetJenkinsJobName returns the Jenkins job name
func (*JenkinsOptions) GetJenkinsJobs ¶
func (o *JenkinsOptions) GetJenkinsJobs(jenkinsSelector *JenkinsSelectorOptions, filter string) (map[string]gojenkins.Job, error)
GetJenkinsJobs returns the existing Jenkins jobs
func (*JenkinsOptions) PickCustomJenkinsName ¶
func (o *JenkinsOptions) PickCustomJenkinsName(jenkinsSelector *JenkinsSelectorOptions, failIfNone bool) (string, *JenkinsServer, error)
PickCustomJenkinsName picks the name of a custom jenkins server App if available
func (*JenkinsOptions) SetGit ¶
func (o *JenkinsOptions) SetGit(git gits.Gitter)
SetGit sets the git client
func (*JenkinsOptions) TailJenkinsBuildLog ¶
func (o *JenkinsOptions) TailJenkinsBuildLog(jenkinsSelector *JenkinsSelectorOptions, jobName string, build *gojenkins.Build) error
TailJenkinsBuildLog tail the build log of the given Jenkins jobs name
type JenkinsSelectorOptions ¶
type JenkinsSelectorOptions struct {
// JenkinsName the name of the Jenkins Operator Service for HTTP to use
JenkinsName string
// Selector label selector to find the Jenkins Operator Services
Selector string
// NameLabel label the label to find the name of the Jenkins service
NameLabel string
// DevelopmentJenkinsURL a local URL to use to talk to the jenkins server if the servers do not have Ingress
// and you want to test out using the jenkins client locally
DevelopmentJenkinsURL string
}
JenkinsSelectorOptions used to represent the options used to refer to a Jenkins. if nothing is specified it assumes the current team is using a static Jenkins server as its execution engine. otherwise we can refer to other additional Jenkins Apps to implement custom Jenkins servers
type JenkinsServer ¶
type JenkinsServer struct {
// Name the name of the Jenkins server in the registry. Should be a valid kubernetes name
Name string
// URL the URL to connect to the Jenkins server
URL string
// SecretName the name of the Secret in the registry
SecretName string
// Auth the username and token used to access the Jenkins server
Auth gojenkins.Auth
}
JenkinsServer represents a jenkins server discovered via Service selectors or via the trigger-pipeline secrets
func (*JenkinsServer) CreateClient ¶
func (j *JenkinsServer) CreateClient() (gojenkins.JenkinsClient, error)
CreateClient creates a Jenkins client for a jenkins service