Skip to content

Commit

Permalink
Fix Wrong Condition Reason When Fails to Stop Sidecars for A Finished…
Browse files Browse the repository at this point in the history
… TaskRun

Prior to this commit, if a TaskRun fails to stop sidecars, the
failure reason is `TaskRunResolutionFailed` which does not make
sense at all. This commit creates a new reason for StopSideCar
failure, and fix the wrong condition reason.
  • Loading branch information
XinruZhang authored and tekton-robot committed Dec 20, 2022
1 parent d8c4909 commit 2f69f1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/apis/pipeline/v1beta1/taskrun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ const (
AwaitingTaskRunResults TaskRunReason = "AwaitingTaskRunResults"
// TaskRunReasonResultLargerThanAllowedLimit is the reason set when one of the results exceeds its maximum allowed limit of 1 KB
TaskRunReasonResultLargerThanAllowedLimit TaskRunReason = "TaskRunResultLargerThanAllowedLimit"
// TaskRunReasonStopSidecarFailed indicates that the sidecar is not properly stopped.
TaskRunReasonStopSidecarFailed = "TaskRunStopSidecarFailed"
)

func (t TaskRunReason) String() string {
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/taskrun/taskrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func (c *Reconciler) stopSidecars(ctx context.Context, tr *v1beta1.TaskRun) erro
return controller.NewPermanentError(err)
} else if err != nil {
logger.Errorf("Error stopping sidecars for TaskRun %q: %v", tr.Name, err)
tr.Status.MarkResourceFailed(podconvert.ReasonFailedResolution, err)
tr.Status.MarkResourceFailed(v1beta1.TaskRunReasonStopSidecarFailed, err)
}
return nil
}
Expand Down

0 comments on commit 2f69f1e

Please sign in to comment.