From 6d8f4513213a0a85f5164e0ed13b8a15c1839f89 Mon Sep 17 00:00:00 2001 From: Priti Desai Date: Mon, 4 May 2020 11:07:29 -0700 Subject: [PATCH] updating doc to add note on task results pipeline exits with failure if receiving task can not resolve task results from dependent task. --- docs/pipelines.md | 7 +++++++ pkg/reconciler/pipelinerun/pipelinerun.go | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/pipelines.md b/docs/pipelines.md index 72670ae74fb..b6ae4552844 100644 --- a/docs/pipelines.md +++ b/docs/pipelines.md @@ -540,6 +540,13 @@ params: value: "$(tasks.checkout-source.results.commit)" ``` +**Note:** If `checkout-source` exits successfully without initializing `commit` `Result`, +the receiving `Task` fails and causes the `Pipeline` to fail with `InvalidTaskResultReference`: + +``` +unable to find result referenced by param 'foo' in 'task';: Could not find result with name 'commit' for task run 'checkout-source' +``` + In the snippet below, a `WhenExpression` is provided its value from the `exists` `Result` emitted by the `check-file` `Task`. Tekton will make sure that the `check-file` `Task` runs before this one. diff --git a/pkg/reconciler/pipelinerun/pipelinerun.go b/pkg/reconciler/pipelinerun/pipelinerun.go index d7de1ba69e3..e1cfd65e914 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun.go +++ b/pkg/reconciler/pipelinerun/pipelinerun.go @@ -100,6 +100,9 @@ const ( // ReasonCouldntCancel indicates that a PipelineRun was cancelled but attempting to update // all of the running TaskRuns as cancelled failed. ReasonCouldntCancel = "PipelineRunCouldntCancel" + // ReasonInvalidTaskResultReference indicates a task result was declared + // but was not initialized by that task + ReasonInvalidTaskResultReference = "InvalidTaskResultReference" ) // Reconciler implements controller.Reconciler for Configuration resources. @@ -548,8 +551,8 @@ func (c *Reconciler) runNextSchedulableTask(ctx context.Context, pr *v1beta1.Pip resolvedResultRefs, err := resources.ResolveResultRefs(pipelineRunFacts.State, nextRprts) if err != nil { - logger.Infof("Failed to resolve all task params for %q with error %v", pr.Name, err) - pr.Status.MarkFailed(ReasonFailedValidation, err.Error()) + logger.Infof("Failed to resolve task result reference for %q with error %v", pr.Name, err) + pr.Status.MarkFailed(ReasonInvalidTaskResultReference, err.Error()) return controller.NewPermanentError(err) }