-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-62755] Introduce Fingerprint Cleanup in External Storage API #4817
Conversation
This PR is WIP currently. |
Requesting reviews @oleg-nenashev @afalko @mikecirioli |
In this PR, we expose the fingerprint cleanup API for external plugins to implement in the case fingerprint storage plugins want to implement their own fingerprint cleanup. Downstream PR: jenkinsci/redis-fingerprint-storage-plugin#23. We refactor the current fingerprint cleanup into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the current implementation I am not sure why it has to be a separate extension point. Could we just integrate the logic into the FingerprintStorage and invoke it from FingerprintCleanupThread
which is universal for all extension points?
cleanFingerprint
and execute
implementations could be moved to a storage.
core/src/main/java/jenkins/fingerprints/FileFingerprintCleanupThread.java
Outdated
Show resolved
Hide resolved
core/src/main/java/jenkins/fingerprints/FingerprintCleanupThread.java
Outdated
Show resolved
Hide resolved
core/src/main/java/jenkins/fingerprints/FingerprintCleanupThread.java
Outdated
Show resolved
Hide resolved
core/src/main/java/jenkins/fingerprints/FingerprintCleanupThread.java
Outdated
Show resolved
Hide resolved
@stellargo is it still in progress? |
@oleg-nenashev So it isn't in progress, the work is complete. But it will create merge conflicts with #4834. I think it is better to merge that before this. |
Unblocking, because #4834 is merged. Merge conflict needs to be resolved tho |
Yep currently working on resolving them :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Fingerprint cleanup will not work as written, I suggest inverting it to "Disable Fingerprint cleanup"
The API iteself looks OK for a beta implementation. I would rather create an API method for iterator with handler parameter, but it can be done later. API is Beta anyway
core/src/main/java/jenkins/fingerprints/GlobalFingerprintConfiguration.java
Outdated
Show resolved
Hide resolved
taskListener.getLogger().println("Cleaned up "+numFiles+" records"); | ||
} | ||
|
||
private boolean cleanFingerprint(File fingerprintFile, TaskListener listener) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is private, it does not override the implementation in upper class. Looks like a 🐛 for API users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this isn't supposed to override the method of the upper class(signature is different). The method in the upper class isn't called by itself, it is -used- by plugin implementations.
So basically asking the fingerprint implementations to provide an iterator, and do the cleanup ourself, is that what you meant? |
Might be. Anyway, it can be refactored later. I would not block the pull request by it |
core/src/main/java/jenkins/fingerprints/GlobalFingerprintConfiguration.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ready to go. Thanks @stellargo !
<f:section title="${%Fingerprints}"> | ||
<f:section title="${%Fingerprints}"> | ||
<f:entry title="Disable Fingerprint Cleanup"> | ||
<f:checkbox field="fingerprintCleanupDisabled" default="${it.fingerprintCleanupDisabled}" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason to disable this if there isn’t an external plugin for fingerprints?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be a good feature to have in case the disk storage is cheaper for a user than having a periodically running process. Or say Jenkins is configured on a distributed disk storage. I don't have any strong opinions though :)
We may merge it in 24 hours if there is no negative feedback. Please see the merge process documentation for more information about the merge process |
See JENKINS-62755.
See JEP-226.
Proposed changelog entries
FingerprintStorage
methods:iterateAndCleanupFingerprints
,cleanFingerprint
to allow external fingerprint storages to configure fingerprint cleanup.Proposed upgrade guidelines
N/A
Submitter checklist
Proposed changelog entries
section only if there are breaking changes or other changes which may require extra steps from users during the upgradeDesired reviewers
@mention
Maintainer checklist
Before the changes are marked as
ready-for-merge
:Proposed changelog entries
are correctupgrade-guide-needed
label is set and there is aProposed upgrade guidelines
section in the PR title. (example)lts-candidate
to be considered (see query).