Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-v0.12.x] Storing PipelineRun and TaskRun deletion metadata #861

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/watcher/reconciler/pipelinerun/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
rerr := 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 {
Expand Down Expand Up @@ -184,7 +187,7 @@ func (r *Reconciler) FinalizeKind(ctx context.Context, pr *pipelinev1.PipelineRu
pr.Namespace, pr.Name, now.String(), storeDeadline.String(), requeueAfter.String())
return controller.NewRequeueAfter(requeueAfter)
}
if stored != "true" {
if rerr != nil || stored != "true" {
logging.FromContext(ctx).Debugf("stored annotation is not true on pipelinerun %s/%s, now: %s, storeDeadline: %s, requeueAfter: %s",
pr.Namespace, pr.Name, now.String(), storeDeadline.String(), requeueAfter.String())
return controller.NewRequeueAfter(requeueAfter)
Expand Down
5 changes: 4 additions & 1 deletion pkg/watcher/reconciler/taskrun/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
rerr := 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 {
Expand Down Expand Up @@ -134,7 +137,7 @@ func (r *Reconciler) FinalizeKind(ctx context.Context, tr *pipelinev1.TaskRun) k
tr.Namespace, tr.Name, now.String(), storeDeadline.String(), requeueAfter.String())
return controller.NewRequeueAfter(requeueAfter)
}
if stored != "true" {
if rerr != nil || stored != "true" {
logging.FromContext(ctx).Debugf("stored annotation is not true on taskrun %s/%s, now: %s, storeDeadline: %s",
tr.Namespace, tr.Name, now.String(), storeDeadline.String())
return controller.NewRequeueAfter(requeueAfter)
Expand Down