• Yorick Peterse's avatar
    Always use state machine for deployments · 34f632fb
    Yorick Peterse authored
    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: default avatarAlessio Caiazza <acaiazza@gitlab.com>
    34f632fb
deployment_spec.rb 13.8 KB