resources

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: Apache-2.0 Imports: 12 Imported by: 13

Documentation

Index

Constants

View Source
const (
	// ReasonRunning indicates that the reason for the inprogress status is that the TaskRun
	// is just starting to be reconciled
	ReasonRunning = "Running"

	// ReasonFailed indicates that the reason for the failure status is that one of the TaskRuns failed
	ReasonFailed = "Failed"

	// ReasonSucceeded indicates that the reason for the finished status is that all of the TaskRuns
	// completed successfully
	ReasonSucceeded = "Succeeded"

	// ReasonTimedOut indicates that the PipelineRun has taken longer than its configured
	// timeout
	ReasonTimedOut = "PipelineRunTimeout"

	// 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 ApplyParameters

func ApplyParameters(p *v1alpha1.Pipeline, pr *v1alpha1.PipelineRun) *v1alpha1.Pipeline

ApplyParameters applies the params from a PipelineRun.Params to a PipelineSpec.

func ApplyReplacements

func ApplyReplacements(p *v1alpha1.Pipeline, replacements map[string]string, arrayReplacements map[string][]string) *v1alpha1.Pipeline

ApplyReplacements replaces placeholders for declared parameters with the specified replacements.

func ApplyResourceSubstitution

func ApplyResourceSubstitution(step *v1alpha1.Step, resolvedResources map[string]*v1alpha1.PipelineResource, conditionResources []v1alpha1.ResourceDeclaration) error

ApplyResources applies the substitution from values in resources which are referenced in spec as subitems of the replacementStr.

func GetInputSteps

func GetInputSteps(inputs map[string]*v1alpha1.PipelineResource, pt *v1alpha1.PipelineTask, storageBasePath string) []v1alpha1.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]*v1alpha1.PipelineResource, taskName, storageBasePath string) []v1alpha1.TaskResourceBinding

GetOutputSteps will add the correct `path` to the input resources for pt

func GetPipelineConditionStatus

func GetPipelineConditionStatus(pr *v1alpha1.PipelineRun, state PipelineRunState, logger *zap.SugaredLogger, dag *v1alpha1.DAG) *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 GetResourcesFromBindings

func GetResourcesFromBindings(p *v1alpha1.Pipeline, pr *v1alpha1.PipelineRun) (map[string]v1alpha1.PipelineResourceRef, error)

GetResourcesFromBindings will validate that all PipelineResources declared in Pipeline p are bound in PipelineRun pr and if so, will return a map from the declared name of the PipelineResource (which is how the PipelineResource will be referred to in the PipelineRun) to the ResourceRef.

func ValidateFrom

func ValidateFrom(state PipelineRunState) error

ValidateFrom will look at any `from` clauses in the resolved PipelineRun state and validate it: the `from` must specify an input of the current `Task`. The `PipelineTask` it corresponds to must actually exist in the `Pipeline`. The `PipelineResource` that is bound to the input must be the same `PipelineResource` that was bound to the output of the previous `Task`. If the state is not valid, it will return an error.

func ValidateParamTypesMatching

func ValidateParamTypesMatching(p *v1alpha1.Pipeline, pr *v1alpha1.PipelineRun) error

Validate that parameters in PipelineRun override corresponding parameters in Pipeline of the same type.

func WrapSteps

func WrapSteps(tr *v1alpha1.TaskRunSpec, pt *v1alpha1.PipelineTask, inputs, outputs map[string]*v1alpha1.PipelineResource, storageBasePath string)

WrapSteps will add the correct `paths` to all of the inputs and outputs for pt

Types

type ConditionNotFoundError

type ConditionNotFoundError struct {
	Name string
	Msg  string
}

func (*ConditionNotFoundError) Error

func (e *ConditionNotFoundError) Error() string

type GetCondition

type GetCondition func(string) (*v1alpha1.Condition, error)

GetCondition is a function used to retrieve PipelineConditions.

type GetTaskRun

