Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-21322

Cleanup workspace when last build is >X days ago

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • core

      We have a Jenkins install with lots of different jobs, most of them are triggered by SCM changes. In addition to be able to prune old builds, it would be desirable to be able to clean up the workspace if the last build was more than a specified number of days ago.

          [JENKINS-21322] Cleanup workspace when last build is >X days ago

          Lieuwe Hummel created issue -

          Anders Hammar added a comment -

          I don't really understand the use case here. Are you saying that you would like the workspace to be cleaned if the last build was, for example, more than 2 days ago? So then if there is at least one build every day, the workspace is never cleaned?

          The use case I have is that I want the workspace to be cleaned every day, but not more than once per day.

          Anders Hammar added a comment - I don't really understand the use case here. Are you saying that you would like the workspace to be cleaned if the last build was, for example, more than 2 days ago? So then if there is at least one build every day, the workspace is never cleaned? The use case I have is that I want the workspace to be cleaned every day, but not more than once per day.
          Anders Hammar made changes -
          Link New: This issue is related to JENKINS-11054 [ JENKINS-11054 ]

          Daniel Beck added a comment -

          This request appears to be a a very limited use case.

          Daniel Beck added a comment - This request appears to be a a very limited use case.

          Lieuwe Hummel added a comment -

          My use case is that we have a fair amount of projects. For the day-to-day code analysis and builds, we leave the workspace as is. But I would like to see this feature as a cleanup tool: keep the jobs related to the project, but clear the workspace to preserve diskspace after, say, 60 days or so.
          But a scheduled cleanup of the workspace would solve my case for some fair part i think,

          Lieuwe Hummel added a comment - My use case is that we have a fair amount of projects. For the day-to-day code analysis and builds, we leave the workspace as is. But I would like to see this feature as a cleanup tool: keep the jobs related to the project, but clear the workspace to preserve diskspace after, say, 60 days or so. But a scheduled cleanup of the workspace would solve my case for some fair part i think,

          Daniel Beck added a comment -

          clear the workspace to preserve diskspace after, say, 60 days or so.

          Something like this is a Jenkins core feature. Set up a log recorder for the logger hudson.model.WorkspaceCleanupThread in /log to see what it's doing.

          Daniel Beck added a comment - clear the workspace to preserve diskspace after, say, 60 days or so. Something like this is a Jenkins core feature. Set up a log recorder for the logger hudson.model.WorkspaceCleanupThread in /log to see what it's doing.

          Lieuwe Hummel added a comment -

          Thanks, did not known about that yet, I'll give it a try

          Lieuwe Hummel added a comment - Thanks, did not known about that yet, I'll give it a try
          Oliver Gondža made changes -
          Component/s New: core [ 15593 ]
          Component/s Original: ws-cleanup-plugin [ 15930 ]
          Assignee Original: vjuranek [ vjuranek ]
          Issue Type Original: New Feature [ 2 ] New: Improvement [ 4 ]

          Moving this to core (as that is where hudson.model.WorkspaceCleanupThread currently resides). Though, the reoccurrence period nor the maximal workspace age can not be configured as requested.

          Oliver Gondža added a comment - Moving this to core (as that is where hudson.model.WorkspaceCleanupThread currently resides). Though, the reoccurrence period nor the maximal workspace age can not be configured as requested.
          Oliver Gondža made changes -
          Assignee New: Oliver Gondža [ olivergondza ]

            olivergondza Oliver Gondža
            lurkie Lieuwe Hummel
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: