From b69347d97e99dc2ca60892925e32d4a0a3e24d3a Mon Sep 17 00:00:00 2001
From: JeromeJu
"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 32c3254e54c..ae28207ffaa 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun.go +++ b/pkg/reconciler/pipelinerun/pipelinerun.go @@ -686,8 +686,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 a9c2b462d30..6a1dd43cca2 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun_test.go +++ b/pkg/reconciler/pipelinerun/pipelinerun_test.go @@ -7858,7 +7858,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(),