Closed Bl4d3s closed 4 years ago
Hi @Bl4d3s , thank for reporting this.
We do not strictly guarantee uniqueness and order of events, however usually you should be getting events once. Since the reconciler relies on the informer cache one it's triggered, if the cache is stale we may be getting the pipeline run without the start date set, and thus trigger the "Started" event again.
Do you see this on a regular basis or was it a one off? If this is a one off I would not be worried, otherwise I think it would be best to dig into what's happening, as we need to be able to rely on the informer caches telling us the right thing most of the times.
@mattmoor fyi
Hi, thanks for the fast feedback.
I see it happen more often then not unfortunately.
Do you need any more input from my end ? Specific logs etc?
If you still have the pipeline around, could you post the output of:
kubectl describe pr/ba--thesis-sample--test--5pdtp -n tekton-pipelines
Any special reason for running a pipeline in the tekton-pipelines
namespace?
Note that the log lines are about k8s events, but if you have duplicate k8s you could also see duplicate cloud events.
kubectl describe pr/ba--thesis-sample--test--5pdtp -n tekton-pipelines
Output
Attached Pipeline is not that simple unfortunately. I can try to make an minimal example next week if needed?
Any special reason for running a pipeline in the
tekton-pipelines
namespace?
Nope, just havent changed it yet. Will do so next week. Thanks for pointing it out.
I have updated my application to save if an event was already handled. So my issue is solved.
Thanks for the update on this issue, I'm glad you found a solution.
@GregDritschler found out that a change to the taskrun / pipelinerun, for instance adding a label, will trigger another reconcile. If the timing is right the informer cache may be stale, thus making it more likely to have duplicate start events - see https://github.com/tektoncd/pipeline/pull/3558#.
I don't see any extra label or annotation in your pipeline, so perhaps your issue is a different one, but I wanted to let you know anyways.
Even without updates with labels, there is a slight chance that the informer cache may be out of sync when a new reconcile start, so @GregDritschler is also working on fixing the case where this could lead to duplicate taskrun creation. It will not solve the case of duplicate start events, so it's good that you handle that on your side.
It would be interesting to understand why this happens so often for you. Could you perhaps share more information about what is your process for creating a pipelinerun?
I did try to add some additional information via a patch on the pipelinerun (either annotation or label). Probably this triggered the additional reconcile run.
Use case was the following:
I solved it for me by caching it in the sink and not adding it to the pipelinerun as it's not needed there specifically
Hello,
Im not sure wether this is supposed behavior or not:
I get certain events twice, when executing a pipeline. Especially for the Started or Succeeded states.
My problem with this is, I want to use the events (CloudEvents) for triggering certain tasks in an sink. One example would be sending an email on pipeline finish.
My setup: OpenShift (v4.6.3) with CodeReadyContainers on Windows (1.19.0) Tekton Pipelines Version: v0.18.1 Tekton Triggers Version: v0.9.1
See this controller log: (first and last line are the events).