Commit statuses published from outside GitLab regarding a single build are registered as multiple separate jobs in a pipeline
Description
If external system that carries out builds posts multiple statuses to GitLab, these are registered as separate jobs. E.g. (see the screenshot) two builds of two different build configs in TeamCity invoked in respect to same revision are first reporting the status "running", then one reports "failed" just at the moment of failure, and then again reports it at the moment with that build is finished. The other one reports that it has finished successfully.
As a result GitLab creates 5 separate Job Id (Build Id - depends on the version) and considers it to be 5 separate builds with various statuses, some - running, some - failed, one - successfully finished.
The issue affects both CE and GitLab.com
Proposal
I see two ways around it:
-
The simplest would be group statuses in such external jobs by their name/context within each commit. It has a disadvantage of not being able to register actually different builds related to the same revision produced with the same name (say if build configuration name is used for the name/context).
-
The other way would be to support some external build id field in the commit status publishing API, so the external system could actually tell if it is posting status for the same or a different build.
May be these two ways may be combined: i.e. if the (optional) external build id is passed, it groups statuses into jobs by it, and if it is not, it groups by name/context.