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

Max # of builds to keep not deleting old builds

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Not A Defect
    • Component/s: core
    • Labels:
      None
    • Similar Issues:

      Description

      Setting the "Max # of builds to keep" for a job does not cause old builds to be discarded. I set this as Major as this will lead to the build system dying after running out of disk space.

      I have found a work around here: http://groups.google.com/group/jenkinsci-users/browse_thread/thread/5573bee99bc2c42d

      I created a job in my Jenkins instance to run the following groovy script (as a "system" groovy script - not sure if that matters...) - this forces the old builds to be discarded per what I have defined in the config:

      import hudson.model.*
      for(job in Hudson.instance.items) {
         job.logRotate()
      }
      

        Attachments

          Activity

          Hide
          yvesdm Yves DM added a comment -

          Encountering same issue.
          Using version 1.459 of jenkins on windows 2008 r2 plateform.

          Show
          yvesdm Yves DM added a comment - Encountering same issue. Using version 1.459 of jenkins on windows 2008 r2 plateform.
          Hide
          grmpcerber Thomas B added a comment -

          Same issue here too.
          In addition

          job.logRotate()

          encounters "delete" exceptions on a few % of my build (it manages to delete the build but think it's still here ...) and since I've stacked 800+ builds (instead of 4) it's pretty enoying

          Using version

          Jenkins ver. 1.489

          on Linux

          Show
          grmpcerber Thomas B added a comment - Same issue here too. In addition job.logRotate() encounters "delete" exceptions on a few % of my build (it manages to delete the build but think it's still here ...) and since I've stacked 800+ builds (instead of 4) it's pretty enoying Using version Jenkins ver. 1.489 on Linux
          Hide
          mwenk_posportal Michael Wenk added a comment -

          Running 1.512 and have same issue. UI shows one build (what it should) and disk shows 20.

          Show
          mwenk_posportal Michael Wenk added a comment - Running 1.512 and have same issue. UI shows one build (what it should) and disk shows 20.
          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          @Michael
          The issue may be caused by JENKINS-18678

          Show
          oleg_nenashev Oleg Nenashev added a comment - @Michael The issue may be caused by JENKINS-18678
          Hide
          danielbeck Daniel Beck added a comment -

          logRotate() is called whenever a build is finished.

          So it's not sufficient to just configure this value and expect old builds to get cleaned up immediately (which is how I interpret the issue – the script basically does for all jobs what individually is done after a build).

          Adding a button to manually trigger cleanup or something like that is best handled by a plugin.

          What could be done is improve the documentation to clarify that old builds are cleaned up only after a new build finishes.

          Show
          danielbeck Daniel Beck added a comment - logRotate() is called whenever a build is finished. So it's not sufficient to just configure this value and expect old builds to get cleaned up immediately (which is how I interpret the issue – the script basically does for all jobs what individually is done after a build). Adding a button to manually trigger cleanup or something like that is best handled by a plugin. What could be done is improve the documentation to clarify that old builds are cleaned up only after a new build finishes.

            People

            • Assignee:
              Unassigned
              Reporter:
              allenservedio allenservedio
            • Votes:
              12 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: