Skip to content

Refactor the Deployment model so state machine events are used by both CI and the API

Yorick Peterse requested to merge deployment-state-hooks into master

What does this MR do?

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 #36648 (closed) and fixes #35763 (closed).

Does this MR meet the acceptance criteria?

Conformity

Edited by Yorick Peterse

Merge request reports