Search code examples
azure-devopsazure-artifacts

Azure DevOps Artifacts - Retention policy clarification


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


Solution

  • 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