Documentation ¶
Index ¶
- Constants
- func ApplyContexts(spec *v1beta1.PipelineSpec, pipelineName string, pr *v1beta1.PipelineRun) *v1beta1.PipelineSpec
- func ApplyParameters(p *v1beta1.PipelineSpec, pr *v1beta1.PipelineRun) *v1beta1.PipelineSpec
- func ApplyReplacements(p *v1beta1.PipelineSpec, replacements map[string]string, ...) *v1beta1.PipelineSpec
- func ApplyResourceSubstitution(step *v1beta1.Step, ...) error
- func ApplyTaskResults(targets PipelineRunState, resolvedResultRefs ResolvedResultRefs)
- func GetInputSteps(inputs map[string]*resourcev1alpha1.PipelineResource, ...) []v1beta1.TaskResourceBinding
- func GetOutputSteps(outputs map[string]*resourcev1alpha1.PipelineResource, ...) []v1beta1.TaskResourceBinding
- func GetPipelineConditionStatus(pr *v1beta1.PipelineRun, state PipelineRunState, logger *zap.SugaredLogger, ...) *apis.Condition
- func GetPipelineData(ctx context.Context, pipelineRun *v1beta1.PipelineRun, getPipeline GetPipeline) (*metav1.ObjectMeta, *v1beta1.PipelineSpec, error)
- func GetResourcesFromBindings(pr *v1beta1.PipelineRun, getResource resources.GetResource) (map[string]*resourcev1alpha1.PipelineResource, error)
- func GetTaskRunName(taskRunsStatus map[string]*v1beta1.PipelineRunTaskRunStatus, ...) string
- func ResolvePipelineTaskResources(pt v1beta1.PipelineTask, ts *v1beta1.TaskSpec, taskName string, ...) (*resources.ResolvedTaskResources, error)
- func ValidateParamTypesMatching(p *v1beta1.PipelineSpec, pr *v1beta1.PipelineRun) error
- func ValidateRequiredParametersProvided(pipelineParameters *[]v1beta1.ParamSpec, ...) error
- func ValidateResourceBindings(p *v1beta1.PipelineSpec, pr *v1beta1.PipelineRun) error
- func ValidateServiceaccountMapping(p *v1beta1.PipelineSpec, pr *v1beta1.PipelineRun) error
- func ValidateWorkspaceBindings(p *v1beta1.PipelineSpec, pr *v1beta1.PipelineRun) error
- func WrapSteps(tr *v1beta1.TaskRunSpec, pt *v1beta1.PipelineTask, ...)
- type ConditionNotFoundError
- type GetCondition
- type GetPipeline
- type GetTaskRun
- type LocalPipelineRefResolver
- type PipelineRunState
- func (state PipelineRunState) GetFinalTasks(d *dag.Graph, dfinally *dag.Graph) []*ResolvedPipelineRunTask
- func (state PipelineRunState) GetNextTasks(candidateTasks map[string]struct{}) []*ResolvedPipelineRunTask
- func (state PipelineRunState) IsBeforeFirstTaskRun() bool
- func (state PipelineRunState) IsDone() bool
- func (state PipelineRunState) IsStopping(d *dag.Graph) bool
- func (state PipelineRunState) SuccessfulOrSkippedDAGTasks(d *dag.Graph) []string
- func (state PipelineRunState) ToMap() map[string]*ResolvedPipelineRunTask
- type ResolvedConditionCheck
- type ResolvedPipelineRunTask
- func (t ResolvedPipelineRunTask) IsCancelled() bool
- func (t ResolvedPipelineRunTask) IsDone() bool
- func (t ResolvedPipelineRunTask) IsFailure() bool
- func (t ResolvedPipelineRunTask) IsSkipped(state PipelineRunState, d *dag.Graph) bool
- func (t ResolvedPipelineRunTask) IsStarted() bool
- func (t ResolvedPipelineRunTask) IsSuccessful() bool
- type ResolvedResultRef
- type ResolvedResultRefs
- type TaskConditionCheckState
- type TaskNotFoundError
Constants ¶
const ( // ReasonConditionCheckFailed indicates that the reason for the failure status is that the // condition check associated to the pipeline task evaluated to false ReasonConditionCheckFailed = "ConditionCheckFailed" )
Variables ¶
This section is empty.
Functions ¶
func ApplyContexts ¶ added in v0.14.0
func ApplyContexts(spec *v1beta1.PipelineSpec, pipelineName string, pr *v1beta1.PipelineRun) *v1beta1.PipelineSpec
ApplyContexts applies the substitution from $(context.(pipelineRun|pipeline).*) with the specified values. Currently supports only name substitution. Uses "" as a default if name is not specified.
func ApplyParameters ¶
func ApplyParameters(p *v1beta1.PipelineSpec, pr *v1beta1.PipelineRun) *v1beta1.PipelineSpec
ApplyParameters applies the params from a PipelineRun.Params to a PipelineSpec.
func ApplyReplacements ¶
func ApplyReplacements(p *v1beta1.PipelineSpec, replacements map[string]string, arrayReplacements map[string][]string) *v1beta1.PipelineSpec
ApplyReplacements replaces placeholders for declared parameters with the specified replacements.
func ApplyResourceSubstitution ¶
func ApplyResourceSubstitution(step *v1beta1.Step, resolvedResources map[string]*resourcev1alpha1.PipelineResource, conditionResources []v1beta1.ResourceDeclaration, images pipeline.Images) error
ApplyResourceSubstitution applies the substitution from values in resources which are referenced in spec as subitems of the replacementStr.
func ApplyTaskResults ¶ added in v0.11.0
func ApplyTaskResults(targets PipelineRunState, resolvedResultRefs ResolvedResultRefs)
ApplyTaskResults applies the ResolvedResultRef to each PipelineTask.Params in targets
func GetInputSteps ¶
func GetInputSteps(inputs map[string]*resourcev1alpha1.PipelineResource, inputResources []v1beta1.PipelineTaskInputResource, storageBasePath string) []v1beta1.TaskResourceBinding
GetInputSteps will add the correct `path` to the input resources for pt. If the resources are provided by a previous task, the correct `path` will be used so that the resource provided by that task will be used.
func GetOutputSteps ¶
func GetOutputSteps(outputs map[string]*resourcev1alpha1.PipelineResource, taskName, storageBasePath string) []v1beta1.TaskResourceBinding
GetOutputSteps will add the correct `path` to the output resources for pt
func GetPipelineConditionStatus ¶
func GetPipelineConditionStatus(pr *v1beta1.PipelineRun, state PipelineRunState, logger *zap.SugaredLogger, dag *dag.Graph, dfinally *dag.Graph) *apis.Condition
GetPipelineConditionStatus will return the Condition that the PipelineRun prName should be updated with, based on the status of the TaskRuns in state.
func GetPipelineData ¶ added in v0.8.0
func GetPipelineData(ctx context.Context, pipelineRun *v1beta1.PipelineRun, getPipeline GetPipeline) (*metav1.ObjectMeta, *v1beta1.PipelineSpec, error)
GetPipelineData will retrieve the Pipeline metadata and Spec associated with the provided PipelineRun. This can come from a reference Pipeline or from the PipelineRun's metadata and embedded PipelineSpec.
func GetResourcesFromBindings ¶
func GetResourcesFromBindings(pr *v1beta1.PipelineRun, getResource resources.GetResource) (map[string]*resourcev1alpha1.PipelineResource, error)
GetResourcesFromBindings will retrieve all Resources bound in PipelineRun pr and return a map from the declared name of the PipelineResource (which is how the PipelineResource will be referred to in the PipelineRun) to the PipelineResource, obtained via getResource.
func GetTaskRunName ¶ added in v0.13.0
func GetTaskRunName(taskRunsStatus map[string]*v1beta1.PipelineRunTaskRunStatus, ptName, prName string) string
GetTaskRunName should return a unique name for a `TaskRun` if one has not already been defined, and the existing one otherwise.
func ResolvePipelineTaskResources ¶ added in v0.8.0
func ResolvePipelineTaskResources(pt v1beta1.PipelineTask, ts *v1beta1.TaskSpec, taskName string, kind v1beta1.TaskKind, providedResources map[string]*resourcev1alpha1.PipelineResource) (*resources.ResolvedTaskResources, error)
ResolvePipelineTaskResources matches PipelineResources referenced by pt inputs and outputs with the providedResources and returns an instance of ResolvedTaskResources.
func ValidateParamTypesMatching ¶
func ValidateParamTypesMatching(p *v1beta1.PipelineSpec, pr *v1beta1.PipelineRun) error
ValidateParamTypesMatching validate that parameters in PipelineRun override corresponding parameters in Pipeline of the same type.
func ValidateRequiredParametersProvided ¶ added in v0.14.0
func ValidateRequiredParametersProvided(pipelineParameters *[]v1beta1.ParamSpec, pipelineRunParameters *[]v1beta1.Param) error
ValidateRequiredParametersProvided validates that all the parameters expected by the Pipeline are provided by the PipelineRun. Extra Parameters are allowed, the Pipeline will use the Parameters it needs and ignore the other Parameters.
func ValidateResourceBindings ¶ added in v0.8.0
func ValidateResourceBindings(p *v1beta1.PipelineSpec, pr *v1beta1.PipelineRun) error
ValidateResourceBindings validate that the PipelineResources declared in Pipeline p are bound in PipelineRun.
func ValidateServiceaccountMapping ¶ added in v0.13.0
func ValidateServiceaccountMapping(p *v1beta1.PipelineSpec, pr *v1beta1.PipelineRun) error
ValidateServiceaccountMapping validates that the ServiceAccountNames defined by a PipelineRun are not correct.
func ValidateWorkspaceBindings ¶ added in v0.10.0
func ValidateWorkspaceBindings(p *v1beta1.PipelineSpec, pr *v1beta1.PipelineRun) error
ValidateWorkspaceBindings validates that the Workspaces expected by a Pipeline are provided by a PipelineRun.
func WrapSteps ¶
func WrapSteps(tr *v1beta1.TaskRunSpec, pt *v1beta1.PipelineTask, inputs, outputs map[string]*resourcev1alpha1.PipelineResource, storageBasePath string)
WrapSteps will add the correct `paths` to all of the inputs and outputs for pt
Types ¶
type ConditionNotFoundError ¶
ConditionNotFoundError is used to track failures to the
func (*ConditionNotFoundError) Error ¶
func (e *ConditionNotFoundError) Error() string
type GetCondition ¶
GetCondition is a function used to retrieve PipelineConditions.
type GetPipeline ¶ added in v0.8.0
type GetPipeline func(string) (v1beta1.PipelineInterface, error)
GetPipeline is a function used to retrieve Pipelines.
type GetTaskRun ¶
GetTaskRun is a function that will retrieve the TaskRun name.
type LocalPipelineRefResolver ¶ added in v0.12.0
LocalPipelineRefResolver uses the current cluster to resolve a pipeline reference.
func (*LocalPipelineRefResolver) GetPipeline ¶ added in v0.12.0
func (l *LocalPipelineRefResolver) GetPipeline(name string) (v1beta1.PipelineInterface, error)
GetPipeline will resolve a Pipeline from the local cluster using a versioned Tekton client. It will return an error if it can't find an appropriate Pipeline for any reason.
type PipelineRunState ¶
type PipelineRunState []*ResolvedPipelineRunTask
PipelineRunState is a slice of ResolvedPipelineRunTasks the represents the current execution state of the PipelineRun.
func ResolvePipelineRun ¶
func ResolvePipelineRun( ctx context.Context, pipelineRun v1beta1.PipelineRun, getTask resources.GetTask, getTaskRun resources.GetTaskRun, getClusterTask resources.GetClusterTask, getCondition GetCondition, tasks []v1beta1.PipelineTask, providedResources map[string]*resourcev1alpha1.PipelineResource, ) (PipelineRunState, error)
ResolvePipelineRun retrieves all Tasks instances which are reference by tasks, getting instances from getTask. If it is unable to retrieve an instance of a referenced Task, it will return an error, otherwise it returns a list of all of the Tasks retrieved. It will retrieve the Resources needed for the TaskRun using the mapping of providedResources.
func (PipelineRunState) GetFinalTasks ¶ added in v0.14.0
func (state PipelineRunState) GetFinalTasks(d *dag.Graph, dfinally *dag.Graph) []*ResolvedPipelineRunTask
GetFinalTasks returns a list of final tasks without any taskRun associated with it GetFinalTasks returns final tasks only when all DAG tasks have finished executing successfully or skipped or any one DAG task resulted in failure
func (PipelineRunState) GetNextTasks ¶
func (state PipelineRunState) GetNextTasks(candidateTasks map[string]struct{}) []*ResolvedPipelineRunTask
GetNextTasks returns a list of tasks which should be executed next i.e. a list of tasks from candidateTasks which aren't yet indicated in state to be running and a list of cancelled/failed tasks from candidateTasks which haven't exhausted their retries
func (PipelineRunState) IsBeforeFirstTaskRun ¶ added in v0.12.0
func (state PipelineRunState) IsBeforeFirstTaskRun() bool
IsBeforeFirstTaskRun returns true if the PipelineRun has not yet started its first TaskRun
func (PipelineRunState) IsDone ¶
func (state PipelineRunState) IsDone() bool
IsDone returns true when all pipeline tasks have respective taskRun created and that taskRun has either succeeded or failed after all possible retry attempts
func (PipelineRunState) IsStopping ¶ added in v0.14.0
func (state PipelineRunState) IsStopping(d *dag.Graph) bool
IsStopping returns true if the PipelineRun won't be scheduling any new Task because at least one task already failed or was cancelled in the specified dag
func (PipelineRunState) SuccessfulOrSkippedDAGTasks ¶ added in v0.14.0
func (state PipelineRunState) SuccessfulOrSkippedDAGTasks(d *dag.Graph) []string
SuccessfulOrSkippedDAGTasks returns a list of the names of all of the PipelineTasks in state which have successfully completed or skipped
func (PipelineRunState) ToMap ¶ added in v0.11.0
func (state PipelineRunState) ToMap() map[string]*ResolvedPipelineRunTask
ToMap returns a map that maps pipeline task name to the resolved pipeline run task
type ResolvedConditionCheck ¶
type ResolvedConditionCheck struct { ConditionRegisterName string PipelineTaskCondition *v1beta1.PipelineTaskCondition ConditionCheckName string Condition *v1alpha1.Condition ConditionCheck *v1beta1.ConditionCheck // Resolved resources is a map of pipeline resources for this condition // keyed by the bound resource name (i.e. the name used in PipelineTaskCondition.Resources) ResolvedResources map[string]*resourcev1alpha1.PipelineResource // contains filtered or unexported fields }
ResolvedConditionCheck contains a Condition and its associated ConditionCheck, if it exists. ConditionCheck can be nil to represent there being no ConditionCheck (i.e the condition has not been evaluated).
func (*ResolvedConditionCheck) ConditionToTaskSpec ¶
func (rcc *ResolvedConditionCheck) ConditionToTaskSpec() (*v1beta1.TaskSpec, error)
ConditionToTaskSpec creates a TaskSpec from a given Condition
func (*ResolvedConditionCheck) NewConditionCheckStatus ¶
func (rcc *ResolvedConditionCheck) NewConditionCheckStatus() *v1beta1.ConditionCheckStatus
NewConditionCheckStatus creates a ConditionCheckStatus from a ConditionCheck
func (*ResolvedConditionCheck) ToTaskResourceBindings ¶
func (rcc *ResolvedConditionCheck) ToTaskResourceBindings() []v1beta1.TaskResourceBinding
type ResolvedPipelineRunTask ¶
type ResolvedPipelineRunTask struct { TaskRunName string TaskRun *v1beta1.TaskRun PipelineTask *v1beta1.PipelineTask ResolvedTaskResources *resources.ResolvedTaskResources // ConditionChecks ~~TaskRuns but for evaling conditions ResolvedConditionChecks TaskConditionCheckState // Could also be a TaskRun or maybe just a Pod? }
ResolvedPipelineRunTask contains a Task and its associated TaskRun, if it exists. TaskRun can be nil to represent there being no TaskRun.
func (ResolvedPipelineRunTask) IsCancelled ¶ added in v0.11.0
func (t ResolvedPipelineRunTask) IsCancelled() bool
IsCancelled returns true only if the taskrun itself has cancelled
func (ResolvedPipelineRunTask) IsDone ¶
func (t ResolvedPipelineRunTask) IsDone() bool
func (ResolvedPipelineRunTask) IsFailure ¶
func (t ResolvedPipelineRunTask) IsFailure() bool
IsFailure returns true only if the taskrun itself has failed
func (ResolvedPipelineRunTask) IsSkipped ¶ added in v0.14.0
func (t ResolvedPipelineRunTask) IsSkipped(state PipelineRunState, d *dag.Graph) bool
IsSkipped returns true if a PipelineTask will not be run because (1) its Condition Checks failed or (2) one of the parent task's conditions failed or (3) Pipeline is in stopping state (one of the PipelineTasks failed) Note that this means IsSkipped returns false if a conditionCheck is in progress
func (ResolvedPipelineRunTask) IsStarted ¶ added in v0.14.0
func (t ResolvedPipelineRunTask) IsStarted() bool
IsStarted returns true only if the PipelineRunTask itself has a TaskRun associated
func (ResolvedPipelineRunTask) IsSuccessful ¶
func (t ResolvedPipelineRunTask) IsSuccessful() bool
IsSuccessful returns true only if the taskrun itself has completed successfully
type ResolvedResultRef ¶ added in v0.11.0
type ResolvedResultRef struct { Value v1beta1.ArrayOrString ResultReference v1beta1.ResultRef FromTaskRun string }
ResolvedResultRef represents a result ref reference that has been fully resolved (value has been populated). If the value is from a Result, then the ResultReference will be populated to point to the ResultReference which resulted in the value
type ResolvedResultRefs ¶ added in v0.11.0
type ResolvedResultRefs []*ResolvedResultRef
ResolvedResultRefs represents all of the ResolvedResultRef for a pipeline task
func ResolvePipelineResultRefs ¶ added in v0.13.0
func ResolvePipelineResultRefs(pipelineStatus v1beta1.PipelineRunStatus, pipelineResults []v1beta1.PipelineResult) ResolvedResultRefs
ResolvePipelineResultRefs takes a list of PipelineResults and resolves any references they include to Task results in the given PipelineRunStatus
func ResolveResultRefs ¶ added in v0.11.0
func ResolveResultRefs(pipelineRunState PipelineRunState, targets PipelineRunState) (ResolvedResultRefs, error)
ResolveResultRefs resolves any ResultReference that are found in the target ResolvedPipelineRunTask
type TaskConditionCheckState ¶
type TaskConditionCheckState []*ResolvedConditionCheck
TaskConditionCheckState is a slice of ResolvedConditionCheck the represents the current execution state of Conditions for a Task in a pipeline run.
func (TaskConditionCheckState) HasStarted ¶
func (state TaskConditionCheckState) HasStarted() bool
HasStarted returns true if the conditionChecks for a given object have been created
func (TaskConditionCheckState) IsDone ¶
func (state TaskConditionCheckState) IsDone() bool
IsDone returns true if the status for all conditionChecks for a task indicate that they are done
func (TaskConditionCheckState) IsSuccess ¶
func (state TaskConditionCheckState) IsSuccess() bool
IsSuccess returns true if the status for all conditionChecks for a task indicate they have completed successfully
type TaskNotFoundError ¶
TaskNotFoundError indicates that the resolution failed because a referenced Task couldn't be retrieved
func (*TaskNotFoundError) Error ¶
func (e *TaskNotFoundError) Error() string