jenkins

package
v3.9.0-alpha.3+incompa... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnableJenkinsMemoryStats = "ENABLE_JENKINS_MEMORY_MONITORING"
	EnableJenkinsGCStats     = "ENABLE_JENKINS_GC_MONITORING"
)
View Source
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 DumpLogs

func DumpLogs(oc *exutil.CLI, t *exutil.BuildResult) (string, error)

func FindJenkinsPod

func FindJenkinsPod(oc *exutil.CLI) *kapiv1.Pod

Finds the pod running Jenkins

func ProcessLogURLAnnotations

func ProcessLogURLAnnotations(oc *exutil.CLI, t *exutil.BuildResult) (*url.URL, error)

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

func StartJenkinsGCTracking(oc *exutil.CLI, jenkinsNamespace string) *time.Ticker

func StartJenkinsMemoryTracking

func StartJenkinsMemoryTracking(oc *exutil.CLI, jenkinsNamespace string) *time.Ticker

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

func (j *JenkinsRef) GetJobBuildNumber(name string, timeout time.Duration) (string, error)

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.

type JobMon

type JobMon struct {
	// contains filtered or unexported fields
}

JobMon is a Jenkins job monitor

func (*JobMon) Await

func (jmon *JobMon) Await(timeout time.Duration) error

Await waits for the timestamp on the Jenkins job to change. Returns and error if the timeout expires.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL