Space
The intelligent code collaboration platform
Space and SpaceCode will be discontinued on June 1, 2025. Learn more → →
Clean up your Space Packages repositories with retention policies
Hi! It’s the Space Packages team with the latest news. Packages (a package repository manager built into JetBrains Space) gets the package retention policies feature. What is it?
By default, the lifetime of a package is not limited. So, while the new package versions are published to a repository, the old ones are not deleted. This means that the repository keeps growing over time. To help you keep the size of the repository within reasonable limits, Packages can auto-delete old or no-longer-needed packages. You can configure the auto-deletion through the set of conditions called “package retention policies”.
Note that ‘retention policies’ are not ‘cleanup rules’. While the latter implies that a certain condition must be met in order to delete a package, retention policies are rules that prevent packages from deletion. Currently, there are four available policies:
- Keep the package if it was downloaded at least once in the last X days.
- Keep the last X versions of the package.
For example, you have 5 package versions from 1.0.1 to 1.0.5 and set X to 5. Once the 1.0.6 version is uploaded, the 1.0.1 will be no longer protected by this policy. - Keep the package version with at least one download.
- Keep the “pinned” package versions.
So, a package is prevented from auto-deletion if it meets at least one of the enabled policies.
How to configure the retention policy for a repository
- Open the Packages page for your project.
- Open the required repository.
- In the Retention Policies tab, turn on Automatic Repository Cleanup and configure the conditions.
-
Once you save the changes, you can click Clean up now to run the cleanup immediately. Normally, Packages runs the cleanup task once a day.
How to exclude a package from the retention policies
If you want to prevent a certain package version from auto-deletion, find the required package, and choose Pin in the menu:
Pinned packages are marked with the Pinned tag:
Future plans
For sure, we want to continue improving the feature. What do we have in our roadmap:
- A flag that will let keeping transitive dependencies of “pinned” packages.
- The retention policies page will show you how much disk space will be freed if you run the cleanup here and now.
That’s it for today! If you’re a Packages user, don’t hesitate to try the feature. Your feedback is very welcome!