Multiple pipeline events were fired for a single pipeline event
Summary
I enabled build events and pipeline events for Slack service. I generated one pipeline which would have two failing builds (jobs). I expected to get 1 message for build and one message for pipeline. However I got 2 messages for pipeline, totally 3 messages as shown in:
Pipeline
was from pipeline events and Commit
was from build events.
Steps to reproduce
Enable Slack service for pipeline events.
Expected behavior
Should only get 1 pipeline event message rather than 2.
Actual behavior
Got 2 pipeline events.
Relevant logs and/or screenshots
I tried to check the pipeline status transitions because this was totally relying on that, and found that:
- 14:09:34 (enqueue) created -> pending
- 14:09:34 (run) pending -> running
- 14:09:52 (run) running -> running
- 14:09:52 (run) running -> running
- 14:10:18 (drop) running -> failed (first slack message)
- 14:10:18 (drop) failed -> failed
- 14:10:18 (drop) running -> failed (second slack message)
So it seemed that it's either a data race or we have multiple instances for the same record (pipeline) doing the transitions.
Possible fixes
We should make sure that transitions really make sense.
Original thread: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5525#note_15132847