• Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • core
    • None

      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()
      }
      

          [JENKINS-13039] Max # of builds to keep not deleting old builds

          Yves DM added a comment -

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

          Yves DM added a comment - Encountering same issue. Using version 1.459 of jenkins on windows 2008 r2 plateform.

          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

          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

          Michael Wenk added a comment -

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

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

          Oleg Nenashev added a comment -

          @Michael
          The issue may be caused by JENKINS-18678

          Oleg Nenashev added a comment - @Michael The issue may be caused by JENKINS-18678

          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.

          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.

            Unassigned Unassigned
            allenservedio allenservedio
            Votes:
            12 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: