client

package
v2.3.7 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAttachment

func GetAttachment(build *gojenkins.Build, message string) slack.MsgOption

GetAttachment creates a attachment object for a given build

func ParseParameters

func ParseParameters(jobConfig config.JobConfig, parameterString string, params Parameters) error

ParseParameters parse jenkins parameters, based on a input string

func TriggerJenkinsJob

func TriggerJenkinsJob(cfg config.JobConfig, jobName string, jobParams Parameters, slackClient client.SlackClient, jenkins Client, message msg.Message) error

TriggerJenkinsJob starts a new build with given parameters it will return when the job was started successfully in the background it will watch the current build state and will update the state in the original slack message

func WatchBuild

func WatchBuild(build *gojenkins.Build) <-chan JobResult

WatchBuild will return a chan which is filled/closed when the build finished

func WatchJob

func WatchJob(ctx context.Context, jenkins Client, jobName string, stop chan bool) (chan gojenkins.Build, error)

WatchJob returns a chan which gets notified about any (finished) build of the job

Types

type Client

type Client interface {
	GetJob(ctx context.Context, id string) (*gojenkins.Job, error)
	BuildJob(ctx context.Context, name string, params map[string]string) (int64, error)
	GetAllNodes(ctx context.Context) ([]*gojenkins.Node, error)
}

Client is an interface representing used jenkins functions of gojenkins.

func GetClient

func GetClient(cfg config.Jenkins) (Client, error)

GetClient created Jenkins client with given options/credentials

type Job

type Job interface {
	Poll(ctx context.Context) (int, error)
	GetLastBuild(ctx context.Context) (*gojenkins.Build, error)
	GetBuild(ctx context.Context, id int64) (*gojenkins.Build, error)
}

Job is a interface of gojenkins.Job

type JobResult

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

JobResult holds the build result of a Build

type ParameterModifier

type ParameterModifier func(string) (string, error)

ParameterModifier are functions to mutate given Jenkins parameters e.g. ensure the parameter is a real "boolean" value

type Parameters

type Parameters map[string]string

Parameters is a simple string map of all build parameters

func (Parameters) String

func (p Parameters) String() string

Jump to

Keyboard shortcuts

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