Skip to content

Commit

Permalink
Adds check for pipelinerun completed state in reconciler
Browse files Browse the repository at this point in the history
if watcher pod restarts then it seems all pipelineruns are processed
regardless of out filter for state, this adds a check for state in
reconciler and returns if its completed.

Signed-off-by: Shivam Mukhade <smukhade@redhat.com>
  • Loading branch information
Shivam Mukhade committed Jun 3, 2022
1 parent f305aa1 commit 880702c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/reconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ var gitAuthSecretAnnotation = filepath.Join(pipelinesascode.GroupName, "git-auth

func (r *Reconciler) ReconcileKind(ctx context.Context, pr *v1beta1.PipelineRun) pkgreconciler.Event {
logger := logging.FromContext(ctx)

// if pipelineRun is in completed state then return
state, exist := pr.GetLabels()[filepath.Join(pipelinesascode.GroupName, "state")]
if exist && state == kubeinteraction.StateCompleted {
return nil
}

if pr.IsDone() {
logger = logger.With(
"pipeline-run", pr.GetName(),
Expand Down

0 comments on commit 880702c

Please sign in to comment.