jenkins

package
v1.121.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Instance

func Instance(client *http.Client, jenkinsURL, user, token string) (*gojenkins.Jenkins, error)

Instance connects to a Jenkins instance and returns a handler.

func TriggerJob

func TriggerJob(jenkins Jenkins, jobName string, parameters map[string]string) (*gojenkins.Task, error)

TriggerJob starts a build for a given job name.

func UpdateCredential added in v1.108.0

func UpdateCredential(credentialsManager CredentialsManager, domain string, credential interface{}) error

UpdateCredential overwrites an existing credential

func WaitForBuildToFinish

func WaitForBuildToFinish(build Build, pollInterval time.Duration)

WaitForBuildToFinish waits till a build is finished.

func WaitForBuildToStart

func WaitForBuildToStart(jenkins Jenkins, jobName string, taskWrapper Task, pollInterval time.Duration) (*gojenkins.Build, error)

WaitForBuildToStart waits till a build is started.

Types

type Artifact

type Artifact interface {
	Save(path string) (bool, error)
	SaveToDir(dir string) (bool, error)
	GetData() ([]byte, error)
	FileName() string
}

Artifact is an interface to abstract gojenkins.Artifact. mock generated with: mockery --name Artifact --dir pkg/jenkins --output pkg/jenkins/mocks

func FetchBuildArtifact

func FetchBuildArtifact(build Build, fileName string) (Artifact, error)

FetchBuildArtifact is fetching a build artifact from a finished build with a certain name. Fails if build is running or no artifact is with the given name is found.

type ArtifactImpl

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

ArtifactImpl is a wrapper struct for gojenkins.Artifact that respects the Artifact interface.

func (*ArtifactImpl) FileName

func (a *ArtifactImpl) FileName() string

FileName refers to the gojenkins.Artifact.FileName field.

func (*ArtifactImpl) GetData

func (a *ArtifactImpl) GetData() ([]byte, error)

GetData refers to the gojenkins.Artifact.GetData function.

func (*ArtifactImpl) Save added in v1.111.0

func (a *ArtifactImpl) Save(path string) (bool, error)

Save refers to the gojenkins.Artifact.Save function.

func (*ArtifactImpl) SaveToDir

func (a *ArtifactImpl) SaveToDir(dir string) (bool, error)

SaveToDir refers to the gojenkins.Artifact.SaveToDir function.

type Build

type Build interface {
	GetArtifacts() []gojenkins.Artifact
	IsRunning() bool
}

Build is an interface to abstract gojenkins.Build.

type CredentialsManager added in v1.108.0

type CredentialsManager interface {
	Update(string, string, interface{}) error
}

CredentialsManager is utility to control credential plugin

func NewCredentialsManager added in v1.108.0

func NewCredentialsManager(jenkins *gojenkins.Jenkins) CredentialsManager

NewCredentialsManager returns a new CredentialManager

type DockerServerCredentials added in v1.108.0

type DockerServerCredentials = gojenkins.DockerServerCredentials

DockerServerCredentials store credentials for docker keys.

type Jenkins

type Jenkins interface {
	BuildJob(name string, options ...interface{}) (int64, error)
	GetQueueItem(id int64) (*gojenkins.Task, error)
	GetBuild(jobName string, number int64) (*gojenkins.Build, error)
}

Jenkins is an interface to abstract gojenkins.Jenkins.

type SSHCredentials added in v1.108.0

type SSHCredentials = gojenkins.SSHCredentials

SSHCredentials store credentials for ssh keys.

type StringCredentials added in v1.108.0

type StringCredentials = gojenkins.StringCredentials

StringCredentials store only secret text

type Task

type Task interface {
	Poll() (int, error)
	BuildNumber() (int64, error)
	HasStarted() bool
	WaitToStart(pollInterval time.Duration) (int64, error)
}

Task is an interface to abstract gojenkins.Task.

type TaskImpl

type TaskImpl struct {
	Task *gojenkins.Task
}

TaskImpl is a wrapper struct for gojenkins.Task that respects the Task interface.

func (*TaskImpl) BuildNumber

func (t *TaskImpl) BuildNumber() (int64, error)

BuildNumber returns the assigned build number or an error if the build has not yet started.

func (*TaskImpl) HasStarted

func (t *TaskImpl) HasStarted() bool

HasStarted checks if the wrapped gojenkins.Task has started by checking the assigned executable URL.

func (*TaskImpl) Poll

func (t *TaskImpl) Poll() (int, error)

Poll refers to the gojenkins.Task.Poll function.

func (*TaskImpl) WaitToStart

func (t *TaskImpl) WaitToStart(pollInterval time.Duration) (int64, error)

WaitToStart waits till the build has started.

type UsernameCredentials added in v1.108.0

type UsernameCredentials = gojenkins.UsernameCredentials

UsernameCredentials struct representing credential for storing username-password pair

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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