Help us shape the future of Go! Take the 2026 Go Developer Survey

jenkins

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 18 Imported by: 85

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTempFile added in v1.5.2

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 added in v1.5.2

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

func ProcessLogURLAnnotations added in v1.5.2

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

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 added in v1.5.2

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 added in v1.5.2

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 added in v1.5.2

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