@@ -433,18 +433,36 @@ func (c *Reconciler) reconcile(ctx context.Context, customRun *tektonv1beta1.Cus
433
433
}
434
434
// CustomRun is cancelled, just cancel all the running instance and return
435
435
if customRun .IsCancelled () {
436
+ var DAGStatus pb.Execution_State
436
437
if len (failedPrs ) > 0 {
437
438
customRun .Status .MarkCustomRunFailed (pipelineloopv1alpha1 .PipelineLoopRunReasonFailed .String (),
438
439
"CustomRun %s/%s was failed" ,
439
440
customRun .Namespace , customRun .Name )
441
+ DAGStatus = pb .Execution_FAILED
440
442
} else {
441
443
reason := pipelineloopv1alpha1 .PipelineLoopRunReasonCancelled .String ()
442
444
if customRun .HasTimedOut (c .clock ) { // This check is only possible if we are on tekton 0.27.0 +
443
445
reason = string (tektonv1beta1 .CustomRunReasonTimedOut )
444
446
}
445
447
customRun .Status .MarkCustomRunFailed (reason , "CustomRun %s/%s was cancelled" , customRun .Namespace , customRun .Name )
448
+ DAGStatus = pb .Execution_CANCELED
449
+ }
450
+ if c .runKFPV2Driver == "true" {
451
+ options , err := kfptask .ParseParams (customRun )
452
+ if err != nil {
453
+ logger .Errorf ("Run %s/%s is invalid because of %s" , customRun .Namespace , customRun .Name , err )
454
+ customRun .Status .MarkCustomRunFailed (kfptask .ReasonFailedValidation ,
455
+ "Run can't be run because it has an invalid param - %v" , err )
456
+ return err
457
+ }
458
+ DAGErr := kfptask .UpdateDAGPublisher (ctx , options , DAGStatus )
459
+ if err != nil {
460
+ logger .Errorf ("kfp publisher failed when reconciling Run %s/%s: %v" , customRun .Namespace , customRun .Name , DAGErr )
461
+ customRun .Status .MarkCustomRunFailed (kfptask .ReasonDriverError ,
462
+ "kfp publisher execution failed: %v" , DAGErr )
463
+ return DAGErr
464
+ }
446
465
}
447
-
448
466
for _ , currentRunningPr := range currentRunningPrs {
449
467
logger .Infof ("CustomRun %s/%s is cancelled. Cancelling PipelineRun %s." , customRun .Namespace , customRun .Name , currentRunningPr .Name )
450
468
if _ , err := c .pipelineClientSet .TektonV1 ().PipelineRuns (customRun .Namespace ).Patch (ctx , currentRunningPr .Name , types .JSONPatchType , cancelPatchBytes , metav1.PatchOptions {}); err != nil {
0 commit comments