WorkspaceCleanupThread does not handle folders

Details

Description

Only considers direct subdirectories of jobs, and later calls getItem which can only work for top-level jobs.

Also process(Jenkins) is only looking for $JENKINS_HOME/jobs/*/workspace/ for builds run on master, which is deprecated—new installations use $JENKINS_HOME/workspace/*/. Ideally would handle any workspace location pattern, since this is configurable.

Activity

Marking an LTS candidate since the current code not only fails to consider jobs in folders individually; it also tends to delete the workspaces of all jobs inside any folder when the timestamp on the top-level directory is at least a month old, even when the jobs are actively being built on that node. The only workaround for people using folders is to use -Dhudson.model.WorkspaceCleanupThread.disabled to turn this feature off entirely.

Jesse Glick
added a comment - 2014-02-04 16:37 Marking an LTS candidate since the current code not only fails to consider jobs in folders individually; it also tends to delete the workspaces of all jobs inside any folder when the timestamp on the top-level directory is at least a month old, even when the jobs are actively being built on that node. The only workaround for people using folders is to use -Dhudson.model.WorkspaceCleanupThread.disabled to turn this feature off entirely.

Code changed in jenkins
User: Jesse Glick
Path:
changelog.html
core/src/main/java/hudson/model/WorkspaceCleanupThread.java
test/src/test/java/hudson/model/WorkspaceCleanupThreadTest.javahttp://jenkins-ci.org/commit/jenkins/cd526e99e63ae362f2d1ce1a04c3c68a38032a5c
Log:[FIXED JENKINS-21023] Rewrote WorkspaceCleanupThread to determine where workspaces for known items should be, rather than looking for directories that look like they might be workspaces.
One key advantage is that this correctly handles the new default workspace location on the master.
Another is that this allows folders to be correctly skipped, and jobs in folders to be correctly deleted.
A subtler advantage would be handling of configured nondefault workspace locations, and compatibility with WorkspaceLocator.
(Orphaned workspaces from deleted jobs are not removed, but these were not removed before either.)

SCM/JIRA link daemon
added a comment - 2014-02-04 17:40 Code changed in jenkins
User: Jesse Glick
Path:
changelog.html
core/src/main/java/hudson/model/WorkspaceCleanupThread.java
test/src/test/java/hudson/model/WorkspaceCleanupThreadTest.java
http://jenkins-ci.org/commit/jenkins/cd526e99e63ae362f2d1ce1a04c3c68a38032a5c
Log:
[FIXED JENKINS-21023] Rewrote WorkspaceCleanupThread to determine where workspaces for known items should be, rather than looking for directories that look like they might be workspaces.
One key advantage is that this correctly handles the new default workspace location on the master.
Another is that this allows folders to be correctly skipped, and jobs in folders to be correctly deleted.
A subtler advantage would be handling of configured nondefault workspace locations, and compatibility with WorkspaceLocator.
(Orphaned workspaces from deleted jobs are not removed, but these were not removed before either.)

Integrated in jenkins_main_trunk #3192[FIXED JENKINS-21023] Rewrote WorkspaceCleanupThread to determine where workspaces for known items should be, rather than looking for directories that look like they might be workspaces. (Revision cd526e99e63ae362f2d1ce1a04c3c68a38032a5c)

Code changed in jenkins
User: Jesse Glick
Path:
core/src/main/java/hudson/model/WorkspaceCleanupThread.java
test/src/test/java/hudson/model/WorkspaceCleanupThreadTest.javahttp://jenkins-ci.org/commit/jenkins/6b474c279dcc473c063a84f29d37b0123a4bc192
Log:[FIXED JENKINS-21023] Rewrote WorkspaceCleanupThread to determine where workspaces for known items should be, rather than looking for directories that look like they might be workspaces.
One key advantage is that this correctly handles the new default workspace location on the master.
Another is that this allows folders to be correctly skipped, and jobs in folders to be correctly deleted.
A subtler advantage would be handling of configured nondefault workspace locations, and compatibility with WorkspaceLocator.
(Orphaned workspaces from deleted jobs are not removed, but these were not removed before either.)
(cherry picked from commit cd526e99e63ae362f2d1ce1a04c3c68a38032a5c)

SCM/JIRA link daemon
added a comment - 2014-02-26 19:53 Code changed in jenkins
User: Jesse Glick
Path:
core/src/main/java/hudson/model/WorkspaceCleanupThread.java
test/src/test/java/hudson/model/WorkspaceCleanupThreadTest.java
http://jenkins-ci.org/commit/jenkins/6b474c279dcc473c063a84f29d37b0123a4bc192
Log:
[FIXED JENKINS-21023] Rewrote WorkspaceCleanupThread to determine where workspaces for known items should be, rather than looking for directories that look like they might be workspaces.
One key advantage is that this correctly handles the new default workspace location on the master.
Another is that this allows folders to be correctly skipped, and jobs in folders to be correctly deleted.
A subtler advantage would be handling of configured nondefault workspace locations, and compatibility with WorkspaceLocator.
(Orphaned workspaces from deleted jobs are not removed, but these were not removed before either.)
(cherry picked from commit cd526e99e63ae362f2d1ce1a04c3c68a38032a5c)
Conflicts:
changelog.html
Compare: https://github.com/jenkinsci/jenkins/compare/93500aeaa5e8...6b474c279dcc