Skip to content

Commit 37809f9

Browse files
divyansh42tekton-robot
authored andcommitted
Exit reconcilation and markfailed if finally is not present
Signed-off-by divyansh42 <[email protected]>
1 parent 40aa1ca commit 37809f9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/reconciler/pipelinerun/pipelinerun.go

+10
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,16 @@ func (c *Reconciler) runNextSchedulableTask(ctx context.Context, pr *v1.Pipeline
853853
// be added to the nextRpts
854854
nextRpts = nil
855855
pipelineRunFacts.ValidationFailedTask = append(pipelineRunFacts.ValidationFailedTask, rpt)
856+
fTaskNames := pipelineRunFacts.GetFinalTaskNames()
857+
if len(fTaskNames) == 0 {
858+
// If finally is not present, we should mark pipelinerun as
859+
// failed so that no further execution happens. Also,
860+
// this will set the completion time of the pipelineRun.
861+
// NewPermanentError should also be returned so that
862+
// reconcilation stops here
863+
pr.Status.MarkFailed(v1.PipelineRunReasonInvalidTaskResultReference.String(), err.Error())
864+
return controller.NewPermanentError(err)
865+
}
856866
}
857867
}
858868
// GetFinalTasks only returns final tasks when a DAG is complete

0 commit comments

Comments
 (0)