• Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None
    • Platform: All, OS: All

      Currently you can configure a job to keep either artifacts of all builds or only
      from the latest successful build.

      I have a job with quite large artifacts. I want to keep a long build history
      (logs and build times). Also I would like to keep the latest 5 artifacts (or so)
      to be able to analyze them etc..

      For this to work I would like to have an option in the artifacts settings:
      Instead of:
      [ ] Discard all but the last successful artifact to save disk space
      I propose:
      [ ] Keep only artifacts of the last [<number>] successful builds to save disk space

          [JENKINS-834] add option to keep a number of artifacts

          mdonohue added a comment -
              • Issue 1298 has been marked as a duplicate of this issue. ***

          mdonohue added a comment - Issue 1298 has been marked as a duplicate of this issue. ***

          davefollett added a comment -

          I would love this feature as part of the Hudson or in a plugin. I just found
          out the hard way how much data I am keeping as artifacts and more control over
          how long artifacts are kept would be great.

          davefollett added a comment - I would love this feature as part of the Hudson or in a plugin. I just found out the hard way how much data I am keeping as artifacts and more control over how long artifacts are kept would be great.

          mdonohue added a comment -
              • Issue 4198 has been marked as a duplicate of this issue. ***

          mdonohue added a comment - Issue 4198 has been marked as a duplicate of this issue. ***

          Thomas S. added a comment -

          Hello there,
          is there something new?.
          i have exactly the same requirement.
          At the moment i must remove the artifacts manually every week.
          Maybe the priority should be set to blocker

          Thomas S. added a comment - Hello there, is there something new?. i have exactly the same requirement. At the moment i must remove the artifacts manually every week. Maybe the priority should be set to blocker

          mdonohue added a comment -

          Voting for the issue would be a more effective way of getting it attention:
          http://issues.jenkins-ci.org/secure/ViewIssue.jspa?id=130907&vote=vote

          mdonohue added a comment - Voting for the issue would be a more effective way of getting it attention: http://issues.jenkins-ci.org/secure/ViewIssue.jspa?id=130907&vote=vote

          Flominator added a comment - - edited

          I would also love to have a such a feature.

          Some months ago we did a windows batch script, that keeps artifacts of tagged builds and the latest one:

          @ECHO OFF
          ECHO delete all builds that are not tagged or the latest one
          SET JOBSPACE=C:\Dokumente und Einstellungen\Administrator\.hudson\jobs\theproduct\builds

          C:
          cd "%JOBSPACE%"
          for /F "delims=!" %%f in ('dir build.xml /s /b') DO ( REM currently editing %%f
          FINDSTR /C:"/tags/" "%%f" > nul
          IF ERRORLEVEL 1 (REM echo build was not not tagged
          IF /I NOT "%%f"=="%JOBSPACE%%BUILD_ID%\build.xml" (REM echo delete %%~dpfarchive (the corresponding archive folder)
          rd /q /s "%%~dpfarchive" 2>nul
          )
          )
          )
          ECHO.
          exit 0

          I think one might take this script and modify it to delete the last n builds

          Flominator added a comment - - edited I would also love to have a such a feature. Some months ago we did a windows batch script, that keeps artifacts of tagged builds and the latest one: @ECHO OFF ECHO delete all builds that are not tagged or the latest one SET JOBSPACE=C:\Dokumente und Einstellungen\Administrator\.hudson\jobs\theproduct\builds C: cd "%JOBSPACE%" for /F "delims=!" %%f in ('dir build.xml /s /b') DO ( REM currently editing %%f FINDSTR /C:"/tags/" "%%f" > nul IF ERRORLEVEL 1 (REM echo build was not not tagged IF /I NOT "%%f"=="%JOBSPACE%%BUILD_ID%\build.xml" (REM echo delete %%~dpfarchive (the corresponding archive folder) rd /q /s "%%~dpfarchive" 2>nul ) ) ) ECHO. exit 0 I think one might take this script and modify it to delete the last n builds

          Code changed in hudson
          User: : abayer
          Path:
          trunk/hudson/main/core/src/main/java/hudson/model/Run.java
          trunk/hudson/main/core/src/main/java/hudson/tasks/LogRotator.java
          trunk/hudson/main/core/src/main/resources/hudson/tasks/LogRotator/config.jelly
          trunk/hudson/main/test/src/test/java/hudson/tasks/ArtifactArchiverTest.java
          trunk/hudson/main/test/src/test/java/hudson/tasks/LogRotatorTest.java
          trunk/www/changelog.html
          http://jenkins-ci.org/commit/28293
          Log:
          [FIXED JENKINS-834] Added advanced option to delete artifacts without deleting the rest of the build

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : abayer Path: trunk/hudson/main/core/src/main/java/hudson/model/Run.java trunk/hudson/main/core/src/main/java/hudson/tasks/LogRotator.java trunk/hudson/main/core/src/main/resources/hudson/tasks/LogRotator/config.jelly trunk/hudson/main/test/src/test/java/hudson/tasks/ArtifactArchiverTest.java trunk/hudson/main/test/src/test/java/hudson/tasks/LogRotatorTest.java trunk/www/changelog.html http://jenkins-ci.org/commit/28293 Log: [FIXED JENKINS-834] Added advanced option to delete artifacts without deleting the rest of the build

          Andrew Bayer added a comment -

          This will be live in 1.350.

          Andrew Bayer added a comment - This will be live in 1.350.

          Flominator added a comment -

          Where exactly can I find the new option?

          Flominator added a comment - Where exactly can I find the new option?

          allenr added a comment -

          @flominator, Go to project configuration, check "Discard Old builds", Click "Advanced", you'll see "Days to keep artifacts" and "Max # of builds to keep with artifacts".

          Outstanding functionality, I'm so happy to see this in here finally

          allenr added a comment - @flominator, Go to project configuration, check "Discard Old builds", Click "Advanced", you'll see "Days to keep artifacts" and "Max # of builds to keep with artifacts". Outstanding functionality, I'm so happy to see this in here finally

            abayer Andrew Bayer
            gradopado gradopado
            Votes:
            22 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: