diff --git a/docs/pipeline-api.md b/docs/pipeline-api.md index ce318432829..f8877036756 100644 --- a/docs/pipeline-api.md +++ b/docs/pipeline-api.md @@ -2005,6 +2005,10 @@ associated Pipeline is an invalid graph (a.k.a wrong order, cycle, …)

"InvalidParamValue"

PipelineRunReasonInvalidParamValue indicates that the PipelineRun Param input value is not allowed.

+

"InvalidPipelineResultReference"

+

PipelineRunReasonInvalidPipelineResultReference indicates a pipeline result was declared +by the pipeline but not initialized in the pipelineTask

+

"InvalidTaskResultReference"

ReasonInvalidTaskResultReference indicates a task result was declared but was not initialized by that task

diff --git a/pkg/apis/pipeline/v1/pipelinerun_types.go b/pkg/apis/pipeline/v1/pipelinerun_types.go index 34be57243ae..1cc3b2e6dbc 100644 --- a/pkg/apis/pipeline/v1/pipelinerun_types.go +++ b/pkg/apis/pipeline/v1/pipelinerun_types.go @@ -399,6 +399,9 @@ const ( // ReasonInvalidTaskResultReference indicates a task result was declared // but was not initialized by that task PipelineRunReasonInvalidTaskResultReference PipelineRunReason = "InvalidTaskResultReference" + // PipelineRunReasonInvalidPipelineResultReference indicates a pipeline result was declared + // by the pipeline but not initialized in the pipelineTask + PipelineRunReasonInvalidPipelineResultReference PipelineRunReason = "InvalidPipelineResultReference" // ReasonRequiredWorkspaceMarkedOptional indicates an optional workspace // has been passed to a Task that is expecting a non-optional workspace PipelineRunReasonRequiredWorkspaceMarkedOptional PipelineRunReason = "RequiredWorkspaceMarkedOptional" diff --git a/pkg/reconciler/pipelinerun/pipelinerun.go b/pkg/reconciler/pipelinerun/pipelinerun.go index 2b2b85d174d..be490387bc5 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun.go +++ b/pkg/reconciler/pipelinerun/pipelinerun.go @@ -678,8 +678,10 @@ func (c *Reconciler) reconcile(ctx context.Context, pr *v1.PipelineRun, getPipel } if err := resources.ValidatePipelineResults(pipelineSpec, pipelineRunFacts.State); err != nil { - logger.Errorf("Failed to resolve task result reference for %q with error %v", pr.Name, err) - pr.Status.MarkFailed(v1.PipelineRunReasonInvalidTaskResultReference.String(), err.Error()) + logger.Errorf("Failed to resolve pipeline result reference for %q with error %w", pr.Name, err) + pr.Status.MarkFailed(v1.PipelineRunReasonInvalidPipelineResultReference.String(), + "Failed to resolve pipeline result reference for %q with error %w", + pr.Name, err) return controller.NewPermanentError(err) } diff --git a/pkg/reconciler/pipelinerun/pipelinerun_test.go b/pkg/reconciler/pipelinerun/pipelinerun_test.go index 85c78191d30..81b0311fca0 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun_test.go +++ b/pkg/reconciler/pipelinerun/pipelinerun_test.go @@ -7854,7 +7854,7 @@ spec: reason: v1.PipelineRunReasonInvalidTaskResultReference.String(), }, { name: "pipelinerun-pipeline-result-invalid-result-variable", - reason: v1.PipelineRunReasonInvalidTaskResultReference.String(), + reason: v1.PipelineRunReasonInvalidPipelineResultReference.String(), }, { name: "pipelinerun-with-optional-workspace-validation", reason: v1.PipelineRunReasonRequiredWorkspaceMarkedOptional.String(),