Skip to content

Refactor validation of environment state metrics

Reuben Pereira requested to merge rp/refactor-environment-state-validation into master

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?
Edited by Reuben Pereira

Merge request reports

Loading