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

The 'Discard Old Builds' advanced option - removal of only artifacts - does not work for me after 1.503.

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • Fedora 18 x86_64

      Activating the 'Discard Old Builds' checkbox on a job allows an Advanced option to specify 'Max # of builds to keep with artifacts'.
      This does not seem to clean up the artifacts for my builds anymore.
      I have tested 1.502, 1.503, 1.504 up to 1.510. It works fine in 1.502 but in none of the later versions.

      The artifacts I refer to are archived with the default archiving mechanism (not the archiving that can be configured as a post-step).

          [JENKINS-17508] The 'Discard Old Builds' advanced option - removal of only artifacts - does not work for me after 1.503.

          Code changed in jenkins
          User: redlab
          Path:
          src/main/java/hudson/maven/MavenModuleSetBuild.java
          http://jenkins-ci.org/commit/maven-plugin/62637aad472803c7954bc54120dc4f5121146568
          Log:
          As this is my first look inside Jenkins codebase I not sure it's correct
          but perhaps artifacts for modulebuilds should be deleted just as logs
          are deleted. see https://issues.jenkins-ci.org/browse/JENKINS-17508
          I did not fully test it yet, all unit tests ran fine, but didn't succeed
          to run jobs inside Jenkins, due to classloader issues while running
          Jenkins in Jetty, to verify deletion

          Originally-Committed-As: d4459d9d0f99b951974f6ab1bedf6a580aad9248

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: redlab Path: src/main/java/hudson/maven/MavenModuleSetBuild.java http://jenkins-ci.org/commit/maven-plugin/62637aad472803c7954bc54120dc4f5121146568 Log: As this is my first look inside Jenkins codebase I not sure it's correct but perhaps artifacts for modulebuilds should be deleted just as logs are deleted. see https://issues.jenkins-ci.org/browse/JENKINS-17508 I did not fully test it yet, all unit tests ran fine, but didn't succeed to run jobs inside Jenkins, due to classloader issues while running Jenkins in Jetty, to verify deletion Originally-Committed-As: d4459d9d0f99b951974f6ab1bedf6a580aad9248

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/hudson/maven/MavenModuleSetBuild.java
          http://jenkins-ci.org/commit/maven-plugin/6f769759743d3765b27e0eff1c9b07b7b82f0878
          Log:
          Merge pull request #759 from redlab/JENKINS-17508

          [FIXED JENKINS-17508] Artifacts not being deleted by LogRotator
          Originally-Committed-As: 153c9a65ca1393e97a76588d7076883ec39710c5

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/hudson/maven/MavenModuleSetBuild.java http://jenkins-ci.org/commit/maven-plugin/6f769759743d3765b27e0eff1c9b07b7b82f0878 Log: Merge pull request #759 from redlab/ JENKINS-17508 [FIXED JENKINS-17508] Artifacts not being deleted by LogRotator Originally-Committed-As: 153c9a65ca1393e97a76588d7076883ec39710c5

          Code changed in jenkins
          User: redlab
          Path:
          test/src/test/java/hudson/maven/MavenMultiModuleLogRotatorCleanArtifacts.java
          test/src/test/java/hudson/maven/MavenMultiModuleLogRotatorCleanArtifactsTest.java
          http://jenkins-ci.org/commit/maven-plugin/40bdc86e98e38dee1a536e8151ac45b53f447be4
          Log:
          JENKINS-17508 updated the test to use @Rule and no longer extend from the old HudsonTestCase (shouldn't that one be marked deprecated?), add @ Bug and @ For as jesse suggested

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: redlab Path: test/src/test/java/hudson/maven/MavenMultiModuleLogRotatorCleanArtifacts.java test/src/test/java/hudson/maven/MavenMultiModuleLogRotatorCleanArtifactsTest.java http://jenkins-ci.org/commit/maven-plugin/40bdc86e98e38dee1a536e8151ac45b53f447be4 Log: JENKINS-17508 updated the test to use @Rule and no longer extend from the old HudsonTestCase (shouldn't that one be marked deprecated?), add @ Bug and @ For as jesse suggested

          Code changed in jenkins
          User: redlab
          Path:
          test/src/test/java/hudson/maven/MavenMultiModuleLogRotatorCleanArtifactsTest.java
          http://jenkins-ci.org/commit/maven-plugin/8fbb38d171470fa339a277eb38f9564f272f9148
          Log:
          JENKINS-17508 removed usage of deprecated elements in test

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: redlab Path: test/src/test/java/hudson/maven/MavenMultiModuleLogRotatorCleanArtifactsTest.java http://jenkins-ci.org/commit/maven-plugin/8fbb38d171470fa339a277eb38f9564f272f9148 Log: JENKINS-17508 removed usage of deprecated elements in test

          Sergei Ivanov added a comment -

          Hi,

          We are on Jenkins version 1.528, and we are still having an issue where module directories are not cleaned up. We came across this problem when we received a "low free disk space" alert from our build server, and discovered that some projects had tens of orphaned modules.

          At that point (18 Oct 2013), I changed the settings on all our Jenkins projects to the below, and removed all module directories from the file system. I checked it again today (01 Nov 2013), and there are new orphaned modules there again. If you look below, there is a module for each build, and then there are 8 orphaned modules for earlier builds.

          I have a theory that the modules are not properly cleaned up if the build fails, but I have not got a conclusive proof for that.

          Can you please confirm, which version of Jenkins or Maven plugin contains a bug fix for this issue?

          job config
            <logRotator class="hudson.tasks.LogRotator">
              <daysToKeep>7</daysToKeep>
              <numToKeep>5</numToKeep>
              <artifactDaysToKeep>7</artifactDaysToKeep>
              <artifactNumToKeep>5</artifactNumToKeep>
            </logRotator>
          
          find . -type d -name '2013*'
          ./mvn-xxx/builds/2013-10-28_16-55-29
          ./mvn-xxx/builds/2013-10-29_17-57-18
          ./mvn-xxx/builds/2013-10-30_14-03-54
          ./mvn-xxx/builds/2013-10-30_17-23-24
          ./mvn-xxx/builds/2013-10-30_17-29-20
          ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-18_18-14-42
          ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-21_17-09-59
          ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-23_17-08-49
          ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-23_17-11-45
          ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-25_17-45-23
          ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-28_14-03-14
          ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-28_14-56-33
          ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-28_16-33-42
          ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-28_16-55-31
          ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-29_17-57-20
          ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-30_14-03-55
          ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-30_17-23-25
          ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-30_17-29-22
          

          Sergei Ivanov added a comment - Hi, We are on Jenkins version 1.528, and we are still having an issue where module directories are not cleaned up. We came across this problem when we received a "low free disk space" alert from our build server, and discovered that some projects had tens of orphaned modules. At that point (18 Oct 2013), I changed the settings on all our Jenkins projects to the below, and removed all module directories from the file system. I checked it again today (01 Nov 2013), and there are new orphaned modules there again. If you look below, there is a module for each build, and then there are 8 orphaned modules for earlier builds. I have a theory that the modules are not properly cleaned up if the build fails, but I have not got a conclusive proof for that. Can you please confirm, which version of Jenkins or Maven plugin contains a bug fix for this issue? job config <logRotator class= "hudson.tasks.LogRotator" > <daysToKeep> 7 </daysToKeep> <numToKeep> 5 </numToKeep> <artifactDaysToKeep> 7 </artifactDaysToKeep> <artifactNumToKeep> 5 </artifactNumToKeep> </logRotator> find . -type d -name '2013*' ./mvn-xxx/builds/2013-10-28_16-55-29 ./mvn-xxx/builds/2013-10-29_17-57-18 ./mvn-xxx/builds/2013-10-30_14-03-54 ./mvn-xxx/builds/2013-10-30_17-23-24 ./mvn-xxx/builds/2013-10-30_17-29-20 ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-18_18-14-42 ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-21_17-09-59 ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-23_17-08-49 ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-23_17-11-45 ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-25_17-45-23 ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-28_14-03-14 ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-28_14-56-33 ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-28_16-33-42 ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-28_16-55-31 ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-29_17-57-20 ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-30_14-03-55 ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-30_17-23-25 ./mvn-xxx/modules/com.xxx.xxx$xxx/builds/2013-10-30_17-29-22

          Same problem than Sergei Ivanov.

          Stéphane Bruckert added a comment - Same problem than Sergei Ivanov.

          Thomas VIN added a comment -

          Hello,

          We're running Jenkins 1.533 and we still notice the same behavior reported by Sergei Ivanov.
          Even though we have old builds properly deleted, the clean is not propagated to the underlying modules for which we keep having a bunch of orphans.

          Best regards.

          Thomas VIN added a comment - Hello, We're running Jenkins 1.533 and we still notice the same behavior reported by Sergei Ivanov. Even though we have old builds properly deleted, the clean is not propagated to the underlying modules for which we keep having a bunch of orphans. Best regards.

          Stefan Cordes added a comment - - edited

          Got an
          Jan 28, 2014 9:03:44 AM hudson.model.Run execute
          SEVERE: Failed to rotate log
          java.io.IOException: e:\jenkins\jobs\<.....>\modules\com.<...>$<....>\builds\2013-10-23_11-57-46 looks to have already been deleted
          {{ at hudson.model.Run.delete(Run.java:1432)}}
          {{ at hudson.maven.MavenModuleSetBuild.delete(MavenModuleSetBuild.java:430)}}
          {{ at hudson.tasks.LogRotator.perform(LogRotator.java:124)}}
          {{ at hudson.model.Job.logRotate(Job.java:437)}}
          {{ at hudson.maven.MavenModuleSet.logRotate(MavenModuleSet.java:840)}}
          {{ at hudson.model.Run.execute(Run.java:1728)}}
          {{ at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:519)}}
          {{ at hudson.model.ResourceController.execute(ResourceController.java:88)}}
          {{ at hudson.model.Executor.run(Executor.java:246)}}
          with Jenkins ver. 1.532.1.
          (Mentioned directory 2013-10-23_11-57-46 is not existing on file system).

          LogRotator should continue deleting all other matching jobs.

          Stefan Cordes added a comment - - edited Got an Jan 28, 2014 9:03:44 AM hudson.model.Run execute SEVERE: Failed to rotate log java.io.IOException: e:\jenkins\jobs\<.....>\modules\com.<...>$<....>\builds\2013-10-23_11-57-46 looks to have already been deleted {{ at hudson.model.Run.delete(Run.java:1432)}} {{ at hudson.maven.MavenModuleSetBuild.delete(MavenModuleSetBuild.java:430)}} {{ at hudson.tasks.LogRotator.perform(LogRotator.java:124)}} {{ at hudson.model.Job.logRotate(Job.java:437)}} {{ at hudson.maven.MavenModuleSet.logRotate(MavenModuleSet.java:840)}} {{ at hudson.model.Run.execute(Run.java:1728)}} {{ at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:519)}} {{ at hudson.model.ResourceController.execute(ResourceController.java:88)}} {{ at hudson.model.Executor.run(Executor.java:246)}} with Jenkins ver. 1.532.1. (Mentioned directory 2013-10-23_11-57-46 is not existing on file system). LogRotator should continue deleting all other matching jobs.

          Jesse Glick added a comment -

          @baboulama, @sc_rsc: the originally reported bug here is fixed; do not reopen.

          Jesse Glick added a comment - @baboulama, @sc_rsc: the originally reported bug here is fixed; do not reopen.

          Jesse Glick added a comment -

          Filed JENKINS-22395 for a problem actually deleted old builds under unknown conditions.

          Jesse Glick added a comment - Filed JENKINS-22395 for a problem actually deleted old builds under unknown conditions.

            Unassigned Unassigned
            pjoran Per J. Lund
            Votes:
            6 Vote for this issue
            Watchers:
            22 Start watching this issue

              Created:
              Updated:
              Resolved: