aptly-dev / aptly

aptly - Debian repository management tool
https://www.aptly.info/
MIT License
2.55k stars 369 forks source link

List snapshots for specific repository? #1202

Open jamesps-ebi opened 12 months ago

jamesps-ebi commented 12 months ago

Detailed Description

It doesn't look like there is any way to list snapshots belonging to a specific aptly repository/distribution. I think this would be very useful if you are managing multiple repositories.

Context

Example use-case, You maintain your own 'local' repo and a 'local-security' repo. You want to automate creation and pruning of snapshots i.e max 14 of each. If there was a command-line switch to do separate snapshots belonging to each, we could script a cleanup job to purge old snapshots.

# example - Would only list snapshots for the given REPOSITORY
aptly snapshot list [REPOSITORY]

Possible Implementation

Your Environment

r4co0n commented 11 months ago

This is not a solution, but a workaround that has served us quite well so far: Name your snapshots after aptly type and item name, e.g., name your bookworm mirror snapshot mirror_bookworm, and the publication(publish) snapshot publish_bookworm (We used publication).

Then, the question "Which snapshots belong to this mirror or publication?" becomes quite easy to answer. You will still need to make sure to not hande bookworm-backports when calling for bookworm, but this can be easily solved - If anyone struggles with this part, please reach out again.

P.S. You might feel that duplicating snapshots from mirror_ to publish_ is an unnecessary abstraction, but it will allow you to change how your publication is composed without losing its history. We happily use this abstraction, though it is probably a bit more cumbersome than strictly necessary.

Btw, simply copying a snapshot can be accomplished by calling aptly snapshot merge with a single <source> argument.