Skip to content

Commit 81ba84e

Browse files
afrittolitekton-robot
authored and
tekton-robot
committed
Mark steps as deleted when TaskRun fails
Today this is done after the Pod is handled. If Pod deletion fails for some reason, the steps are not updated. Tekton only makes one attempt to delete the Pod to try and avoid that it keeps running even if the TaskRun failed. If this deletion fails for whatever reason, Tekton should still update the TaskRun status to mark the steps as failed, as they are failed from Tekton POV. Fixes: tektoncd#8293 Signed-off-by: Andrea Frittoli <[email protected]>
1 parent d2b057d commit 81ba84e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/reconciler/taskrun/taskrun.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,12 @@ func (c *Reconciler) failTaskRun(ctx context.Context, tr *v1.TaskRun, reason v1.
773773
return nil
774774
}
775775

776+
// When the TaskRun is failed, we mark all running/waiting steps as failed
777+
// This is regardless of what happens with the Pod, which may be cancelled,
778+
// deleted, non existing or fail to delete
779+
// See https://github.com/tektoncd/pipeline/issues/8293 for more details.
780+
terminateStepsInPod(tr, reason)
781+
776782
var err error
777783
if reason == v1.TaskRunReasonCancelled && (config.FromContextOrDefaults(ctx).FeatureFlags.EnableKeepPodOnCancel) {
778784
logger.Infof("Canceling task run %q by entrypoint", tr.Name)
@@ -785,7 +791,6 @@ func (c *Reconciler) failTaskRun(ctx context.Context, tr *v1.TaskRun, reason v1.
785791
return err
786792
}
787793

788-
terminateStepsInPod(tr, reason)
789794
return nil
790795
}
791796

0 commit comments

Comments
 (0)