activities

package
v3.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OwnerLabels   = []string{"owner", "lighthouse.jenkins-x.io/refs.org"}
	RepoLabels    = []string{"repository", "lighthouse.jenkins-x.io/refs.repo"}
	BranchLabels  = []string{"branch", "lighthouse.jenkins-x.io/branch"}
	BuildLabels   = []string{"build", "lighthouse.jenkins-x.io/buildNum"}
	ContextLabels = []string{"context", "lighthouse.jenkins-x.io/context"}
)

Functions

func CompletePromote

func CompletePromote(p *v1.PromoteActivityStep) error

func DefaultValues

func DefaultValues(a *v1.PipelineActivity)

DefaultValues default missing values from the lighthouse labels

func FailedPromote

func FailedPromote(p *v1.PromoteActivityStep) error

func GenerateBuildNumber

func GenerateBuildNumber(activities typev1.PipelineActivityInterface, pipelines []*v1.PipelineActivity, pn PipelineID) (string, *v1.PipelineActivity, error)

GenerateBuildNumber generates a new build number for the given pipeline

func GetLabel

func GetLabel(m map[string]string, labels []string) string

GetLabel returns the first label value for the given strings

func GetOrCreateStage

func GetOrCreateStage(a *v1.PipelineActivity, stageName string) (*v1.PipelineActivityStep, *v1.StageActivityStep, bool)

GetOrCreateStage gets or creates the stage for the given name

func GetStepValueFromStage

func GetStepValueFromStage(stage *v1.StageActivityStep, stepName string) (v1.CoreActivityStep, bool)

GetStepValueFromStage gets the value for the step for the given name in the given stage, if it already exists. If it doesn't exist, it will create a new step for that name instead.

func ListSelectedPipelineActivities

func ListSelectedPipelineActivities(activitiesClient typev1.PipelineActivityInterface, labelSelector fmt.Stringer, fieldSelector fields.Selector) (*v1.PipelineActivityList, error)

ListSelectedPipelineActivities retrieves the PipelineActivities instances matching the specified label and field selectors. Selectors can be empty or nil.

func SortActivities

func SortActivities(activities []v1.PipelineActivity)

SortActivities sorts a list of PipelineActivities

func StartPromote

func StartPromote(p *v1.PromoteActivityStep) error

func ToProviderName

func ToProviderName(gitURL string) string

ToProviderName takes the git URL and converts it to a provider name which can be used as a label selector

func UpdateStatus

func UpdateStatus(activity *v1.PipelineActivity, containersTerminated bool, onCompleteCallback func(activity *v1.PipelineActivity))

UpdateStatus updates the pipeline activity status if any of the steps have failed or they have all completed

func UpdateStepsStatus

func UpdateStepsStatus(status v1.ActivityStatusType, steps []v1.CoreActivityStep) v1.ActivityStatusType

UpdateStepsStatus updates the status for the given status and steps

Types

type ByTimestamp

type ByTimestamp []v1.PipelineActivity

ByTimestamp is used to fileter a list of PipelineActivities by their given timestamp

func (ByTimestamp) Len

func (a ByTimestamp) Len() int

func (ByTimestamp) Less

func (a ByTimestamp) Less(i, j int) bool

func (ByTimestamp) Swap

func (a ByTimestamp) Swap(i, j int)

type PipelineActivityKey

type PipelineActivityKey struct {
	Name              string
	Pipeline          string
	Build             string
	Version           string
	BuildURL          string
	BuildLogsURL      string
	ReleaseNotesURL   string
	LastCommitSHA     string
	LastCommitMessage string
	LastCommitURL     string
	GitInfo           *giturl.GitRepository
	PullRefs          map[string]string
	Context           string
	Annotations       map[string]string
	Labels            map[string]string
}

func (*PipelineActivityKey) GetOrCreate

func (k *PipelineActivityKey) GetOrCreate(jxClient versioned.Interface, ns string) (*v1.PipelineActivity, bool, error)

GetOrCreate gets or creates the pipeline activity

func (*PipelineActivityKey) GitOwner

func (k *PipelineActivityKey) GitOwner() string

GitOwner returns the git owner (person / organisation) or blank string if it cannot be found

func (*PipelineActivityKey) GitRepository

func (k *PipelineActivityKey) GitRepository() string

GitRepository returns the git repository name or blank string if it cannot be found

func (*PipelineActivityKey) GitURL

func (k *PipelineActivityKey) GitURL() string

GitURL returns the git URL or blank string if it cannot be found

func (*PipelineActivityKey) IsValid

func (k *PipelineActivityKey) IsValid() bool

type PipelineDetails

type PipelineDetails struct {
	GitOwner      string
	GitRepository string
	BranchName    string
	Pipeline      string
	Build         string
	Context       string
}

func CreatePipelineDetails

func CreatePipelineDetails(activity *v1.PipelineActivity) *PipelineDetails

CreatePipelineDetails creates a PipelineDetails object populated from the activity

type PipelineID

type PipelineID struct {
	ID   string
	Name string
}

PipelineID is an identifier for a Pipeline. A pipeline is typically identified by its owner, repository, and branch with the ID field taking the form `<owner>/>repository>/<branch>`

func NewPipelineID

func NewPipelineID(owner string, repository string, branch string) PipelineID

NewPipelineID creates a new PipelineID for a given owner, repository, and branch.

func NewPipelineIDFromString

func NewPipelineIDFromString(id string) PipelineID

NewPipelineIDFromString creates a new PipelineID, given a pre-built string identifier. The string identifier is expected to follow the format `<owner>/>repository>/<branch>`, though this isn't actually validated/mandated here.

func (*PipelineID) GetActivityName

func (p *PipelineID) GetActivityName(activity string) string

GetActivityName Builds a Kubernetes-friendly (i.e. a-z,-,. only) name for a specific activity, within a pipeline.

type PromoteStepActivityKey

type PromoteStepActivityKey struct {
	PipelineActivityKey

	Environment    string
	ApplicationURL string
}

func (*PromoteStepActivityKey) GetOrCreatePreview

GetOrCreatePreview gets or creates the Preview step for the key

func (*PromoteStepActivityKey) GetOrCreatePromote

GetOrCreatePromote gets or creates the Promote step for the key

func (*PromoteStepActivityKey) GetOrCreatePromotePullRequest

GetOrCreatePromotePullRequest gets or creates the PromotePullRequest for the key

func (*PromoteStepActivityKey) GetOrCreatePromoteUpdate

GetOrCreatePromoteUpdate gets or creates the Promote for the key

func (*PromoteStepActivityKey) OnPromotePullRequest

func (k *PromoteStepActivityKey) OnPromotePullRequest(kubeClient kubernetes.Interface, jxClient versioned.Interface, ns string, fn PromotePullRequestFn) error

OnPromotePullRequest updates activities on a Promote PR

func (*PromoteStepActivityKey) OnPromoteUpdate

func (k *PromoteStepActivityKey) OnPromoteUpdate(kubeClient kubernetes.Interface, jxClient versioned.Interface, ns string, fn PromoteUpdateFn) error

OnPromoteUpdate updates activities on a Promote Update

Jump to

Keyboard shortcuts

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