resources

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2019 License: Apache-2.0 Imports: 13 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"
)

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) *v1alpha1.Pipeline

ApplyReplacements replaces placeholders for declared parameters with the specified replacements.

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(prName string, state PipelineRunState, logger *zap.SugaredLogger, startTime *metav1.Time,
	pipelineTimeout *metav1.Duration) *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 ResolveTaskRuns

func ResolveTaskRuns(getTaskRun GetTaskRun, state PipelineRunState) error

ResolveTaskRuns will go through all tasks in state and check if there are existing TaskRuns for each of them by calling getTaskRun.

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

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

GetTaskRun is a function that will retrieve the TaskRun name.

type PipelineRunState added in v0.2.0

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,
	getClusterTask resources.GetClusterTask,
	getResource resources.GetResource,
	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 added in v0.2.0

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) SuccessfulPipelineTaskNames added in v0.2.0

func (state PipelineRunState) SuccessfulPipelineTaskNames() []string

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

type ResolvedPipelineRunTask

type ResolvedPipelineRunTask struct {
	TaskRunName           string
	TaskRun               *v1alpha1.TaskRun
	PipelineTask          *v1alpha1.PipelineTask
	ResolvedTaskResources *resources.ResolvedTaskResources
}

ResolvedPipelineRunTask contains a Task and its associated TaskRun, if it exists. TaskRun can be nil to represent there being no TaskRun.

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