From 2b3a0dbcab32b277699ae28a99ae9168fa9792a3 Mon Sep 17 00:00:00 2001 From: pritidesai Date: Wed, 9 Feb 2022 14:14:36 -0800 Subject: [PATCH] call MarkResource* instead of updating the status A very simple cleanup to utilize the common utility to update the taskRun status instead of setting the condition explicitly. No functional change expected. --- pkg/reconciler/taskrun/taskrun.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/pkg/reconciler/taskrun/taskrun.go b/pkg/reconciler/taskrun/taskrun.go index e7e837404df..d0bde269170 100644 --- a/pkg/reconciler/taskrun/taskrun.go +++ b/pkg/reconciler/taskrun/taskrun.go @@ -274,12 +274,7 @@ func (c *Reconciler) prepare(ctx context.Context, tr *v1beta1.TaskRun) (*v1beta1 getTaskfunc, err := resources.GetTaskFuncFromTaskRun(ctx, c.KubeClientSet, c.PipelineClientSet, tr) if err != nil { logger.Errorf("Failed to fetch task reference %s: %v", tr.Spec.TaskRef.Name, err) - tr.Status.SetCondition(&apis.Condition{ - Type: apis.ConditionSucceeded, - Status: corev1.ConditionFalse, - Reason: podconvert.ReasonFailedResolution, - Message: err.Error(), - }) + tr.Status.MarkResourceFailed(podconvert.ReasonFailedResolution, err) return nil, nil, err } @@ -518,12 +513,7 @@ func (c *Reconciler) handlePodCreationError(ctx context.Context, tr *v1beta1.Tas case isExceededResourceQuotaError(err): // If we are struggling to create the pod, then it hasn't started. tr.Status.StartTime = nil - tr.Status.SetCondition(&apis.Condition{ - Type: apis.ConditionSucceeded, - Status: corev1.ConditionUnknown, - Reason: podconvert.ReasonExceededResourceQuota, - Message: fmt.Sprint("TaskRun Pod exceeded available resources: ", err), - }) + tr.Status.MarkResourceOngoing(podconvert.ReasonExceededResourceQuota, fmt.Sprint("TaskRun Pod exceeded available resources: ", err)) case isTaskRunValidationFailed(err): tr.Status.MarkResourceFailed(podconvert.ReasonFailedValidation, err) default: