Skip to content

Commit

Permalink
Error sweep: correct InvalidPipelineResultReference failure reason
Browse files Browse the repository at this point in the history
This commit corrects the PipelineRunReason which previously indicates
the invalid TaskResultReference to be its actual meaning which should be
InvalidPipelineResultReference.

/kind cleanup
  • Loading branch information
JeromeJu committed Dec 5, 2023
1 parent 2387dd4 commit 0564465
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions docs/pipeline-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,11 @@ all of the running TaskRuns as cancelled failed.</p>
<td><p>ReasonCouldntGetPipeline indicates that the reason for the failure status is that the
associated Pipeline couldn&rsquo;t be retrieved</p>
</td>
</tr><tr><td><p>&#34;CouldntGetPipelineResult&#34;</p></td>
<td><p>PipelineRunReasonCouldntGetPipelineResult indicates that the pipeline fails to retrieve the
referenced result. This could be due to failed TaskRuns or Runs that were supposed to produce
the results</p>
</td>
</tr><tr><td><p>&#34;CouldntGetTask&#34;</p></td>
<td><p>ReasonCouldntGetTask indicates that the reason for the failure status is that the
associated Pipeline&rsquo;s Tasks couldn&rsquo;t all be retrieved</p>
Expand Down Expand Up @@ -1997,6 +2002,10 @@ associated Pipeline is an invalid graph (a.k.a wrong order, cycle, …)</p>
</tr><tr><td><p>&#34;InvalidMatrixParameterTypes&#34;</p></td>
<td><p>ReasonInvalidMatrixParameterTypes indicates a matrix contains invalid parameter types</p>
</td>
</tr><tr><td><p>&#34;InvalidPipelineResultReference&#34;</p></td>
<td><p>ReasonInvalidPipelineResultReference indicates a pipeline result was declared
but was not initialized by that task</p>
</td>
</tr><tr><td><p>&#34;InvalidTaskResultReference&#34;</p></td>
<td><p>ReasonInvalidTaskResultReference indicates a task result was declared
but was not initialized by that task</p>
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/pipeline/v1/pipelinerun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,9 @@ const (
// ReasonInvalidTaskResultReference indicates a task result was declared
// but was not initialized by that task
PipelineRunReasonInvalidTaskResultReference PipelineRunReason = "InvalidTaskResultReference"
// ReasonInvalidPipelineResultReference indicates a pipeline result was declared
// but was not initialized by that task
PipelineRunReasonInvalidPipelineResultReference PipelineRunReason = "InvalidPipelineResultReference"
// ReasonRequiredWorkspaceMarkedOptional indicates an optional workspace
// has been passed to a Task that is expecting a non-optional workspace
PipelineRunReasonRequiredWorkspaceMarkedOptional PipelineRunReason = "RequiredWorkspaceMarkedOptional"
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/pipelinerun/pipelinerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,8 @@ 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(), err.Error())
return controller.NewPermanentError(err)
}

Expand Down

0 comments on commit 0564465

Please sign in to comment.