Refactor validation of environment state metrics
What does this MR do and why?
Describe in detail what your merge request does and why.
Content
- Refactor validation of environment state metrics
Create separate validator classes for each auto deploy environment (gstg-cny
, gstg
, gprd-cny
, gprd
), instead of the single EnvironmentStateTransition
class we have now.
Separate
classes makes it easier to have different valid states for each
environment.
Separate classes also allows us to add special validation per environment. For example, in a follow-up MR, I plan to add validation for the awaiting_promotion
state (for gstg
and gprd
) to make sure the packages available for promotion are newer than the ones on the environment.
To avoid duplication, common code has been moved from EnvironmentStateTransition
to EnvironmentState::Common
module. Each environment class (EnvironmentState::StagingCanary
, EnvironmentState::Production
, etc) includes EnvironmentState::Common
, and contains the state machine.
gitlab-com/gl-infra/delivery#20376 (closed)
Author Check-list
-
Has documentation been updated?