jenkins

package
v1.414.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Instance

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

Instance connects to a Jenkins instance and returns a handler.

func TriggerJob

func TriggerJob(ctx context.Context, jenkins Jenkins, job Job, parameters map[string]string) (*gojenkins.Build, error)

TriggerJob starts a build for a given job name.

func UpdateCredential added in v1.108.0

func UpdateCredential(ctx context.Context, credentialsManager CredentialsManager, domain string, credential interface{}) error

UpdateCredential overwrites an existing credential

func WaitForBuildToFinish

func WaitForBuildToFinish(ctx context.Context, build Build, pollInterval time.Duration) error

WaitForBuildToFinish waits till a build is finished.

Types

type Artifact

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

Artifact is an interface to abstract gojenkins.Artifact.

func FetchBuildArtifact

func FetchBuildArtifact(ctx context.Context, 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(ctx context.Context) ([]byte, error)

GetData refers to the gojenkins.Artifact.GetData function.

func (*ArtifactImpl) Save added in v1.111.0

func (a *ArtifactImpl) Save(ctx context.Context, path string) (bool, error)

Save refers to the gojenkins.Artifact.Save function.

func (*ArtifactImpl) SaveToDir

func (a *ArtifactImpl) SaveToDir(ctx context.Context, dir string) (bool, error)

SaveToDir refers to the gojenkins.Artifact.SaveToDir function.

type Build

type Build interface {
	GetArtifacts() []gojenkins.Artifact
	IsRunning(ctx context.Context) bool
	Poll(ctx context.Context, options ...interface{}) (int, error)
}

Build is an interface to abstract gojenkins.Build.

type CredentialsManager added in v1.108.0

type CredentialsManager interface {
	Update(context.Context, 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 {
	GetJobObj(ctx context.Context, name string) *gojenkins.Job
	BuildJob(ctx context.Context, name string, params map[string]string) (int64, error)
	GetBuildFromQueueID(ctx context.Context, job *gojenkins.Job, queueid int64) (*gojenkins.Build, error)
}

Jenkins is an interface to abstract gojenkins.Jenkins.

type Job added in v1.146.0

type Job interface {
	Poll(context.Context) (int, error)
	InvokeSimple(ctx context.Context, params map[string]string) (int64, error)
	GetJob() *gojenkins.Job
}

Task is an interface to abstract gojenkins.Task.

func GetJob added in v1.146.0

func GetJob(ctx context.Context, jenkins Jenkins, jobName string) (Job, error)

type JobImpl added in v1.146.0

type JobImpl struct {
	Job *gojenkins.Job
}

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

func (*JobImpl) GetJob added in v1.146.0

func (t *JobImpl) GetJob() *gojenkins.Job

GetJob returns wrapped gojenkins.Job.

func (*JobImpl) InvokeSimple added in v1.146.0

func (t *JobImpl) InvokeSimple(ctx context.Context, params map[string]string) (int64, error)

InvokeSimple refers to the gojenkins.Job.InvokeSimple function.

func (*JobImpl) Poll added in v1.146.0

func (t *JobImpl) Poll(ctx context.Context) (int, error)

Poll refers to the gojenkins.Job.Poll function.

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(context.Context) (int, error)
	BuildNumber() (int64, error)
	HasStarted() bool
	WaitToStart(ctx context.Context, 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(ctx context.Context) (int, error)

Poll refers to the gojenkins.Task.Poll function.

func (*TaskImpl) WaitToStart

func (t *TaskImpl) WaitToStart(ctx context.Context, 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