Skip to content

Commit

Permalink
Exit reconcilation and markfailed if finally is not present
Browse files Browse the repository at this point in the history
Signed-off-by divyansh42 <diagrawa@redhat.com>
  • Loading branch information
divyansh42 committed Oct 16, 2024
1 parent 332cb87 commit c6bf2f4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/reconciler/pipelinerun/pipelinerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,16 @@ func (c *Reconciler) runNextSchedulableTask(ctx context.Context, pr *v1.Pipeline
// be added to the nextRpts
nextRpts = nil
pipelineRunFacts.ValidationFailedTask = append(pipelineRunFacts.ValidationFailedTask, rpt)
fTaskNames := pipelineRunFacts.GetFinalTaskNames()
if len(fTaskNames) == 0 {
// If finally is not present, we should mark pipelinerun as
// failed so that no further execution happens. Also,
// this will set the completion time of the pipelineRun.
// NewPermanentError should also be returned so that
// reconcilation stops here
pr.Status.MarkFailed(v1.PipelineRunReasonInvalidTaskResultReference.String(), err.Error())
return controller.NewPermanentError(err)
}
}
}
// GetFinalTasks only returns final tasks when a DAG is complete
Expand Down

0 comments on commit c6bf2f4

Please sign in to comment.