-
-
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
Pull up AbstractFolder.delete
logic into AbstractItem
#8645
Conversation
// JENKINS-34939: do not hold the monitor on this folder while deleting them | ||
// (thus we cannot do this inside performDelete) | ||
try (ACLContext oldContext = ACL.as2(ACL.SYSTEM2)) { | ||
for (Item i : ((ItemGroup<?>) this).getItems(TopLevelItem.class::isInstance)) { |
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.
For now, retaining original behavior which is to say not calling delete()
on children of non-top-level item groups (e.g., MatrixConfiguration
). As in jenkinsci/cloudbees-folder-plugin#356 (comment), the only practical difference is likely to be in whether ItemListener
is notified of these.
throw (AbortException) new AbortException( | ||
"Failed to delete " + i.getFullDisplayName() + " : " + e.getMessage()).initCause(e); |
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.
Looks like an opportunity to add missing constructor signatures to AbortException
.
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.
Perhaps. It is not normal to call AbortException.initCause
, since the point of this class is that it suppresses a stack trace (including causes & suppressed). Whether the initCause
was ever actually helpful in jenkinsci/cloudbees-folder-plugin#95, I am not sure; neither AbstractFolder.delete
nor AbstractItem.performDelete
throw this exception type, so it may be dead code.
/label ready-for-merge This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback. Thanks! |
Refactoring of #2789 since jenkinsci/cloudbees-folder-plugin#95 copied a bunch of complex code. As seen in jenkinsci/cloudbees-folder-plugin@cdf7370 this complicates maintenance. Started to clean up in jenkinsci/cloudbees-folder-plugin#353 + jenkinsci/cloudbees-folder-plugin#355 but to really remove the duplication it is simplest to just handle child deletion directly in
AbstractItem
.Should have no behavioral effect for now since
AbstractFolder
overrides this, and the added block only pays attention toTopLevelItem
, so should not affectMavenModuleSet
orMatrixProject
. jenkinsci/cloudbees-folder-plugin#356 completes the cleanup.Testing done
JobTest.interruptOnDelete
should check that non-folders are unaffected. Added a downstream test for what it is worth: jenkinsci/cloudbees-folder-plugin#356 (comment)Proposed changelog entries
Before the changes are marked as
ready-for-merge
:Maintainer checklist