Documentation ¶
Index ¶
- Constants
- func DumpLogs(oc *exutil.CLI, t *exutil.BuildResult) (string, error)
- func FindJenkinsPod(oc *exutil.CLI) *kapiv1.Pod
- func ProcessLogURLAnnotations(oc *exutil.CLI, t *exutil.BuildResult) (*url.URL, error)
- func SetupSnapshotImage(envVarName, localImageName, snapshotImageStream string, newAppArgs []string, ...) ([]string, bool)
- func StartJenkinsGCTracking(oc *exutil.CLI, jenkinsNamespace string) *time.Ticker
- func StartJenkinsMemoryTracking(oc *exutil.CLI, jenkinsNamespace string) *time.Ticker
- type Definition
- type FlowDefinition
- type JenkinsRef
- func (j *JenkinsRef) BuildDSLJob(namespace string, scriptLines ...string) (string, error)
- func (j *JenkinsRef) BuildURI(resourcePathFormat string, a ...interface{}) string
- func (j *JenkinsRef) CreateItem(name string, itemDefXML string)
- func (j *JenkinsRef) GetJobBuildNumber(name string, timeout time.Duration) (string, error)
- func (j *JenkinsRef) GetJobConsoleLogs(jobName, buildNumber string) (string, error)
- func (j *JenkinsRef) GetJobConsoleLogsAndMatchViaBuildResult(br *exutil.BuildResult, match string) (string, error)
- func (j *JenkinsRef) GetLastJobConsoleLogs(jobName string) (string, error)
- func (j *JenkinsRef) GetResource(resourcePathFormat string, a ...interface{}) (string, int, error)
- func (j *JenkinsRef) GetResourceWithStatus(validStatusList []int, timeout time.Duration, resourcePathFormat string, ...) (string, int, error)
- func (j *JenkinsRef) Namespace() string
- func (j *JenkinsRef) Post(reqBody io.Reader, resourcePathFormat, contentType string, a ...interface{}) (string, int, error)
- func (j *JenkinsRef) PostXML(reqBody io.Reader, resourcePathFormat string, a ...interface{}) (string, int, error)
- func (j *JenkinsRef) ReadJenkinsJob(filename, namespace string) string
- func (j *JenkinsRef) ReadJenkinsJobUsingVars(filename, namespace string, vars map[string]string) string
- func (j *JenkinsRef) StartJob(jobName string) *JobMon
- func (j *JenkinsRef) WaitForContent(verificationRegEx string, verificationStatus int, timeout time.Duration, ...) (string, error)
- type JobMon
Constants ¶
const ( EnableJenkinsMemoryStats = "ENABLE_JENKINS_MEMORY_MONITORING" EnableJenkinsGCStats = "ENABLE_JENKINS_GC_MONITORING" )
const ( UseLocalPluginSnapshotEnvVarName = "USE_SNAPSHOT_JENKINS_IMAGE" UseLocalClientPluginSnapshotEnvVarName = "USE_SNAPSHOT_JENKINS_CLIENT_IMAGE" UseLocalSyncPluginSnapshotEnvVarName = "USE_SNAPSHOT_JENKINS_SYNC_IMAGE" UseLocalLoginPluginSnapshotEnvVarName = "USE_SNAPSHOT_JENKINS_LOGIN_IMAGE" )
Variables ¶
This section is empty.
Functions ¶
func SetupSnapshotImage ¶
func SetupSnapshotImage(envVarName, localImageName, snapshotImageStream string, newAppArgs []string, oc *exutil.CLI) ([]string, bool)
pulls in a jenkins image built from a PR change for one of our plugins
func StartJenkinsGCTracking ¶
Types ¶
type Definition ¶
type Definition struct { XMLName xml.Name `xml:"definition"` Class string `xml:"class,attr"` Plugin string `xml:"plugin,attr"` Script string `xml:"script"` }
Definition is part of a FlowDefinition
type FlowDefinition ¶
type FlowDefinition struct { XMLName xml.Name `xml:"flow-definition"` Plugin string `xml:"plugin,attr"` KeepDependencies bool `xml:"keepDependencies"` Definition Definition }
FlowDefinition can be marshalled into XML to represent a Jenkins workflow job definition.
type JenkinsRef ¶
type JenkinsRef struct {
// contains filtered or unexported fields
}
JenkinsRef represents a Jenkins instance running on an OpenShift server
func NewRef ¶
func NewRef(oc *exutil.CLI) *JenkinsRef
NewRef creates a jenkins reference from an OC client
func (*JenkinsRef) BuildDSLJob ¶
func (j *JenkinsRef) BuildDSLJob(namespace string, scriptLines ...string) (string, error)
BuildDSLJob returns an XML string defining a Jenkins workflow/pipeline DSL job. Instances of the string "PROJECT_NAME" are replaced with the specified namespace.
func (*JenkinsRef) BuildURI ¶
func (j *JenkinsRef) BuildURI(resourcePathFormat string, a ...interface{}) string
BuildURI builds a URI for the Jenkins server.
func (*JenkinsRef) CreateItem ¶
func (j *JenkinsRef) CreateItem(name string, itemDefXML string)
CreateItem submits XML to create a named item on the Jenkins server.
func (*JenkinsRef) GetJobBuildNumber ¶
GetJobBuildNumber returns the current buildNumber on the named project OR "new" if there are no builds against a job yet.
func (*JenkinsRef) GetJobConsoleLogs ¶
func (j *JenkinsRef) GetJobConsoleLogs(jobName, buildNumber string) (string, error)
GetJobConsoleLogs returns the console logs of a particular buildNumber.
func (*JenkinsRef) GetJobConsoleLogsAndMatchViaBuildResult ¶
func (j *JenkinsRef) GetJobConsoleLogsAndMatchViaBuildResult(br *exutil.BuildResult, match string) (string, error)
GetJobConsoleLogsAndMatchViaBuildResult leverages various information in the BuildResult and returns the corresponding console logs, as well as look for matching string
func (*JenkinsRef) GetLastJobConsoleLogs ¶
func (j *JenkinsRef) GetLastJobConsoleLogs(jobName string) (string, error)
GetLastJobConsoleLogs returns the last build associated with a Jenkins job.
func (*JenkinsRef) GetResource ¶
func (j *JenkinsRef) GetResource(resourcePathFormat string, a ...interface{}) (string, int, error)
GetResource submits a GET request to this Jenkins server. Returns a response body and status code or an error.
func (*JenkinsRef) GetResourceWithStatus ¶
func (j *JenkinsRef) GetResourceWithStatus(validStatusList []int, timeout time.Duration, resourcePathFormat string, a ...interface{}) (string, int, error)
GetResourceWithStatus repeatedly tries to GET a jenkins resource with an acceptable HTTP status. Retries for the specified duration.
func (*JenkinsRef) Namespace ¶
func (j *JenkinsRef) Namespace() string
Namespace returns the Jenkins namespace
func (*JenkinsRef) Post ¶
func (j *JenkinsRef) Post(reqBody io.Reader, resourcePathFormat, contentType string, a ...interface{}) (string, int, error)
Post sends a POST to the Jenkins server. Returns response body and status code or an error.
func (*JenkinsRef) PostXML ¶
func (j *JenkinsRef) PostXML(reqBody io.Reader, resourcePathFormat string, a ...interface{}) (string, int, error)
PostXML sends a POST to the Jenkins server. If a body is specified, it should be XML. Returns response body and status code or an error.
func (*JenkinsRef) ReadJenkinsJob ¶
func (j *JenkinsRef) ReadJenkinsJob(filename, namespace string) string
ReadJenkinsJob returns the content of a Jenkins job XML file. Instances of the string "PROJECT_NAME" are replaced with the specified namespace.
func (*JenkinsRef) ReadJenkinsJobUsingVars ¶
func (j *JenkinsRef) ReadJenkinsJobUsingVars(filename, namespace string, vars map[string]string) string
ReadJenkinsJobUsingVars returns the content of a Jenkins job XML file. Instances of the string "PROJECT_NAME" are replaced with the specified namespace. Variables named in the vars map will also be replaced with their corresponding value.
func (*JenkinsRef) StartJob ¶
func (j *JenkinsRef) StartJob(jobName string) *JobMon
StartJob triggers a named Jenkins job. The job can be monitored with the returned object.
func (*JenkinsRef) WaitForContent ¶
func (j *JenkinsRef) WaitForContent(verificationRegEx string, verificationStatus int, timeout time.Duration, resourcePathFormat string, a ...interface{}) (string, error)
WaitForContent waits for a particular HTTP status and HTML matching a particular pattern to be returned by this Jenkins server. An error will be returned if the condition is not matched within the timeout period.