Documentation ¶
Index ¶
- Constants
- func ApplyPipeline(jxClient versioned.Interface, kubeClient kubernetes.Interface, ...) error
- func ApplyPipelineRun(tektonClient tektonclient.Interface, ns string, run *v1alpha1.PipelineRun) (*v1alpha1.PipelineRun, error)
- func CancelPipelineRun(tektonClient tektonclient.Interface, ns string, pr *pipelineapi.PipelineRun) error
- func CreateOrUpdatePipeline(tektonClient tektonclient.Interface, ns string, created *v1alpha1.Pipeline) (*v1alpha1.Pipeline, error)
- func CreateOrUpdateSourceResource(tektonClient tektonclient.Interface, ns string, ...) (*v1alpha1.PipelineResource, error)
- func CreateOrUpdateTask(tektonClient tektonclient.Interface, ns string, created *v1alpha1.Task) (*v1alpha1.Task, error)
- func CreatePipelineRun(resources []*pipelineapi.PipelineResource, name string, apiVersion string, ...) *pipelineapi.PipelineRun
- func GenerateNextBuildNumber(tektonClient tektonclient.Interface, jxClient jxClient.Interface, ns string, ...) (string, error)
- func GeneratePipelineActivity(buildNumber string, branch string, gitInfo *gits.GitRepository, context string, ...) *kube.PromoteStepActivityKey
- func GenerateSourceRepoResource(name string, gitInfo *gits.GitRepository, revision string) *pipelineapi.PipelineResource
- func PipelineResourceName(organisation string, name string, branch string, context string, ...) string
- func PipelineResourceNameFromGitInfo(gitInfo *gits.GitRepository, branch string, context string, ...) string
- func PipelineRunIsComplete(pr *pipelineapi.PipelineRun) bool
- func PipelineRunIsNotPending(pr *pipelineapi.PipelineRun) bool
- func SortPipelineRunInfos(pris []*PipelineRunInfo)
- func StructureForPipelineRun(jxClient versioned.Interface, ns string, run *pipelineapi.PipelineRun) (*v1.PipelineStructure, error)
- type CRDWrapper
- func (crds *CRDWrapper) AddLabels(labels map[string]string)
- func (crds *CRDWrapper) Name() string
- func (crds *CRDWrapper) ObjectReferences() []kube.ObjectReference
- func (crds *CRDWrapper) Pipeline() *pipelineapi.Pipeline
- func (crds *CRDWrapper) PipelineRun() *pipelineapi.PipelineRun
- func (crds *CRDWrapper) Resources() []*pipelineapi.PipelineResource
- func (crds *CRDWrapper) String() string
- func (crds *CRDWrapper) Structure() *v1.PipelineStructure
- func (crds *CRDWrapper) Tasks() []*pipelineapi.Task
- func (crds *CRDWrapper) WriteToDisk(dir string, pipelineActivity *kube.PromoteStepActivityKey) error
- type PipelineRunInfo
- func (pri *PipelineRunInfo) FindFirstStagePod() *corev1.Pod
- func (pri PipelineRunInfo) GetBuild() string
- func (pri *PipelineRunInfo) GetOrderedTaskStages() []*StageInfo
- func (pri *PipelineRunInfo) MatchesPipeline(activity *v1.PipelineActivity) bool
- func (pri *PipelineRunInfo) SetPodsForPipelineRun(podList *corev1.PodList, ps *v1.PipelineStructure) error
- func (pri *PipelineRunInfo) Status() string
- func (pri PipelineRunInfo) ToBuildPodInfo() *builds.BuildPodInfo
- type PipelineRunInfoFilter
- type PipelineRunInfoOrder
- type PipelineType
- type PullRefs
- type StageInfo
Constants ¶
const ( // LastBuildNumberAnnotationPrefix used to annotate SourceRepository with the latest build number for a branch LastBuildNumberAnnotationPrefix = "jenkins.io/last-build-number-for-" // LabelOwner is the label added to Tekton CRDs for the owner of the repository being built. LabelOwner = v1.LabelOwner // LabelRepo is the label added to Tekton CRDs for the repository being built. LabelRepo = v1.LabelRepository // LabelBranch is the label added to Tekton CRDs for the branch being built. LabelBranch = v1.LabelBranch // LabelBuild is the label added to Tekton CRDs for the build number. LabelBuild = v1.LabelBuild // LabelContext is the label added to Tekton CRDs for the context being built. LabelContext = "context" // LabelType is the label added to Tekton CRDs for the type of pipeline. LabelType = "jenkins.io/pipelineType" // DefaultPipelineSA is the default service account used for pipelines DefaultPipelineSA = "tekton-bot" )
Variables ¶
This section is empty.
Functions ¶
func ApplyPipeline ¶
func ApplyPipeline(jxClient versioned.Interface, kubeClient kubernetes.Interface, tektonClient tektonclient.Interface, crds *CRDWrapper, ns string, activityKey *kube.PromoteStepActivityKey) error
ApplyPipeline applies the tasks and pipeline to the cluster and creates and applies a PipelineResource for their source repo and a pipelineRun to execute them.
func ApplyPipelineRun ¶
func ApplyPipelineRun(tektonClient tektonclient.Interface, ns string, run *v1alpha1.PipelineRun) (*v1alpha1.PipelineRun, error)
ApplyPipelineRun lazily creates a Tekton PipelineRun.
func CancelPipelineRun ¶
func CancelPipelineRun(tektonClient tektonclient.Interface, ns string, pr *pipelineapi.PipelineRun) error
CancelPipelineRun cancels a Pipeline
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(resources []*pipelineapi.PipelineResource, name string, apiVersion string, labels map[string]string, serviceAccount string, pipelineParams []pipelineapi.Param, timeout *metav1.Duration, affinity *corev1.Affinity, tolerations []corev1.Toleration) *pipelineapi.PipelineRun
CreatePipelineRun creates the PipelineRun struct.
func GenerateNextBuildNumber ¶
func GenerateNextBuildNumber(tektonClient tektonclient.Interface, jxClient jxClient.Interface, ns string, gitInfo *gits.GitRepository, branch string, duration time.Duration, context string, useActivity bool) (string, error)
GenerateNextBuildNumber generates a new build number for the given project.
func GeneratePipelineActivity ¶
func GeneratePipelineActivity(buildNumber string, branch string, gitInfo *gits.GitRepository, context string, pr *PullRefs) *kube.PromoteStepActivityKey
GeneratePipelineActivity generates a initial PipelineActivity CRD so UI/get act can get an earlier notification that the jobs have been scheduled
func GenerateSourceRepoResource ¶
func GenerateSourceRepoResource(name string, gitInfo *gits.GitRepository, revision string) *pipelineapi.PipelineResource
GenerateSourceRepoResource generates the PipelineResource for the git repository we are operating on.
func PipelineResourceName ¶
func PipelineResourceName(organisation string, name string, branch string, context string, pipelineType string) string
PipelineResourceName returns the pipeline resource name for the given git org, repo name, branch and context. It will always be unique.
func PipelineResourceNameFromGitInfo ¶
func PipelineResourceNameFromGitInfo(gitInfo *gits.GitRepository, branch string, context string, pipelineType string) string
PipelineResourceNameFromGitInfo returns the pipeline resource name for the given git repository, branch and context
func PipelineRunIsComplete ¶
func PipelineRunIsComplete(pr *pipelineapi.PipelineRun) bool
PipelineRunIsComplete returns true if the PipelineRun has completed or has running steps.
func PipelineRunIsNotPending ¶
func PipelineRunIsNotPending(pr *pipelineapi.PipelineRun) bool
PipelineRunIsNotPending returns true if the PipelineRun has completed or has running steps.
func SortPipelineRunInfos ¶
func SortPipelineRunInfos(pris []*PipelineRunInfo)
SortPipelineRunInfos sorts a slice of PipelineRunInfos by their org, repo, branch, and build number
func StructureForPipelineRun ¶
func StructureForPipelineRun(jxClient versioned.Interface, ns string, run *pipelineapi.PipelineRun) (*v1.PipelineStructure, error)
StructureForPipelineRun finds the PipelineStructure for the given PipelineRun, trying its name first and then its Pipeline name, returning an error if no PipelineStructure can be found.
Types ¶
type CRDWrapper ¶
type CRDWrapper struct {
// contains filtered or unexported fields
}
CRDWrapper is a wrapper around the various Tekton CRDs
func NewCRDWrapper ¶
func NewCRDWrapper(pipeline *pipelineapi.Pipeline, tasks []*pipelineapi.Task, resources []*pipelineapi.PipelineResource, structure *v1.PipelineStructure, run *pipelineapi.PipelineRun) (*CRDWrapper, error)
NewCRDWrapper creates a new wrapper for all required Tekton CRDs.
func (*CRDWrapper) AddLabels ¶
func (crds *CRDWrapper) AddLabels(labels map[string]string)
AddLabels merges the specified labels into the PipelineRun labels.
func (*CRDWrapper) Name ¶
func (crds *CRDWrapper) Name() string
Name returns the name of the Pipeline.
func (*CRDWrapper) ObjectReferences ¶
func (crds *CRDWrapper) ObjectReferences() []kube.ObjectReference
ObjectReferences creates the generic Kube resource metadata.
func (*CRDWrapper) Pipeline ¶
func (crds *CRDWrapper) Pipeline() *pipelineapi.Pipeline
Pipeline returns a pointer to the Tekton Pipeline.
func (*CRDWrapper) PipelineRun ¶
func (crds *CRDWrapper) PipelineRun() *pipelineapi.PipelineRun
PipelineRun returns a pointers to Tekton PipelineRun.
func (*CRDWrapper) Resources ¶
func (crds *CRDWrapper) Resources() []*pipelineapi.PipelineResource
Resources returns an array of pointers to Tekton PipelineResource.
func (*CRDWrapper) String ¶
func (crds *CRDWrapper) String() string
func (*CRDWrapper) Structure ¶
func (crds *CRDWrapper) Structure() *v1.PipelineStructure
Structure returns a pointers to Tekton PipelineStructure.
func (*CRDWrapper) Tasks ¶
func (crds *CRDWrapper) Tasks() []*pipelineapi.Task
Tasks returns an array of pointers to Tekton Tasks.
func (*CRDWrapper) WriteToDisk ¶
func (crds *CRDWrapper) WriteToDisk(dir string, pipelineActivity *kube.PromoteStepActivityKey) error
WriteToDisk writes the Tekton CRDs to disk. All CRDs are created in the specified directory. One YAML file per CRD.
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 BaseSHA string LastCommitMessage string LastCommitURL string GitURL string GitInfo *gits.GitRepository Stages []*StageInfo Type string CreatedTime time.Time }
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 Context string }
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 PipelineType ¶
type PipelineType int
PipelineType is used to differentiate between actual build pipelines and pipelines to create the build pipelines, aka meta pipelines.
const ( // BuildPipeline is the yype for the actual build pipeline BuildPipeline PipelineType = iota // MetaPipeline type for the meta pipeline used to generate the build pipeline MetaPipeline )
func (PipelineType) String ¶
func (s PipelineType) String() string
type PullRefs ¶
PullRefs is the result of parsing the Prow PULL_REFS
func ParsePullRefs ¶
ParsePullRefs parses the Prow PULL_REFS env var formatted string and converts to a map of branch:sha
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 ¶
GetFullChildStageNames gets the fully qualified (i.e., with parents appended) names of each stage underneath this one.
func (*StageInfo) GetStageNameIncludingParents ¶
GetStageNameIncludingParents constructs a full stage name including its parents, if they exist.
Directories ¶
Path | Synopsis |
---|---|
+k8s:deepcopy-gen=package +k8s:openapi-gen=true Package v1 is the v1 version of the API.
|
+k8s:deepcopy-gen=package +k8s:openapi-gen=true Package v1 is the v1 version of the API. |