Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,11 @@ public void replaceAction(@NonNull Action a) {
@Override protected void performDelete() throws IOException, InterruptedException {
setDisabled(true);
Jenkins.get().getQueue().cancel(this);

for (WorkflowRun workflowRun : getBuilds()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trouble is that this will make performance worse for those not using artifact-manager-s3 (or those using it in its default and only supported mode, which never deletes artifacts), since loading potentially thousands of WorkflowRun objects from so many little XML files is expensive. Anyway deleting those S3 directories one by one would be inefficient.

Fixing this properly would have to take a different approach I think. https://javadoc.jenkins.io/jenkins/model/ArtifactManager.html#delete() cannot handle this since the whole object is scoped per build. https://javadoc.jenkins.io/jenkins/model/ArtifactManagerFactory.html could have a delete(Job) method, perhaps. Or JCloudsArtifactManager (or something else in the plugin) could check ItemListener.onDeleted and delete the whole directory with one API call.

workflowRun.delete();
}

// TODO call SCM.processWorkspaceBeforeDeletion
super.performDelete();
}
Expand Down