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 ¶
- type Client
- func (c *Client) Cancel(ctx context.Context, runID string) error
- func (c *Client) GetLogs(ctx context.Context, runID string) (string, error)
- func (c *Client) GetStatus(ctx context.Context, runID string) (external.TestStatus, error)
- func (c *Client) TriggerTest(ctx context.Context, config external.TestConfig) (*external.TestRun, error)
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 ¶
Cancel attempts to stop a running Jenkins build. The runID is expected in the format "jobName:buildNumber" as returned by TriggerTest.
func (*Client) GetLogs ¶
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 ¶
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.