contract

package
v0.0.0-...-9428abd Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCommmitAnnotation

func GetCommmitAnnotation() string

GetCommmitAnnotation returns by default "pipelinesfeedback.keskad.pl/commit". Parametrized with 'ANNOTATION_FEEDBACK_BASE' env variable

func GetHttpsRepoUrlAnnotation

func GetHttpsRepoUrlAnnotation() string

GetHttpsRepoUrlAnnotation returns by default "pipelinesfeedback.keskad.pl/https-repo-url". Parametrized with 'ANNOTATION_FEEDBACK_BASE' env variable

func GetPrIdAnnotation

func GetPrIdAnnotation() string

GetPrIdAnnotation returns by default "pipelinesfeedback.keskad.pl/pr-id". Parametrized with 'ANNOTATION_FEEDBACK_BASE' env variable

func GetRefAnnotation

func GetRefAnnotation() string

GetRefAnnotation returns by default "pipelinesfeedback.keskad.pl/ref". Parametrized with 'ANNOTATION_FEEDBACK_BASE' env variable

func GetTechnicalJobAnnotation

func GetTechnicalJobAnnotation() string

GetTechnicalJobAnnotation returns by default "pipelinesfeedback.keskad.pl/technical-job". Parametrized with 'ANNOTATION_FEEDBACK_BASE' env variable

func IsJobHavingRequiredLabel

func IsJobHavingRequiredLabel(labels map[string]string) bool

IsJobHavingRequiredLabel decides if a controller should take the resource

func PipelineInfoWithLogsCollector

func PipelineInfoWithLogsCollector(collector func() string) func(pipelineInfo *PipelineInfo)

PipelineInfoWithLogsCollector should return whole Pipeline logs on demand. Implement is as lazy-fetch function

func PipelineInfoWithUrl

func PipelineInfoWithUrl(url string) func(pipelineInfo *PipelineInfo)

PipelineInfoWithUrl is setting optionally a URL pointing to a Pipeline visualization

Types

type ConfigurationData

type ConfigurationData interface {
	GetOrDefault(keyName string, defaultVal string) string
}

type JobContext

type JobContext struct {
	// Commit represents long commit hash
	Commit string

	// Reference represents a full GIT reference e.g. refs/heads/v1.6.1 or refs/heads/release-1.3.1.2
	Reference string

	// RepoHttpsUrl describes a full URL to the repository in HTTPS format
	RepoHttpsUrl string

	// PrId is a pull/merge request id
	PrId string

	OrganizationName string
	RepositoryName   string

	// When a job does not have a SCM context, but has a technical-job annotation
	TechnicalJob string
}

func NewSCMContext

func NewSCMContext(repoHttpsUrl string) (JobContext, error)

func (JobContext) GetNameWithOrg

func (c JobContext) GetNameWithOrg() string

func (JobContext) IsTechnicalJob

func (c JobContext) IsTechnicalJob() bool

func (JobContext) IsValid

func (c JobContext) IsValid() bool

type PipelineInfo

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

PipelineInfo is a point-in-time Pipeline status including the SCM information

func NewPipelineInfo

func NewPipelineInfo(scm JobContext, namespace string, name string, instanceName string, dateStarted time.Time,
	stages []PipelineStage, labels labels.Labels, annotations labels.Labels, globalCfg ConfigurationData, options ...func(info *PipelineInfo)) *PipelineInfo

func (PipelineInfo) GetAnnotations

func (pi PipelineInfo) GetAnnotations() labels.Labels

GetAnnotations returns Kubernetes object .metadata.annotations

func (PipelineInfo) GetDashboardUrl

func (pi PipelineInfo) GetDashboardUrl() string

GetDashboardUrl returns a URL to some dashboard, where the pipeline could be looked up

func (PipelineInfo) GetFullName

func (pi PipelineInfo) GetFullName() string

GetFullName returns a namespace, object name and its instance name (often uid or generated name)

func (PipelineInfo) GetId

func (pi PipelineInfo) GetId() string

GetId is returning execution ID, unique for a single Pipeline execution

func (PipelineInfo) GetInstanceName

func (pi PipelineInfo) GetInstanceName() string

GetInstanceName is returning execution name, a short name

func (PipelineInfo) GetLabels

func (pi PipelineInfo) GetLabels() labels.Labels

GetLabels returns Kubernetes object .metadata.labels

func (PipelineInfo) GetLogs

func (pi PipelineInfo) GetLogs() string

GetLogs is returning truncated logs. It is a lazy-loaded method, fetches logs on demand. After first fetch logs are kept in the memory

func (PipelineInfo) GetName

func (pi PipelineInfo) GetName() string

GetName returns a full object name, including namespace

func (PipelineInfo) GetNamespace

func (pi PipelineInfo) GetNamespace() string

func (PipelineInfo) GetSCMContext

func (pi PipelineInfo) GetSCMContext() JobContext

func (PipelineInfo) GetStages

func (pi PipelineInfo) GetStages() []PipelineStage

GetStages returns a stage list with statuses for each

func (PipelineInfo) GetStatus

func (pi PipelineInfo) GetStatus() Status

GetStatus is calculating the pipeline status basing on the results of all children stages

func (PipelineInfo) IsJustCreated

func (pi PipelineInfo) IsJustCreated() bool

IsJustCreated tells us if the resource was retrieved from the cluster first time

func (PipelineInfo) SetRetrievalCount

func (pi PipelineInfo) SetRetrievalCount(num int)

SetRetrievalCount (for internal use only)

func (PipelineInfo) ToHash

func (pi PipelineInfo) ToHash() string

type PipelineStage

type PipelineStage struct {
	Name   string
	Status Status
}

PipelineStage represents a status of a particular Pipeline stage (naming: in Jenkins "Stage", in Tekton "Task")

type Pluggable

type Pluggable interface {
	CanHandle(adapterName string) bool
	GetImplementationName() string
}

type Status

type Status string
const (
	PipelineRunning   Status = "running"
	PipelineFailed    Status = "failed"
	PipelinePending   Status = "pending"
	PipelineErrored   Status = "errored"
	PipelineSucceeded Status = "succeeded"
	PipelineCancelled Status = "cancelled"
	PipelineSkipped   Status = "skipped"
)

func (Status) AsHumanReadableDescription

func (s Status) AsHumanReadableDescription() string

func (Status) IsCancelled

func (s Status) IsCancelled() bool

func (Status) IsErroredOrFailed

func (s Status) IsErroredOrFailed() bool

func (Status) IsFinished

func (s Status) IsFinished() bool

func (Status) IsNotStarted

func (s Status) IsNotStarted() bool

func (Status) IsRunning

func (s Status) IsRunning() bool

func (Status) IsSkipped

func (s Status) IsSkipped() bool

func (Status) IsSucceeded

func (s Status) IsSucceeded() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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