Refine CI statuses
Currently a CI pipeline / build status is a symbol / string. Statuses are being persisted as
enum values (defined in
HasStatus concern). We calculate statuses using SQL queries, which is quite fast.
What we are trying to solve in !6801 (closed) is improving support for situation when pipeline is successful, but there were builds that failed that were allowed to fail.
The problem with this approach, is that we will need to add a new status each time we want to decorate / extend statuses. Consider @nick.thomas' comment:
What if in the future we want to introduce an icon to say 'this pipeline passed but it is stale - i.e., passed > 48 hours ago'?
I wonder if using a 'primitive' value for pipeline / build status weakens our CI model. Would it make sense to introduce
Ci::Status module which would hold
Ci::Status::Success and all statuses that we have (along with
Ci::Status::Core)? With this approach it would be possible to decorate statuses with
Ci::Status::Stale which would make it possible to scale statuses "horizontally" instead of making implementation "vertical" (not sure if this is a good analogy) and leverage polymorphism.
The point here is to keep core statuses simple, and extend implementation in layer above core statuses.