You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cleanDockerImages): Add globalMaxDays and globalMaxCount
This PR extends the `cleanDockerImages` plugin to support optional global fallback values for retention policies, eliminating the need to manually label every Docker image with retention policies.
Previously, each Docker image had to be explicitly labeled with `com.jfrog.artifactory.retention.maxDays` and/or `com.jfrog.artifactory.retention.maxCount` in its Dockerfile. This approach had limitations:
- Requires rebuilding images to change retention policies
- Not practical for third-party images that can't be modified
- Tedious to manage retention across many images
- No way to set repository-wide defaults
Added two optional configuration parameters to `cleanDockerImages.properties`:
- **`globalMaxDays`**: Global fallback for maximum age retention (in days)
- **`globalMaxCount`**: Global fallback for maximum version count retention
These values apply to images that don't have explicit labels set. Set to `-1` or omit to disable.
- Global settings are loaded from the properties file on plugin execution
- Image-specific labels always take precedence over global settings
- Both `maxDays` and `maxCount` policies work with global fallbacks
- Compatible with existing `byDownloadDate` behavior
- Modified `checkDaysPassedForDelete()` and `getMaxCountForDelete()` to accept and use global fallback parameters
- Updated function signatures throughout the call chain to pass global settings
- Added type checking to handle both String (from labels) and Integer (from global config) property values
- Enhanced logging to indicate when global values are being used
**This change is fully backward compatible:**
- Existing configurations without global settings continue to work unchanged
- Image-specific labels are still supported and take priority
- No breaking changes to the plugin API or execution parameters
```groovy
dockerRepos = ["docker-local", "docker-prod"]
byDownloadDate = false
globalMaxDays = 30
globalMaxCount = 5
0 commit comments