You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[JENKINS-17508] The 'Discard Old Builds' advanced option - removal of only artifacts - does not work for me after 1.503. #14473
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).
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).
The log seen in version 1.502 is e.g:
INFO: artifactsDir = /var/lib/jenkins/jobs/PJLTEST/modules/com.corena.core$repository-management/builds/2013-04-08_20-28-13/archive
while in 1.510 it is e.g.:
INFO: artifactsDir = /var/lib/jenkins/jobs/PJLTEST/builds/2013-04-08_20-29-49/archive
This shows that it is a completely different behaviour between the two version and now artifacts will be removed as the directory seen in 1.510 does not even exist.
I have investigated this problem further and found the following:
I have added some log to the LogRotator.java in both 1.502 and 1.510 - in the 'perform' method:
Added print-out of artifactsDir in the loop below:
if(artifactNumToKeep!=null && artifactNumToKeep!=-1) {
List> builds = job.getBuilds();
for (Run r : copy(builds.subList(Math.min(builds.size(), artifactNumToKeep), builds.size()))) {
LOGGER.log(INFO, "artifactsDir =
{0}
", r.getArtifactsDir());
The log seen in version 1.502 is e.g:
INFO: artifactsDir = /var/lib/jenkins/jobs/PJLTEST/modules/com.corena.core$repository-management/builds/2013-04-08_20-28-13/archive
while in 1.510 it is e.g.:
INFO: artifactsDir = /var/lib/jenkins/jobs/PJLTEST/builds/2013-04-08_20-29-49/archive
This shows that it is a completely different behaviour between the two version and now artifacts will be removed as the directory seen in 1.510 does not even exist.
It seems to me that each of the modules have their own configuration file. But the tag e.g.
<logRotator class="hudson.tasks.LogRotator">
<daysToKeep>-1</daysToKeep>
<numToKeep>50</numToKeep>
<artifactDaysToKeep>-1</artifactDaysToKeep>
<artifactNumToKeep>2</artifactNumToKeep>
</logRotator>
that enables the cleanup is not propagated to these build modules configuration files. It is in the master configuration file of the job though. I think if you add logRotator to the modules config.xml they will be cleaned. I'll add it to some jobs on our Jenkins on Monday to see if that is the case.
It seems to me that each of the modules have their own configuration file. But the tag e.g.
-1
50
-1
2
that enables the cleanup is not propagated to these build modules configuration files. It is in the master configuration file of the job though. I think if you add logRotator to the modules config.xml they will be cleaned. I'll add it to some jobs on our Jenkins on Monday to see if that is the case.
LogRotator delegates the delete to the actual Run, for just the log files the delete is delegated all the way to the MavenModuleSetBuild, however for the deleteArtifacts this is not done.
My knowledge of the Jenkins code base is very small at the moment. Just starting to get a grasp of it. But here is what I mean, https://github.com/redlab/jenkins/commit/d4459d9d0f99b951974f6ab1bedf6a580a some lines of code can say more then words. I've ran all unit tests but didn't add one yet. ( if this could fix it I can create a pull request if you want )
LogRotator delegates the delete to the actual Run, for just the log files the delete is delegated all the way to the MavenModuleSetBuild, however for the deleteArtifacts this is not done.
My knowledge of the Jenkins code base is very small at the moment. Just starting to get a grasp of it. But here is what I mean, https://github.com/redlab/jenkins/commit/d4459d9d0f99b951974f6ab1bedf6a580a some lines of code can say more then words. I've ran all unit tests but didn't add one yet. ( if this could fix it I can create a pull request if you want )
I have tested your code change in my test environment and it seems to be working!
The LogRotator plugin now deletes the artifacts and keeps the logs as it should.
I have tested your code change in my test environment and it seems to be working!
The LogRotator plugin now deletes the artifacts and keeps the logs as it should.
Code changed in jenkins
User: redlab
Path:
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
http://jenkins-ci.org/commit/jenkins/d4459d9d0f99b951974f6ab1bedf6a580aad9248
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
Code changed in jenkins
User: redlab
Path:
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java http://jenkins-ci.org/commit/jenkins/d4459d9d0f99b951974f6ab1bedf6a580aad9248
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
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/jenkins/aa1d28b04014c18838e87b3a8b1707cc5eb28b14
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/MavenMultiModuleLogRotatorCleanArtifacts.java
test/src/test/java/hudson/maven/MavenMultiModuleLogRotatorCleanArtifactsTest.java http://jenkins-ci.org/commit/jenkins/aa1d28b04014c18838e87b3a8b1707cc5eb28b14
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
Integrated in jenkins_main_trunk #2507JENKINS-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 (Revision aa1d28b04014c18838e87b3a8b1707cc5eb28b14)
JENKINS-17508 removed usage of deprecated elements in test (Revision f9ce6558c93d7f7ff0f8df12fb80f9ecc868ff99)
JENKINS-17508 Noting. (Revision 09ae9c00d39dbe824e5f0fdcd8861ec245ed057f)
Integrated in jenkins_main_trunk #2507 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 (Revision aa1d28b) JENKINS-17508 removed usage of deprecated elements in test (Revision f9ce655) JENKINS-17508 Noting. (Revision 09ae9c0)
I've upgraded to Jenkins 1.515 from 1.506 exactly because I wanted this functionality to work but it still does not remove old modules from SOME_JOB/modules/SOME_MODULE/builds
I've upgraded to Jenkins 1.515 from 1.506 exactly because I wanted this functionality to work but it still does not remove old modules from SOME_JOB/modules/SOME_MODULE/builds
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.
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.
Got an
Jan 28, 2014 9:03:44 AM hudson.model.Run executeSEVERE: Failed to rotate logjava.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.
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.
Activity
jenkins-infra-bot commentedon Apr 8, 2013
pjoran:
Raw content of original comment:
I have investigated this problem further and found the following:
I have added some log to the LogRotator.java in both 1.502 and 1.510 - in the 'perform' method:
Added print-out of artifactsDir in the loop below:
if(artifactNumToKeep!=null && artifactNumToKeep!=-1) {
{0}List> builds = job.getBuilds();
for (Run r : copy(builds.subList(Math.min(builds.size(), artifactNumToKeep), builds.size()))) {
LOGGER.log(INFO, "artifactsDir =
", r.getArtifactsDir());
The log seen in version 1.502 is e.g:
INFO: artifactsDir = /var/lib/jenkins/jobs/PJLTEST/modules/com.corena.core$repository-management/builds/2013-04-08_20-28-13/archive
while in 1.510 it is e.g.:
INFO: artifactsDir = /var/lib/jenkins/jobs/PJLTEST/builds/2013-04-08_20-29-49/archive
This shows that it is a completely different behaviour between the two version and now artifacts will be removed as the directory seen in 1.510 does not even exist.
jenkins-infra-bot commentedon Apr 9, 2013
Raw content of original comment:
Wondering if it's related to this change:
What's new in 1.503 (2013/02/26)
jenkins-infra-bot commentedon Apr 9, 2013
pjoran:
Raw content of original comment:
Yes, it is related to that change.
Unfortunately I don't have the insight to fix the problem, because it is causing us full disks...
jenkins-infra-bot commentedon Apr 12, 2013
Raw content of original comment:
It seems to me that each of the modules have their own configuration file. But the tag e.g.
-1
50
-1
2
that enables the cleanup is not propagated to these build modules configuration files. It is in the master configuration file of the job though. I think if you add logRotator to the modules config.xml they will be cleaned. I'll add it to some jobs on our Jenkins on Monday to see if that is the case.
jenkins-infra-bot commentedon Apr 15, 2013
Raw content of original comment:
LogRotator delegates the delete to the actual Run, for just the log files the delete is delegated all the way to the MavenModuleSetBuild, however for the deleteArtifacts this is not done.
My knowledge of the Jenkins code base is very small at the moment. Just starting to get a grasp of it. But here is what I mean, https://github.com/redlab/jenkins/commit/d4459d9d0f99b951974f6ab1bedf6a580a some lines of code can say more then words. I've ran all unit tests but didn't add one yet. ( if this could fix it I can create a pull request if you want )
jenkins-infra-bot commentedon Apr 16, 2013
pjoran:
Raw content of original comment:
I have tested your code change in my test environment and it seems to be working!
The LogRotator plugin now deletes the artifacts and keeps the logs as it should.
jenkins-infra-bot commentedon Apr 16, 2013
Raw content of original comment:
Great, I had some merge issues with the pull request yesterday night. I'll try send a new one to jenkins-ci github
jenkins-infra-bot commentedon Apr 16, 2013
Raw content of original comment:
I've send a pull request, #759 AFIAK there no merge issues on my side. Maybe there's an issue with the workspace at https://jenkins.ci.cloudbees.com/job/core/job/jenkins_main_trunk/
jenkins-infra-bot commentedon May 2, 2013
Raw content of original comment:
Code changed in jenkins
User: redlab
Path:
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
http://jenkins-ci.org/commit/jenkins/d4459d9d0f99b951974f6ab1bedf6a580aad9248
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
jenkins-infra-bot commentedon May 2, 2013
Raw content of original 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/jenkins/aa1d28b04014c18838e87b3a8b1707cc5eb28b14
Log:
JENKINS-17508updated 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 suggestedjenkins-infra-bot commentedon May 2, 2013
Raw content of original comment:
Code changed in jenkins
User: redlab
Path:
test/src/test/java/hudson/maven/MavenMultiModuleLogRotatorCleanArtifactsTest.java
http://jenkins-ci.org/commit/jenkins/f9ce6558c93d7f7ff0f8df12fb80f9ecc868ff99
Log:
JENKINS-17508removed usage of deprecated elements in testjenkins-infra-bot commentedon May 2, 2013
Raw content of original comment:
Code changed in jenkins
User: Jesse Glick
Path:
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
test/src/test/java/hudson/maven/MavenMultiModuleLogRotatorCleanArtifactsTest.java
http://jenkins-ci.org/commit/jenkins/153c9a65ca1393e97a76588d7076883ec39710c5
Log:
Merge pull request #759 from redlab/
JENKINS-17508[FIXED JENKINS-17508] Artifacts not being deleted by LogRotator
Compare: 31eeb75...153c9a6
jenkins-infra-bot commentedon May 2, 2013
Raw content of original comment:
Code changed in jenkins
User: Jesse Glick
Path:
changelog.html
http://jenkins-ci.org/commit/jenkins/09ae9c00d39dbe824e5f0fdcd8861ec245ed057f
Log:
JENKINS-17508Noting.jenkins-infra-bot commentedon May 2, 2013
Raw content of original comment:
balder : f9ce6558c93d7f7ff0f8df12fb80f9ecc868ff99 Files :
Jesse Glick : 09ae9c00d39dbe824e5f0fdcd8861ec245ed057f Files :
Integrated in
jenkins_main_trunk #2507
JENKINS-17508updated 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 (Revision aa1d28b)JENKINS-17508removed usage of deprecated elements in test (Revision f9ce655)JENKINS-17508Noting. (Revision 09ae9c0)Result = SUCCESS
balder : aa1d28b04014c18838e87b3a8b1707cc5eb28b14
Files :
balder : f9ce6558c93d7f7ff0f8df12fb80f9ecc868ff99
Files :
Jesse Glick : 09ae9c00d39dbe824e5f0fdcd8861ec245ed057f
Files :
jenkins-infra-bot commentedon May 23, 2013
tomekk:
Raw content of original comment:
I've upgraded to Jenkins 1.515 from 1.506 exactly because I wanted this functionality to work but it still does not remove old modules from SOME_JOB/modules/SOME_MODULE/builds
15 remaining items
jenkins-infra-bot commentedon Dec 20, 2013
baboulama:
Raw content of original 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.
jenkins-infra-bot commentedon Jan 28, 2014
sc_rsc:
Raw content of original comment:
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.
jenkins-infra-bot commentedon Mar 27, 2014
Raw content of original comment:
@baboulama, @sc_rsc: the originally reported bug here is fixed; do not reopen.
jenkins-infra-bot commentedon Mar 27, 2014
Raw content of original comment:
Filed
JENKINS-22395for a problem actually deleted old builds under unknown conditions.jenkins-infra-bot commentedon Nov 24, 2025
[Original
duplicatesfrom Jira: JENKINS-17355]jenkins-infra-bot commentedon Nov 24, 2025
[Original
is_duplicated_byfrom Jira: JENKINS-17553]jenkins-infra-bot commentedon Nov 24, 2025
[Original
relates_tofrom Jira: JENKINS-22395]