From 8374faeff3f91059535e5bff6774e4fdccaa52fe Mon Sep 17 00:00:00 2001 From: Khurram Baig Date: Mon, 21 Oct 2024 16:10:38 +0530 Subject: [PATCH] Storing PipelineRun and TaskRun deletion metadata Earlier, data coming during deletion like timestamp weren't stored. This PR fixes that. --- pkg/watcher/reconciler/pipelinerun/reconciler.go | 3 +++ pkg/watcher/reconciler/taskrun/reconciler.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/pkg/watcher/reconciler/pipelinerun/reconciler.go b/pkg/watcher/reconciler/pipelinerun/reconciler.go index ac5c2471c..1c398a600 100644 --- a/pkg/watcher/reconciler/pipelinerun/reconciler.go +++ b/pkg/watcher/reconciler/pipelinerun/reconciler.go @@ -130,6 +130,9 @@ func isMarkedAsReadyForDeletion(taskRun *pipelinev1.TaskRun) bool { // that we see flowing through the system. If we don't add a finalizer, it could // get cleaned up before we see the final state and store it. func (r *Reconciler) FinalizeKind(ctx context.Context, pr *pipelinev1.PipelineRun) knativereconciler.Event { + // Reconcile the pipelinerun to ensure that it is stored in the database + r.ReconcileKind(ctx, pr) + // If logsClient isn't nil, it means we have logging storage enabled // and we can't use finalizers to coordinate deletion. if r.logsClient != nil { diff --git a/pkg/watcher/reconciler/taskrun/reconciler.go b/pkg/watcher/reconciler/taskrun/reconciler.go index eff341e2d..5f93278bf 100644 --- a/pkg/watcher/reconciler/taskrun/reconciler.go +++ b/pkg/watcher/reconciler/taskrun/reconciler.go @@ -64,6 +64,9 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, tr *pipelinev1.TaskRun) // that we see flowing through the system. If we don't add a finalizer, it could // get cleaned up before we see the final state and store it. func (r *Reconciler) FinalizeKind(ctx context.Context, tr *pipelinev1.TaskRun) knativereconciler.Event { + // Reconcile the taskrun to ensure that it is stored in the database + r.ReconcileKind(ctx, tr) + // If logsClient isn't nil, it means we have logging storage enabled // and we can't use finalizers to coordinate deletion. if r.logsClient != nil {