Skip to content

Add -max-versions to get the N most recent versions of a package. - #1650

Open
Rascalov wants to merge 4 commits into
aptly-dev:masterfrom
Rascalov:mirror-update-max-versions
Open

Rascalov wants to merge 4 commits into
aptly-dev:masterfrom
Rascalov:mirror-update-max-versions

Conversation

@Rascalov

@Rascalov Rascalov commented Oct 22, 2026 •

Copy link
Copy Markdown

Fixes #1649

Requirements

All new code should be covered with tests, documentation should be updated. CI should pass.

Description of the Change

Adds a new argument to aptly mirror update called -max-versions=N that extends -latest logic to get the N most recent versions of a package.
-latest becomes equivalent to -max-versions=1.

We have a use case for this addition where we:

  • Want to keep N amount of versions per package for rollback and/or upgrade path purposes
  • Don't need/want a full archive

My golang knowledge is very poor, the work for this PR is written primarily by Claude. The hope is that this PR is minimal noise while providing a meaningful base that a maintainer can use to create more fitting implementation.

Checklist

  • allow Maintainers to edit PR (rebase, run coverage, help with tests, ...)
  • unit-test added (if change is algorithm)
  • functional test added/updated (if change is functional)
  • man page updated (if applicable)
  • bash completion updated (if applicable)
  • documentation updated
  • author name in AUTHORS

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.90909% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.97%. Comparing base (516fcc6) to head (6fe087f).

Files with missing lines Patch % Lines
cmd/mirror_update.go 23.52% 10 Missing and 3 partials ⚠️
api/mirror.go 10.00% 6 Missing and 3 partials ⚠️
deb/remote.go 70.00% 2 Missing and 1 partial ⚠️
deb/list.go 88.88% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1650      +/-   ##
==========================================
- Coverage   77.37%   76.97%   -0.41%     
==========================================
  Files         165      165              
  Lines       15747    15786      +39     
==========================================
- Hits        12185    12152      -33     
- Misses       2356     2426      +70     
- Partials     1206     1208       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant