Race condition when retrying builds
Summary
Seen on https://gitlab.com/gitlab-org/gitlab-ce/pipelines/5475323 (rspec 18 20 job). If two people retry a failed build simultaneously, two builds are created and both run. This suggests a race condition retrying builds.
Steps to reproduce
Open a failed build in two browser tabs. Click retry in both
Expected behavior
Only one should create a new build. The other should fail.
Actual behavior
Two builds are created
Possible fixes
Wrap build creation for retry in a transaction and abort if another retry build for the same job has been created.