1
votes

I am trying to understand how retention policies of Artifacts feed work.

I read through this article

Azure Artifacts/Delete and recover packages

but it is not clear whether retention policies apply only when "the maximum number of versions to keep" has been reached or generally for all versions. It is also not clear if the latest versions will be always kept, regardless of the retention policies.

For example, I set up a feed with the following retention policies:

Maximum number of versions per package: 10
Days to keep recently downloaded packages 2

Retention policies

Then I created a pipeline which uploads build artifacts as universal packages to the feed. As you can see from the following picture

Package versions

old package versions are still available for download even if they exceeded the "max days to keep" value.

Could someone please clarify how Azure Devops Artifacts retention policies actually work?

Thanks in advance

1
When enabled days to keep recently downloaded packages, packages will only be deleted by retention policies if they have not been downloaded within the number of days set. Is it possible that someone in your team still use the old versions?Cece Dong - MSFT
No, nobody is using them. If you take a look at the last picture I posted, you can see that for almost all package versions the number of downloads is 0 and those package versions have for sure exceeded the number of days to keep.AFAde
Hi @CeceDong-MSFT, thanks for your support. Have you had any chance to test it? Any update?AFAde
I've tested with a package which only have one version, and this version is not deleted by retention policy. If you publish versions > maximum number of versions, will the retention policy work?Cece Dong - MSFT
Yes, that works, the latest versions are deleted if the maximum is exceededAFAde

1 Answers

1
votes

From my tests, I've found how Artifact Retention policy works. When the package versions exceed Maximum number of versions per package, the policy will check the exceeded versions, if there are versions downloaded during Days to keep recently downloaded packages, the policy won't delete them, otherwise the exceeded versions will be deleted.

For example:

I have two feeds with 16 versions of a package, both settings as below:

enter image description here

If I never download any versions, the exceeded oldest ones will be deleted:

enter image description here

If I download the oldest two, then the oldest two won't be deleted temporarily, they will be deleted after Days to keep recently downloaded packages:

enter image description here