jenkins

package
v0.0.0-...-71304e1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Succeess = "SUCCESS"
	Failure  = "FAILURE"
	Aborted  = "ABORTED"
)

Variables

This section is empty.

Functions

func RunAfterSuccessCanRun

func RunAfterSuccessCanRun(parent, child *kube.ProwJob, c configAgent, ghc githubClient) bool

RunAfterSuccessCanRun returns whether a child job (specified as run_after_success in the prow config) can run once its parent job succeeds. The only case we will not run a child job is when it is a presubmit job and has a run_if_changed regural expression specified which does not match the changed filenames in the pull request the job was meant to run for. TODO: Collapse with plank, impossible to reuse as is due to the interfaces.

Types

type AuthConfig

type AuthConfig struct {
	Basic       *BasicAuthConfig
	BearerToken *BearerTokenAuthConfig
}

AuthConfig configures how we auth with Jenkins. Only one of the fields will be non-nil.

type BasicAuthConfig

type BasicAuthConfig struct {
	User  string
	Token string
}

type BearerTokenAuthConfig

type BearerTokenAuthConfig struct {
	Token string
}

type Client

type Client struct {
	// If Logger is non-nil, log all method calls with it.
	Logger Logger
	// contains filtered or unexported fields
}

func NewClient

func NewClient(url string, authConfig *AuthConfig) *Client

func (*Client) Abort

func (c *Client) Abort(job string, build *JenkinsBuild) error

Abort aborts the provided Jenkins build for job. Only running builds are aborted.

func (*Client) Build

func (c *Client) Build(pj *kube.ProwJob) error

Build triggers a Jenkins build for the provided ProwJob. The name of the ProwJob is going to be used as the buildId parameter that will help us track the build before it's scheduled by Jenkins.

func (*Client) GetLog

func (c *Client) GetLog(job string, build int) ([]byte, error)

func (*Client) ListJenkinsBuilds

func (c *Client) ListJenkinsBuilds(jobs map[string]struct{}) (map[string]JenkinsBuild, error)

ListJenkinsBuilds returns a list of all in-flight builds for the provided jobs. Both running and unscheduled builds will be returned.

type Controller

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

Controller manages ProwJobs.

func NewController

func NewController(kc *kube.Client, jc *Client, ghc *github.Client, ca *config.Agent) *Controller

NewController creates a new Controller from the provided clients.

func (*Controller) Sync

func (c *Controller) Sync() error

Sync does one sync iteration.

type JenkinsBuild

type JenkinsBuild struct {
	Actions []struct {
		Parameters []struct {
			Name string `json:"name"`
			// This needs to be an interface so we won't clobber
			// json unmarshaling when the Jenkins job has more
			// parameter types than strings.
			Value interface{} `json:"value"`
		} `json:"parameters"`
	} `json:"actions"`
	Task struct {
		// Used for tracking unscheduled builds for jobs.
		Name string `json:"name"`
	} `json:"task"`
	Number int     `json:"number"`
	Result *string `json:"result"`
	// contains filtered or unexported fields
}

func (*JenkinsBuild) BuildID

func (jb *JenkinsBuild) BuildID() string

func (*JenkinsBuild) IsEnqueued

func (jb *JenkinsBuild) IsEnqueued() bool

func (*JenkinsBuild) IsFailure

func (jb *JenkinsBuild) IsFailure() bool

func (*JenkinsBuild) IsRunning

func (jb *JenkinsBuild) IsRunning() bool

func (*JenkinsBuild) IsSuccess

func (jb *JenkinsBuild) IsSuccess() bool

type Logger

type Logger interface {
	Debugf(s string, v ...interface{})
}

Jump to

Keyboard shortcuts

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