jenkins

package
v1.226.0-protecode-cus... Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

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

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)

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. mock generated with: mockery --name Artifact --dir pkg/jenkins --output pkg/jenkins/mocks

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

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
}

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

type CredentialsManager

type CredentialsManager interface {
	Update(context.Context, string, string, interface{}) error
}

CredentialsManager is utility to control credential plugin mock generated with: mockery --name CredentialsManager --dir pkg/jenkins --output pkg/jenkins/mocks

func NewCredentialsManager

func NewCredentialsManager(jenkins *gojenkins.Jenkins) CredentialsManager

NewCredentialsManager returns a new CredentialManager

type DockerServerCredentials

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. mock generated with: mockery --name Jenkins --dir pkg/jenkins --output pkg/jenkins/mocks

type Job

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. mock generated with: mockery --name Job --dir pkg/jenkins --output pkg/jenkins/mocks

func GetJob

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

type JobImpl

type JobImpl struct {
	Job *gojenkins.Job
}

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

func (*JobImpl) GetJob

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

GetJob returns wrapped gojenkins.Job.

func (*JobImpl) InvokeSimple

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

InvokeSimple refers to the gojenkins.Job.InvokeSimple function.

func (*JobImpl) Poll

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

Poll refers to the gojenkins.Job.Poll function.

type SSHCredentials

type SSHCredentials = gojenkins.SSHCredentials

SSHCredentials store credentials for ssh keys.

type StringCredentials

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. mock generated with: mockery --name Task --dir pkg/jenkins --output pkg/jenkins/mocks

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

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