resources

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

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

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

func ApplyReplacements

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

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, images pipeline.Images) error

ApplyResourceSubstitution applies resource attribute variable substitution.

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 output resources for pt

func GetPipelineConditionStatus

func GetPipelineConditionStatus(pr *v1alpha1.PipelineRun, state PipelineRunState, logger *zap.SugaredLogger, dag *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(pipelineRun *v1alpha1.PipelineRun, getPipeline GetPipeline) (*metav1.ObjectMeta, *v1alpha1.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 *v1alpha1.PipelineRun, getResource resources.GetResource) (map[string]*v1alpha1.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 ResolvePipelineTaskResources added in v0.8.0

func ResolvePipelineTaskResources(pt v1alpha1.PipelineTask, ts *v1alpha1.TaskSpec, taskName string, kind v1alpha1.TaskKind, providedResources map[string]*v1alpha1.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 *v1alpha1.PipelineSpec, pr *v1alpha1.PipelineRun) error

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

func ValidateResourceBindings added in v0.8.0

func ValidateResourceBindings(p *v1alpha1.PipelineSpec, pr *v1alpha1.PipelineRun) error

ValidateResourceBindings validate that the PipelineResources declared in Pipeline p are bound in PipelineRun.

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 GetPipeline added in v0.8.0

type GetPipeline func(string) (v1alpha1.PipelineInterface, error)

GetPipeline is a function used to retrieve Pipelines.

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,
	getCondition GetCondition,
	tasks []v1alpha1.PipelineTask,
	providedResources map[string]*v1alpha1.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) GetNextTasks

func (state PipelineRunState) GetNextTasks(candidateTasks map[string]struct{}) []*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
	// 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() (*v1alpha1.TaskSpec, error)

ConditionToTaskSpec creates a TaskSpec from a given Condition

func (*ResolvedConditionCheck) NewConditionCheckStatus

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

NewConditionCheckStatus 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

IsFailure 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 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