Documentation ¶
Overview ¶
Package resources provides methods to convert a Build CRD to a k8s Pod resource.
Index ¶
- func AddInputResource(build *buildv1alpha1.Build, taskName string, taskSpec *v1alpha1.TaskSpec, ...) (*buildv1alpha1.Build, error)
- func AddOutputResources(b *buildv1alpha1.Build, taskName string, taskSpec *v1alpha1.TaskSpec, ...) error
- func ApplyParameters(b *buildv1alpha1.Build, tr *v1alpha1.TaskRun, defaults ...v1alpha1.TaskParam) *buildv1alpha1.Build
- func ApplyReplacements(build *buildv1alpha1.Build, replacements map[string]string) *buildv1alpha1.Build
- func ApplyResources(b *buildv1alpha1.Build, resources []v1alpha1.TaskResourceBinding, ...) (*buildv1alpha1.Build, error)
- func BuildStatusFromPod(p *corev1.Pod, buildSpec v1alpha1.BuildSpec) v1alpha1.BuildStatus
- func GetPVCVolume(name string) corev1.Volume
- func GetTaskSpec(taskRunSpec *v1alpha1.TaskRunSpec, taskRunName string, getTask GetTask) (*v1alpha1.TaskSpec, string, error)
- func MakePod(build *v1alpha1.Build, kubeclient kubernetes.Interface) (*corev1.Pod, error)
- type GetClusterTask
- type GetResource
- type GetTask
- type ResolvedTaskResources
- type ResourceGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddInputResource ¶
func AddInputResource( build *buildv1alpha1.Build, taskName string, taskSpec *v1alpha1.TaskSpec, taskRun *v1alpha1.TaskRun, pipelineResourceLister listers.PipelineResourceLister, logger *zap.SugaredLogger, ) (*buildv1alpha1.Build, error)
AddInputResource reads the inputs resources and adds the corresponding container steps This function reads the `paths` to check if resource copies needs to be fetched from previous tasks output(from PVC) 1. If resource has paths declared then serially copies the resource from previous task output paths into current resource destination. 2. If resource has custom destination directory using targetPath then that directory is created and resource is fetched / copied from previous task 3. If resource has paths declared then fresh copy of resource is not fetched
func AddOutputResources ¶
func AddOutputResources( b *buildv1alpha1.Build, taskName string, taskSpec *v1alpha1.TaskSpec, taskRun *v1alpha1.TaskRun, pipelineResourceLister listers.PipelineResourceLister, logger *zap.SugaredLogger, ) error
AddOutputResources reads the output resources and adds the corresponding container steps This function also reads the inputs to check if resources are redeclared in inputs and has any custom target directory. Steps executed:
- If taskrun has owner reference as pipelinerun then all outputs are copied to parents PVC
and also runs any custom upload steps (upload to blob store)
- If taskrun does not have pipelinerun as owner reference then all outputs resources execute their custom
upload steps (like upload to blob store )
Resource source path determined 1. If resource is declared in inputs then target path from input resource is used to identify source path 2. If resource is declared in outputs only then the default is /output/resource_name
func ApplyParameters ¶
func ApplyParameters(b *buildv1alpha1.Build, tr *v1alpha1.TaskRun, defaults ...v1alpha1.TaskParam) *buildv1alpha1.Build
ApplyParameters applies the params from a TaskRun.Input.Parameters to a BuildSpec.
func ApplyReplacements ¶
func ApplyReplacements(build *buildv1alpha1.Build, replacements map[string]string) *buildv1alpha1.Build
ApplyReplacements replaces placeholders for declared parameters with the specified replacements.
func ApplyResources ¶
func ApplyResources(b *buildv1alpha1.Build, resources []v1alpha1.TaskResourceBinding, getter ResourceGetter, replacementStr string) (*buildv1alpha1.Build, error)
ApplyResources applies the templating from values in resources which are referenced in b as subitems of the replacementStr. It retrieves the referenced resources via the getter.
func BuildStatusFromPod ¶
BuildStatusFromPod returns a BuildStatus based on the Pod and the original BuildSpec.
func GetPVCVolume ¶
GetPVCVolume gets pipelinerun pvc volume
func GetTaskSpec ¶
func GetTaskSpec(taskRunSpec *v1alpha1.TaskRunSpec, taskRunName string, getTask GetTask) (*v1alpha1.TaskSpec, string, error)
GetTaskSpec will retrieve the Task Spec associated with the provieded TaskRun. This can come from a reference Task or from an embedded Task spec.
Types ¶
type GetClusterTask ¶
type GetClusterTask func(name string) (v1alpha1.TaskInterface, error)
GetClusterTask is a function that will retrieve the Task from name and namespace.
type GetResource ¶
type GetResource func(string) (*v1alpha1.PipelineResource, error)
GetResource is a function used to retrieve PipelineResources.
type GetTask ¶
type GetTask func(string) (v1alpha1.TaskInterface, error)
GetTask is a function used to retrieve Tasks.
type ResolvedTaskResources ¶
type ResolvedTaskResources struct { TaskName string TaskSpec *v1alpha1.TaskSpec // Inputs is a map from the name of the input required by the Task // to the actual Resource to use for it Inputs map[string]*v1alpha1.PipelineResource // Outputs is a map from the name of the output required by the Task // to the actual Resource to use for it Outputs map[string]*v1alpha1.PipelineResource }
ResolvedTaskResources contains all the data that is needed to execute the TaskRun: the TaskRun, it's Task and the PipelineResources it needs.
func ResolveTaskResources ¶
func ResolveTaskResources(ts *v1alpha1.TaskSpec, taskName string, inputs []v1alpha1.TaskResourceBinding, outputs []v1alpha1.TaskResourceBinding, gr GetResource) (*ResolvedTaskResources, error)
ResolveTaskResources looks up PipelineResources referenced by inputs and outputs and returns a structure that unites the resolved references nad the Task Spec. If referenced PipelineResources can't be found, an error is returned.
type ResourceGetter ¶
type ResourceGetter interface {
Get(string) (*v1alpha1.PipelineResource, error)
}
ResourceGetter is the interface used to retrieve resources which are references via a TaskRunResource.