Azure Devops Releases Retention not working correctly

83 Views Asked by At

We use release pipelines for releasing docker images onto dev/test/production.

For prod stage, we have set a retention of 365 days and we also want to keep the last 10 builds. The main reason is so that we can know what has been been historically released.

We keep noticing that in the case of production, they eventually get deleted and only 1 or 0 release still show given enough days pass. In my opinion this either means retention settings are not working correctly OR I am doing something wrong?

enter image description here enter image description here

Can you please help? Does anyone have the same issue?

1

There are 1 best solutions below

5
Kevin Lu-MSFT On

Refer to this doc: Set release retention policies

How does 'minimum releases to keep' setting work?

A release will be considered under minimum releases to keep for a stage only when the deployment started on that stage. Both successful and failed deployments are considered. Releases pending approval are not considered.

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.

This means that if you need the retention policy of the release stage to take effect, the stage deployment needs to be completed (success or failure).

Otherwise, the release will follow the retention policy set by the stage that has been deployed to set the retention policy of the release.

From the screenshot, the Prod Stage is not run in multiple releases and only the Dev Stage has completed. So it will follow the retention policy settings of the dev stage to retain the release.

To let the Prod stage retention policy take effect, you need to start the Prod stage deployment.