type GetTaskRun func(name string) (*v1alpha1.TaskRun, error)

GetTaskRun is a function that will retrieve the TaskRun name.

type PipelineRunState

type PipelineRunState []*ResolvedPipelineRunTask

PipelineRunState is a slice of ResolvedPipelineRunTasks the represents the current execution state of the PipelineRun.

func ResolvePipelineRun

func ResolvePipelineRun(
	pipelineRun v1alpha1.PipelineRun,
	getTask resources.GetTask,
	getTaskRun resources.GetTaskRun,
	getClusterTask resources.GetClusterTask,
	getResource resources.GetResource,
	getCondition GetCondition,
	tasks []v1alpha1.PipelineTask,
	providedResources map[string]v1alpha1.PipelineResourceRef,
) (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 as well using getResource and the mapping of providedResources.

func (PipelineRunState) GetNextTasks

func (state PipelineRunState) GetNextTasks(candidateTasks map[string]v1alpha1.PipelineTask) []*ResolvedPipelineRunTask

GetNextTasks will return the next ResolvedPipelineRunTasks to execute, which are the ones in the list of candidateTasks which aren't yet indicated in state to be running.

func (PipelineRunState) IsDone

func (state PipelineRunState) IsDone() (isDone bool)

func (PipelineRunState) SuccessfulPipelineTaskNames

func (state PipelineRunState) SuccessfulPipelineTaskNames() []string

SuccessfulPipelineTaskNames returns a list of the names of all of the PipelineTasks in state which have successfully completed.

type ResolvedConditionCheck

type ResolvedConditionCheck struct {
	PipelineTaskCondition *v1alpha1.PipelineTaskCondition
	ConditionCheckName    string
	Condition             *v1alpha1.Condition
	ConditionCheck        *v1alpha1.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]*v1alpha1.PipelineResource
}

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

ConditionToTaskSpec creates a TaskSpec from a given Condition

func (*ResolvedConditionCheck) NewConditionCheckStatus

func (rcc *ResolvedConditionCheck) NewConditionCheckStatus() *v1alpha1.ConditionCheckStatus

NewConditionCheck status creates a ConditionCheckStatus from a ConditionCheck

func (*ResolvedConditionCheck) ToTaskResourceBindings

func (rcc *ResolvedConditionCheck) ToTaskResourceBindings() []v1alpha1.TaskResourceBinding

type ResolvedPipelineRunTask

type ResolvedPipelineRunTask struct {
	TaskRunName           string
	TaskRun               *v1alpha1.TaskRun
	PipelineTask          *v1alpha1.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) IsDone

func (t ResolvedPipelineRunTask) IsDone() (isDone bool)

func (ResolvedPipelineRunTask) IsFailure

func (t ResolvedPipelineRunTask) IsFailure() bool

IsFailed returns true only if the taskrun itself has failed

func (ResolvedPipelineRunTask) IsSuccessful

func (t ResolvedPipelineRunTask) IsSuccessful() bool

IsSuccessful returns true only if the taskrun itself has completed successfully

type ResourceNotFoundError

type ResourceNotFoundError struct {
	Msg string
}

ResourceNotFoundError indicates that the resolution failed because a referenced PipelineResource couldn't be retrieved

func (*ResourceNotFoundError) Error

func (e *ResourceNotFoundError) Error() string

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

IsComplete returns true if the status for all conditionChecks for a task indicate that they are done

func (TaskConditionCheckState) IsSuccess

func (state TaskConditionCheckState) IsSuccess() bool

IsComplete returns true if the status for all conditionChecks for a task indicate they have completed successfully

type TaskNotFoundError

type TaskNotFoundError struct {
	Name string
	Msg  string
}

TaskNotFoundError indicates that the resolution failed because a referenced Task couldn't be retrieved

func (*TaskNotFoundError) Error

func (e *TaskNotFoundError) Error() string

Jump to

Keyboard shortcuts

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