tekton

package
v1.3.1068 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// LastBuildNumberAnnotationPrefix used to annotate SourceRepository with the latest build number for a branch
	LastBuildNumberAnnotationPrefix = "jenkins.io/last-build-number-for-"
)

Variables

This section is empty.

Functions

func CreatePipeline added in v1.3.1061

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

CreatePipeline lazily creates a Tekton Pipeline for the given git repository, branch and context. If a Pipeline with the same name already exists, this function returns an error.

func CreatePipelineRun

func CreatePipelineRun(tektonClient tektonclient.Interface, ns string, run *v1alpha1.PipelineRun) (*v1alpha1.PipelineRun, error)

CreatePipelineRun lazily creates a Tekton PipelineRun.

func CreateSourceResource added in v1.3.1061

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

CreateSourceResource lazily creates a Tekton PipelineResource. This function fails if there is already a distinct PipelineResource by the same name.

func CreateTask added in v1.3.1061

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

CreateTask lazily creates a Tekton Task. If a Task with the same name already exists, this function returns an error.

func GenerateNextBuildNumber added in v1.3.1061

func GenerateNextBuildNumber(jxClient jxClient.Interface, ns string, gitInfo *gits.GitRepository, branch string, duration time.Duration) (string, error)

GenerateNextBuildNumber generates a new build number for the given project.

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

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