feat(cleanDockerImages): Add globalMaxDays and globalMaxCount#495
Open
g3n35i5 wants to merge 1 commit into
Open
feat(cleanDockerImages): Add globalMaxDays and globalMaxCount#495g3n35i5 wants to merge 1 commit into
globalMaxDays and globalMaxCount#495g3n35i5 wants to merge 1 commit into
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
8b857b2 to
89778a0
Compare
Author
|
I have read the CLA Document and I hereby sign the CLA |
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 `null` 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
89778a0 to
b20ecda
Compare
Author
|
@jfrogdixit pinging you since you're the latest contributor with merge permissions. Do you have an ETA for a review? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Global Retention Policy Fallbacks for cleanDockerImages Plugin
Overview
This PR extends the
cleanDockerImagesplugin to support optional global fallback values for retention policies, eliminating the need to manually label every Docker image with retention policies.Motivation
Previously, each Docker image had to be explicitly labeled with
com.jfrog.artifactory.retention.maxDaysand/orcom.jfrog.artifactory.retention.maxCountin its Dockerfile. This approach had limitations:Changes
New Configuration Options
Added two optional configuration parameters to
cleanDockerImages.properties:globalMaxDays: Global fallback for maximum age retention (in days)globalMaxCount: Global fallback for maximum version count retentionThese values apply to images that don't have explicit labels set. Set to
nullor omit to disable.Implementation Details
maxDaysandmaxCountpolicies work with global fallbacksbyDownloadDatebehaviorCode Changes
checkDaysPassedForDelete()andgetMaxCountForDelete()to accept and use global fallback parametersBackward Compatibility
This change is fully backward compatible:
Usage Example