Improve domain model of CI/CD pipeline processing
Description
Our CI/CD pipeline processing is complex. Fixing bugs and introducing new features becomes cumbersome sometimes.
There are multiple issues that are blocked by the incomplete domain model of CI/CD pipeline processing. We recently started improving that and we introduced Ci::Stage
domain model (though we still don't persist these objects, see https://gitlab.com/gitlab-org/gitlab-ce/issues/26481), and we introduced detailed CI/CD statuses (domain classes for each CI/CD status we show in the UI, these are presenters).
But we still might want to improve our domain model, to avoid problems like with https://gitlab.com/gitlab-org/gitlab-ce/issues/26360, where calculating partial status of the pipeline is a challenge, because our pipeline processing implementation is not embedded into a good model, and we use simple SQL queries instead (see https://gitlab.com/gitlab-org/gitlab-ce/issues/15521). Because of missing domain model improving the pipeline processing is quite error prone, which caused https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9436.
Proposal
Devise a new pipeline processing model and introduce a separate module for this purpose.