Documentation ¶
Overview ¶
Package resources provides methods to convert a Build CRD to a k8s Pod resource.
Index ¶
- Constants
- func AddInputResource(kubeclient kubernetes.Interface, taskName string, taskSpec *v1alpha1.TaskSpec, ...) (*v1alpha1.TaskSpec, error)
- func AddOutputImageDigestExporter(tr *v1alpha1.TaskRun, taskSpec *v1alpha1.TaskSpec, gr GetResource) error
- func AddOutputResources(kubeclient kubernetes.Interface, taskName string, taskSpec *v1alpha1.TaskSpec, ...) (*v1alpha1.TaskSpec, error)
- func AddReadyAnnotation(p *corev1.Pod, update UpdatePod) error
- func ApplyParameters(spec *v1alpha1.TaskSpec, tr *v1alpha1.TaskRun, defaults ...v1alpha1.ParamSpec) *v1alpha1.TaskSpec
- func ApplyReplacements(spec *v1alpha1.TaskSpec, replacements map[string]string) *v1alpha1.TaskSpec
- func ApplyResources(spec *v1alpha1.TaskSpec, ...) *v1alpha1.TaskSpec
- func GetPVCVolume(name string) corev1.Volume
- func GetTaskData(taskRun *v1alpha1.TaskRun, getTask GetTask) (*metav1.ObjectMeta, *v1alpha1.TaskSpec, error)
- func IsContainerStep(name string) bool
- func MakePod(taskRun *v1alpha1.TaskRun, taskSpec v1alpha1.TaskSpec, ...) (*corev1.Pod, error)
- func TaskRunHasOutputImageResource(gr GetResource, taskRun *v1alpha1.TaskRun) bool
- func TrimContainerNamePrefix(containerName string) string
- func TryGetPod(taskRunStatus v1alpha1.TaskRunStatus, gp GetPod) (*corev1.Pod, error)
- func UpdateTaskRunStatusWithResourceResult(taskRun *v1alpha1.TaskRun, logContent []byte) error
- type GetClusterTask
- type GetPod
- type GetResource
- type GetTask
- type GetTaskRun
- type ResolvedTaskResources
- type UpdatePod
Constants ¶
const (
ReadyAnnotation = "tekton.dev/ready"
)
const TerminationMessagePath = "/builder/home/image-outputs/termination-log"
Variables ¶
This section is empty.
Functions ¶
func AddInputResource ¶
func AddInputResource( kubeclient kubernetes.Interface, taskName string, taskSpec *v1alpha1.TaskSpec, taskRun *v1alpha1.TaskRun, inputResources map[string]v1alpha1.PipelineResourceInterface, logger *zap.SugaredLogger, ) (*v1alpha1.TaskSpec, 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 AddOutputImageDigestExporter ¶ added in v0.4.0
func AddOutputImageDigestExporter( tr *v1alpha1.TaskRun, taskSpec *v1alpha1.TaskSpec, gr GetResource, ) error
AddOutputImageDigestExporter add a step to check the index.json for all output images
func AddOutputResources ¶
func AddOutputResources( kubeclient kubernetes.Interface, taskName string, taskSpec *v1alpha1.TaskSpec, taskRun *v1alpha1.TaskRun, outputResources map[string]v1alpha1.PipelineResourceInterface, logger *zap.SugaredLogger, ) (*v1alpha1.TaskSpec, 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 AddReadyAnnotation ¶ added in v0.5.0
AddReadyAnnotation adds the ready annotation if it is not present. Returns any error that comes back from the passed-in update func.
func ApplyParameters ¶
func ApplyParameters(spec *v1alpha1.TaskSpec, tr *v1alpha1.TaskRun, defaults ...v1alpha1.ParamSpec) *v1alpha1.TaskSpec
ApplyParameters applies the params from a TaskRun.Input.Parameters to a TaskSpec
func ApplyReplacements ¶
ApplyReplacements replaces placeholders for declared parameters with the specified replacements.
func ApplyResources ¶
func ApplyResources(spec *v1alpha1.TaskSpec, resolvedResources map[string]v1alpha1.PipelineResourceInterface, replacementStr string) *v1alpha1.TaskSpec
ApplyResources applies the templating from values in resources which are referenced in spec as subitems of the replacementStr.
func GetPVCVolume ¶
GetPVCVolume gets pipelinerun pvc volume
func GetTaskData ¶
func GetTaskData(taskRun *v1alpha1.TaskRun, getTask GetTask) (*metav1.ObjectMeta, *v1alpha1.TaskSpec, error)
GetTaskData will retrieve the Task metadata and Spec associated with the provided TaskRun. This can come from a reference Task or from the TaskRun's metadata and embedded TaskSpec.
func IsContainerStep ¶ added in v0.5.0
func MakePod ¶
func MakePod(taskRun *v1alpha1.TaskRun, taskSpec v1alpha1.TaskSpec, kubeclient kubernetes.Interface, cache *entrypoint.Cache, logger *zap.SugaredLogger) (*corev1.Pod, error)
MakePod converts TaskRun and TaskSpec objects to a Pod which implements the taskrun specified by the supplied CRD.
func TaskRunHasOutputImageResource ¶ added in v0.4.0
func TaskRunHasOutputImageResource(gr GetResource, taskRun *v1alpha1.TaskRun) bool
TaskRunHasOutputImageResource return true if the task has any output resources of type image
func TrimContainerNamePrefix ¶ added in v0.3.0
TrimContainerNamePrefix trim the container name prefix to get the corresponding step name
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 Kind v1alpha1.TaskKind 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, kind v1alpha1.TaskKind, 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 and the Task Spec. If referenced PipelineResources can't be found, an error is returned.