When linking merge requests to deployments, we should link for deployments with a status other than "success"

Deployments::LinkMergeRequestsService only runs if the deployments is successful. As a result, the MR widget will only show successful deployments when this feature is enabled. This is incorrect, as we previously also displayed deployments with a status such as "failed" or running.

To solve this we should simply link merge requests regardless of the deployment status. This poses a problem: deployments with a status of created should not be linked, because they may never transition to a different status (e.g. when using manual deployments that you never trigger). If we did link we may end up wasting time linking merge requests for no good reason. On the other hand, I am not sure how big of a deal this is. We filter out "created" deployments anyway in the merge request widget.

The alternative would be to trigger this service when the state either transitions away from "created", or the state was something different to begin with. This does mean we need to trigger the service from the model using a Rails hook, when the state changes away from "created" (or was something else to begin with). Since deployments can be updated, we would have to take care of not running this twice, which can be difficult.

Assignee Loading
Time tracking Loading