jenkins

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package jenkins provides a Jenkins REST API client implementing the external.TestRunner interface. It supports triggering parameterized builds, polling build status, and retrieving build logs.

Jenkins API documentation: https://www.jenkins.io/doc/book/using/remote-access-api/

Authentication uses either:

  • Username + API token (recommended)
  • Username + password (legacy)

All API calls use exponential backoff retries for transient failures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a Jenkins REST API client implementing external.TestRunner.

func NewClient

func NewClient(config external.ProviderConfig) (*Client, error)

NewClient creates a new Jenkins client with the given configuration. The token should be a Jenkins API token, not a password. Returns an error if the configuration is invalid.

func (*Client) Cancel

func (c *Client) Cancel(ctx context.Context, runID string) error

Cancel attempts to stop a running Jenkins build. The runID is expected in the format "jobName:buildNumber" as returned by TriggerTest.

func (*Client) GetLogs

func (c *Client) GetLogs(ctx context.Context, runID string) (string, error)

GetLogs retrieves the console output for a Jenkins build. The runID is expected in the format "jobName:buildNumber" as returned by TriggerTest.

func (*Client) GetStatus

func (c *Client) GetStatus(ctx context.Context, runID string) (external.TestStatus, error)

GetStatus polls the status of a Jenkins build. The runID is expected in the format "jobName:buildNumber" as returned by TriggerTest. Returns the current build status as a TestStatus.

func (*Client) TriggerTest

func (c *Client) TriggerTest(ctx context.Context, config external.TestConfig) (*external.TestRun, error)

TriggerTest triggers a Jenkins build with the given configuration. The JobName should be in the format "folder/job-name" for jobs in folders. Parameters are passed as build parameters. Returns a TestRun with the build number and metadata. The runID is encoded as "jobName:buildNumber" to include both pieces of information.

Jump to

Keyboard shortcuts

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