aptly icon indicating copy to clipboard operation
aptly copied to clipboard

List snapshots for specific repository?

Open jamesps-ebi opened this issue 1 year ago • 1 comments

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

jamesps-ebi avatar Jul 25 '23 08:07 jamesps-ebi

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.

r4co0n avatar Jul 28 '23 15:07 r4co0n