Clean up your Space Packages repositories with retention policies
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:
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!
Subscribe to Blog updates
Thanks, we've got you!
How to Use Dart and Flutter Package Repositories in Space
Easily store, manage, and share Dart & Flutter packages within your organization. Use Space packages to create custom Dart repositories for your packages.
Git Commit Signing With JetBrains Space
Learn what signing Git commits is and how JetBrains Space can help you verify Git commit signatures.
How To Get Started With Space Cloud Dev Environments
Are you thinking about introducing remote development into your team or organization? Learn how to get started with dev environments in Space.