Back to / pkg / tekton

package tekton

Latest Go to latest
Published: Apr 15, 2019 | License: Apache-2.0 | Module:



const (
	// LastBuildNumberAnnotationPrefix used to annotate SourceRepository with the latest build number for a branch
	LastBuildNumberAnnotationPrefix = ""

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, run *v1alpha1.PipelineRun) (*v1alpha1.PipelineRun, error)

CreatePipelineRun lazily creates a Tekton PipelineRun.

func GenerateNextBuildNumber

func GenerateNextBuildNumber(tektonClient tektonclient.Interface, jxClient jxClient.Interface, ns string, gitInfo *gits.GitRepository, branch string, duration time.Duration, pipelineIdentifier string) (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

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

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

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier