tekton

package
v1.3.1041 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LastBuildNumberAnnotation used to annotate the Pipeline with the latest build number
	LastBuildNumberAnnotation = "jenkins.io/last-build-number"
)

Variables

This section is empty.

Functions

func CreateOrUpdatePipeline

func CreateOrUpdatePipeline(tektonClient tektonclient.Interface, ns string, created *v1alpha1.Pipeline) (*v1alpha1.Pipeline, error)

CreateOrUpdatePipeline lazily creates a Tekton Pipeline for the given git repository, branch and context

func CreateOrUpdateSourceResource

func CreateOrUpdateSourceResource(tektonClient tektonclient.Interface, ns string, created *v1alpha1.PipelineResource) (*v1alpha1.PipelineResource, error)

CreateOrUpdateSourceResource lazily creates a Tekton Pipeline PipelineResource for the given git repository

func CreateOrUpdateTask

func CreateOrUpdateTask(tektonClient tektonclient.Interface, ns string, created *v1alpha1.Task) (*v1alpha1.Task, error)

CreateOrUpdateTask lazily creates a Tekton Pipeline Task

func CreatePipelineRun

func CreatePipelineRun(tektonClient tektonclient.Interface, ns string, pipeline *v1alpha1.Pipeline, run *v1alpha1.PipelineRun, previewVersionPrefix string, duration time.Duration) (*v1alpha1.PipelineRun, error)

CreatePipelineRun lazily creates a Tekton Pipeline Task

func GetLastBuildNumber

func GetLastBuildNumber(pipeline *v1alpha1.Pipeline) int

GetLastBuildNumber returns the last build number on the Pipeline

func PipelineResourceName

func PipelineResourceName(gitInfo *gits.GitRepository, branch string, context string) string

PipelineResourceName returns the pipeline resource name for the given git repository, branch and context

func SortPipelineRunInfos

func SortPipelineRunInfos(pris []*PipelineRunInfo)

SortPipelineRunInfos sorts a slice of PipelineRunInfos by their org, repo, branch, and build number

func UpdateLastPipelineBuildNumber

func UpdateLastPipelineBuildNumber(tektonClient tektonclient.Interface, ns string, pipeline *v1alpha1.Pipeline, buildNumber int, params map[string]string, duration time.Duration) error

UpdateLastPipelineBuildNumber keeps trying to update the last build number annotation on the Pipeline until it succeeds or another thread/process beats us to it

Types

type PipelineRunInfo

type PipelineRunInfo struct {
	Name              string
	Organisation      string
	Repository        string
	Branch            string
	Context           string
	Build             string
	BuildNumber       int
	Pipeline          string
	PipelineRun       string
	LastCommitSHA     string
	LastCommitMessage string
	LastCommitURL     string
	GitURL            string
	GitInfo           *gits.GitRepository
	Stages            []*StageInfo
}

PipelineRunInfo provides information on a PipelineRun and its stages for use in getting logs and populating activity

func CreatePipelineRunInfo

func CreatePipelineRunInfo(prName string, podList *corev1.PodList, ps *v1.PipelineStructure, pr *tektonv1alpha1.PipelineRun) (*PipelineRunInfo, error)

CreatePipelineRunInfo looks up the PipelineRun for a given name and creates the PipelineRunInfo for it

func (*PipelineRunInfo) FindFirstStagePod

func (pri *PipelineRunInfo) FindFirstStagePod() *corev1.Pod

FindFirstStagePod finds the first stage in this pipeline run to have a pod, and then returns its pod

func (PipelineRunInfo) GetBuild

func (pri PipelineRunInfo) GetBuild() string

GetBuild gets the build identifier

func (*PipelineRunInfo) GetOrderedTaskStages

func (pri *PipelineRunInfo) GetOrderedTaskStages() []*StageInfo

GetOrderedTaskStages gets all the stages in this pipeline which actually contain a Task, in rough execution order TODO: Handle parallelism better, where execution is not a straight line.

func (*PipelineRunInfo) MatchesPipeline

func (pri *PipelineRunInfo) MatchesPipeline(activity *v1.PipelineActivity) bool

MatchesPipeline returns true if this build info matches the given pipeline

func (*PipelineRunInfo) SetPodsForPipelineRun

func (pri *PipelineRunInfo) SetPodsForPipelineRun(podList *corev1.PodList, ps *v1.PipelineStructure) error

SetPodsForPipelineRun populates the pods for all stages within its PipelineRunInfo

func (*PipelineRunInfo) Status

func (pri *PipelineRunInfo) Status() string

Status returns the build status

func (PipelineRunInfo) ToBuildPodInfo added in v1.3.961

func (pri PipelineRunInfo) ToBuildPodInfo() *builds.BuildPodInfo

ToBuildPodInfo converts the object into a BuildPodInfo so it can be easily filtered

type PipelineRunInfoFilter

type PipelineRunInfoFilter struct {
	Owner      string
	Repository string
	Branch     string
	Build      string
	Filter     string
	Pending    bool
}

PipelineRunInfoFilter allows specifying criteria on which to filter a list of PipelineRunInfos

func (*PipelineRunInfoFilter) BuildNumber

func (o *PipelineRunInfoFilter) BuildNumber() int

BuildNumber returns the integer build number filter if specified

func (*PipelineRunInfoFilter) PipelineRunMatches

func (o *PipelineRunInfoFilter) PipelineRunMatches(info *PipelineRunInfo) bool

PipelineRunMatches returns true if the pipeline run info matches the filter

type PipelineRunInfoOrder

type PipelineRunInfoOrder []*PipelineRunInfo

PipelineRunInfoOrder allows sorting of a slice of PipelineRunInfos

func (PipelineRunInfoOrder) Len

func (a PipelineRunInfoOrder) Len() int

func (PipelineRunInfoOrder) Less

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

func (PipelineRunInfoOrder) Swap

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

type StageInfo

type StageInfo struct {
	// TODO: For now, we're not including git info - we're going to assume we have the same git info for the whole
	// pipeline.
	Name string

	// These fields will populated for all non-parent stages
	PodName        string
	Task           string
	TaskRun        string
	FirstStepImage string
	CreatedTime    time.Time
	Pod            *corev1.Pod

	// These fields will only be populated for appropriate parent stages
	Parallel []*StageInfo
	Stages   []*StageInfo

	// This field will be non-empty if this is a nested stage, containing a list of  the names of all its parent stages with the top-level parent first
	Parents []string
}

StageInfo provides information on a particular stage, including its pod info or info on its nested stages

func (*StageInfo) GetFullChildStageNames

func (si *StageInfo) GetFullChildStageNames(includeSelf bool) []string

GetFullChildStageNames gets the fully qualified (i.e., with parents appended) names of each stage underneath this one.

func (*StageInfo) GetStageNameIncludingParents

func (si *StageInfo) GetStageNameIncludingParents() string

GetStageNameIncludingParents constructs a full stage name including its parents, if they exist.

func (*StageInfo) SetPodsForStageInfo

func (si *StageInfo) SetPodsForStageInfo(podList *corev1.PodList, prName string) error

SetPodsForStageInfo populates the pods for a particular stage and/or its children

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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