Does it make sense for Stage B to have lesser retention setting values than Stage A?

33 Views Asked by At

In Azure DevOps Server 2022.1 one can create release pipelines with different stages. These stages can be configured with a certain amount of Days to retain a release and Minimum releases to keep (as long as it obeys the Maximum retention policy on project level).

Let's assume a scenario in which two stages - A and B - are the only stages and A must succeed or fail before deployment to B is even considered. The configuration is as follows:

Stage Days to retain a release Minimum releases to keep
Stage A 10 5
Stage B 5 3

I would assume that, since Stage A must be passed before Stage B, the retention settings of A overwrite those of B, so to speak: A release that was deployed to B will be retained for 5 days, which doesn't matter, because it would be retained for 10 days by A anyways. At least 3 releases that reached B will be kept, but that doesn't matter either, because A will include those 3 in its own 5 kept releases.

Am I misunderstanding something here or are there only two viable options to consider when configuring stages: Either adopt the settings of the preceding Stage A in Stage B or make sure that B has higher values in its settings than A?

1

There are 1 best solutions below

1
Alvin Zhao - MSFT On

Based on your description, I generated the sample release pipeline below and created several releases.

enter image description here

enter image description here

enter image description here

With the rules stated in the document,

The retention timer on a release is reset every time a release is modified or deployed to a stage. The minimum number of releases to retain setting takes precedence over the number of days.

How does 'minimum releases to keep' setting work?

Minimum releases to keep are defined at stage level. It denotes that Azure DevOps will always retain the given number of last deployed releases for a stage even if the releases are out of retention period. A release will be considered under minimum releases to keep for a stage only when the deployment started on that stage.

How is retention period decided when release is deployed to multiple stages having different retention period?

Final retention period is decided by considering days to retain settings of all the stages on which release is deployed and taking max days to keep among them. Minimum releases to keep is governed at stage level and do not change based on release deployed to multiple stages or not. Retain associated artifacts will be applicable when release is deployed to a stage for which it is set true.

Here is my understanding of how the 10 releases will be retained.

enter image description here

Besides, I was unable to figure out a method to get the release retention licenses and verify my hypothesis. It is recommended you go through this document and share the scenario you may encounter for further discussion.

Hope the information helps.