Lucas Trzesniewski
Lucas Trzesniewski

Reputation: 51390

Is it possible to set a minimum number of builds to retain in Azure Pipelines?

I maintain a couple of GitHub projects which don't have a lot of commit activity, and use Azure Pipelines for CI. A build status badge is displayed in their readme page.

The issue is that by default all builds are cleaned up after 30 days, and the badge then wrongly shows a "never built" status:
status badge

I'd like to change my settings so that the last few builds on the master branch are never deleted. Ideally, that should have been the default setting.

The Build and release retention policies docs page suggests that there is a "minimum number of builds" retention setting somewhere, but I couldn't find it anywhere. Not in the organization settings, and neither in the project settings.

As a workaround, I've set the "Days to keep runs" setting to the maximum value for now, but what I'd really like is to set a small number of latest builds to retain instead. Is there a way to do that or has this option vanished?

Upvotes: 2

Views: 1187

Answers (1)

Josh Gust
Josh Gust

Reputation: 4445

Edit:

I haven't tested this explicitly in my sandbox org, but I am seeing it in our live org so I think I'm right.

Retaining a minimum number of Build Artifacts is inherited by the Release Pipeline Retention Policy

Retain associated artifacts

This checkbox option is available on an individual stage for a pipeline, or in the default retention policy.

Pipeline specific policy enter image description here

Default retention policy enter image description here

Original Answer:

This functionality changed since the Sprint 150 update on April 8. This release was heavy on the Pipelines Areas and a lot of things changed.

It seems the documentation is wrong (or unclear)

There should be a GitHub issue logged with that documentation page, as it is now out-of-data for what it says about build artifacts.

Work around

Create a schedule trigger inside the threshold of the retention policy for those builds that don't turn over very often to make sure that you have a run and artifact for your badge to point to.

Upvotes: 2

Related Questions