Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #214 from rvanoo/master
[FIXED JENKINS-8880] - WorkspaceCleanupThread shouldn't simply delete custom workspace directories
  • Loading branch information
kutzi committed Aug 15, 2011
2 parents 6b5ef4b + be0720c commit 39d15d9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/src/main/java/hudson/model/WorkspaceCleanupThread.java
Expand Up @@ -96,11 +96,6 @@ private boolean shouldBeDeleted(String jobName, FilePath dir, Node n) throws IOE
// TODO: the use of remoting is not optimal.
// One remoting can execute "exists", "lastModified", and "delete" all at once.
TopLevelItem item = Jenkins.getInstance().getItem(jobName);
if(item==null) {
// no such project anymore
LOGGER.fine("Directory "+dir+" is not owned by any project");
return true;
}

if(!dir.exists())
return false;
Expand All @@ -112,6 +107,13 @@ private boolean shouldBeDeleted(String jobName, FilePath dir, Node n) throws IOE
return false;
}

// Assuming build name == workspace name breaks custom workspaces. Just skip out if the 30-day window doesn't catch it yet.
// TODO: Add a check that covers custom workspaces, if possible.
// TODO: If and when we do the above, also add checkbox that lets users configure a workspace to never be auto-cleaned.
if(item==null) {
return false;
}

if (item instanceof AbstractProject) {
AbstractProject p = (AbstractProject) item;
Node lb = p.getLastBuiltOn();
Expand Down

0 comments on commit 39d15d9

Please sign in to comment.