Answers: <p>Per the Jenkins documentation:</p>
  
  <blockquote>
    <p>Cleanup per project/job is performed after that job runs.</p>
    
    <p>As of v2.221, cleanup will also periodically run using the new Global Build Discarders (even if a job has not recently been run).</p>
  </blockquote>
  
  <p><a href="https://support.cloudbees.com/hc/en-us/articles/215549798-Best-Strategy-for-Disk-Space-Management-Clean-Up-Old-Builds" rel="noreferrer">Source</a>.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-04-16T22:26:53.037Z
Answers: Thank you for the reply - I can confirm it cleans up after the job is run.
Answers: Avner
Answers: CC BY-SA 4.0
Answers: 2020-11-03T20:04:34.443Z
Answers: Any idea what "periodically" means for the global build discarders though?
Answers: GJP
Answers: CC BY-SA 4.0
Answers: 2022-01-10T10:40:59.067Z
Answers: The global cleanup period is set to hourly: https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/jenkins/model/BackgroundGlobalBuildDiscarder.java#L77-L79
Answers: Luminger
Answers: CC BY-SA 4.0
Answers: 2020-04-16T17:02:06.297Z
Answers: 2020-04-16T17:02:06.297Z
Answers: jayhendren
Body: <p>I have existing Jenkins (2.90) jobs that are taking up disk space. When I enable the "Discard Old Builds" option I don't see any cleanup going on in the folder on the builds older than 7 days.</p>
  
  <p>When does Jenkins do this cleanup? Or does it only apply for new builds after I apply the setting?</p>
  
  <p><a href="https://i.sstatic.net/5uI2R.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5uI2R.png" alt="Jenkins discard build option"></a></p>
  
Tags: <jenkins>
Title: When does Jenkins clean up old builds?
UserDisplayName: Avner
ThreadText: # When does Jenkins clean up old builds?
  
  (Asked by: username_0 on 2020-04-15)
  
  I have existing Jenkins (2.90) jobs that are taking up disk space. When I enable the "Discard Old Builds" option I don't see any cleanup going on in the folder on the builds older than 7 days.
  
  When does Jenkins do this cleanup? Or does it only apply for new builds after I apply the setting?
  
  [![Jenkins discard build option](https://i.sstatic.net/5uI2R.png)](https://i.sstatic.net/5uI2R.png)
  
  **Tags:** jenkins
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-04-16. Score: 5 | Accepted answer
  
  Per the Jenkins documentation:
  
  > Cleanup per project/job is performed after that job runs.
  >
  > As of v2.221, cleanup will also periodically run using the new Global Build Discarders (even if a job has not recently been run).
  
  [Source](https://support.cloudbees.com/hc/en-us/articles/215549798-Best-Strategy-for-Disk-Space-Management-Clean-Up-Old-Builds).
  
  > **Comments:**
  > **username_0**: Thank you for the reply - I can confirm it cleans up after the job is run.  
  > **username_2**: Any idea what "periodically" means for the global build discarders though?  
  > **username_3**: The global cleanup period is set to hourly: https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/jenkins/model/BackgroundGlobalBuildDiscarder.java#L77-L79  
  
  ---
  
  