keep_n_duplicated_package_files
cleanup policy is not adapted to Conan
Background
The keep_n_duplicated_package_files
cleanup policy is currently implemented in Packages::Cleanup::ExecutePolicyService
with a one-size-fits-all approach that doesn't account for Conan's unique package reference system. The only Conan-specific handling is a special case for manifest files.
Technical Details
Current implementation issues:
- The cleanup service groups package files by
package_id
andfile_name
only:
package_files.group(:package_id, :file_name)
.having("COUNT(*) > #{@policy.keep_n_duplicated_package_files}")
-
This ignores Conan's package reference system which is designed to handle different build configurations:
- Each Conan package can have multiple package references (
Packages::Conan::PackageReference
) - Package references represent different build settings/options, not versions
- Each Conan package can have multiple package references (
-
The current implementation may delete valid package files when:
- A package has multiple references (different build configs)
- Soon, when a package has multiple revisions as well (conan v2)
Impact
-
Data Loss Risk:
- Users may lose package files for specific build configurations or architectures
- CI/CD pipelines depending on specific package configurations may break
-
User Experience:
- Unexpected behavior for Conan users
- Potential loss of important package variants
Proposed Solution
- For v1, keep n duplicate file by
package_reference
for package files, also separate by file type:recipe
vspackage
to have a cleaner way of managingmanifest
files. - For v2, or v1 with revision, have new options:
- Number of recipe revisions to keep
- Number of package revisions to keep per reference
Edited by 🤖 GitLab Bot 🤖