Make timed incremental rollout move forward only

Description

The feature - Timed incremental rollout has an edge case that old pipelines will conitnue rolling out even though the latest pipeline started rolling out.

To illustrate this problem,

An old Pipeline The latest Pipeline Expected result
Rolled out 10% Rolling out 10% The latest pipeline's rollout job should succeed
Rolled out 10% Rolled out 10% -
Rolling out 25% Rolled out 10% The old pipeline's rollout job should fail because the latest pipeline started rolling out
Rolling out 50% Rolling out 25% The old pipeline's rollout job should fail because the latest pipeline started rolling out, whereas the latest pipeline's rollout job should succeed

Propsal

The old pipeline's rollout job should fail. Users can see the reason of why the job was failed in the pipeline page.

Implementation detail

  • Persist rollout percentages into deployments table
  • Create Deployment record when Ci::Build is created
  • Add status column to deployments to distinguish pre_deploy and post_deploy
  • Add AR validation in Deployment to check if it's forward rollout
  • Add a new Ci::Build.failure_reasons.
  • Surface the error as Ci::Build.failure_reasons

Related

Edited by Dimitrie Hoekstra