jenkins

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IconRunning = "arrows_counterclockwise"
	IconSuccess = "white_check_mark"
	IconFailed  = "x"
)

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 GetClient

func GetClient(cfg config.Jenkins) (*gojenkins.Jenkins, error)

GetClient created Jenkins client with given options/credentials

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 map[string]string, 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(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(id string, parentIDs ...string) (*gojenkins.Job, error)
	BuildJob(name string, options ...interface{}) (int64, error)
	GetAllNodes() ([]*gojenkins.Node, error)
}

Client is a interface of gojenkins.Jenkins

type Job

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

Job is a interface of gojenkins.Job

type JobResult added in v1.6.0

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

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

Jump to

Keyboard shortcuts

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