jenkins

package
v4.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 1, 2019 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 CreateTempFile

func CreateTempFile(data string) (string, error)

CreateTempFile stores the specified data in a temp dir/temp file for the test who calls it

func DumpLogs

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

func FindJenkinsPod

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

Finds the pod running Jenkins

func OverridePodTemplateImages

func OverridePodTemplateImages(newAppArgs []string) []string

OverridePodTemplateImages sees if this is a prow-gcp e2e test invocation, and we want to override the agent image for the default pod templates; the jenkins image will pick up the env vars passed to new-app and update the image field of the pod templates with the values

func ProcessLogURLAnnotations

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

func SetupDockerhubImage

func SetupDockerhubImage(localImageName, snapshotImageStream string, newAppArgs []string, oc *exutil.CLI) []string

SetupDockerhubImage pull in a jenkins image from docker.io for aws-build testing; at some point during 4.0 dev, the jenkins imagestream in the openshift namespace will leverage the rhel images from the terms based registry at registry.redhat.io where credentials will be needed; we want to test against pre-release images

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(reqBodyFile, 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(reqBodyFile, 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) ProcessJenkinsJob

func (j *JenkinsRef) ProcessJenkinsJob(filename, namespace string) string

ProcessJenkinsJob returns the path of the modified Jenkins job XML file. Instances of the string "PROJECT_NAME" are replaced with the specified namespace.

func (*JenkinsRef) ProcessJenkinsJobUsingVars

func (j *JenkinsRef) ProcessJenkinsJobUsingVars(filename, namespace string, vars map[string]string) string

ProcessJenkinsJobUsingVars returns the path of the modified 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