Skip to content

Commit

Permalink
call MarkResource* instead of updating the status
Browse files Browse the repository at this point in the history
A very simple cleanup to utilize the common utility to update the
taskRun status instead of setting the condition explicitly.

No functional change expected.
  • Loading branch information
pritidesai authored and tekton-robot committed Feb 9, 2022
1 parent 6b72412 commit 2b3a0db
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions pkg/reconciler/taskrun/taskrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2b3a0db

Please sign in to comment.