jenkins

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildScheduled = errors.New("build scheduled, build not available yet")

Functions

This section is empty.

Types

type Build added in v0.3.0

type Build struct {
	JobName string
	Number  int64
	// contains filtered or unexported fields
}

func ParseBuildURL added in v0.3.0

func ParseBuildURL(buildURL string) (*Build, error)

func (*Build) String added in v0.3.0

func (b *Build) String() string

type Client

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

Client is a HTTP API client for a Jenkins Server.

func NewClient

func NewClient(logger *zap.Logger, serverURL, user, password string) (*Client, error)

func (*Client) Build

func (s *Client) Build(ctx context.Context, j *Job) (int64, error)

Build schedules a build of the job. On success it returns the ID of the queued build item and nil. On errors where retrying might lead to positive result a goorderr.RetryableError is returned.

func (*Client) Do added in v0.3.0

func (s *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) GetBuildFromQueueItemID added in v0.3.0

func (s *Client) GetBuildFromQueueItemID(ctx context.Context, queueItemID int64) (*Build, error)

GetBuildFromQueueItemID does the same than [s.GetBuildURL] but returns a Build instead of the URL as string.

func (*Client) GetBuildURL added in v0.3.0

func (s *Client) GetBuildURL(ctx context.Context, queueItemID int64) (string, error)

On errors where retrying might lead to positive result a goorderr.RetryableError is returned. This includes the case when a queued item exist but no build number has been assigned yet. A goorderr.RetryableError wrapping ErrBuildScheduled is returned.

The queued item URL expires 5 minutes after the item got a build number assigned and jenkins will responds with a 404 status code. The method will return an error.

func (*Client) String

func (s *Client) String() string

type Job

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

func (*Job) String

func (j *Job) String() string

type JobTemplate

type JobTemplate struct {
	RelURL     string
	Parameters map[string]string
}

JobTemplate is a Job definition that can contain Go-Template statements.

func (*JobTemplate) Template

func (j *JobTemplate) Template(data TemplateData) (*Job, error)

Template creates a concrete Job from j by templating it with [templateData] and [templateFuncs.

type TemplateData

type TemplateData struct {
	PullRequestNumber string
	Branch            string
}

Jump to

Keyboard shortcuts

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