Always use state machine for deployments
This refactors Deployment, Deployments::CreateService, and Deployments::UpdateService so that the appopriate state machine events are triggered when creating or updating a deployment. Without this we would not trigger any events when creating deployments using the API, such as the event used for setting `finished_at`. As part of this change, Deployments::CreateService no longer calls Deployments::AfterCreateService directly; instead it uses Sidekiq which is triggered using a state machine event. This ensures that deployments created using the API and CI both trigger the same workers, hooks, etc. To make this work some specs had to be adjusted, which included adjusting some Gitaly request count limits that were racy. This fixes https://gitlab.com/gitlab-org/gitlab/issues/36648 and fixes https://gitlab.com/gitlab-org/gitlab/issues/35763. Co-Authored-By: Alessio Caiazza <acaiazza@gitlab.com>
Showing
Please register or sign in to comment