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

add option to keep a number of artifacts

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      None
    • Environment:
      Platform: All, OS: All

      Description

      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

        Issue Links

          Activity

          Hide
          vijayj vijayj added a comment -

          I have the same requirement. I don't want to delete the build, because once you
          delete the build then you lose all your history then i won't be able to produce
          the metrics....etc.

          o We also move our artifacts into our centralized server using scp plugin, so
          there is no need for hudson to keep them once we moved.
          o As the data grow, hudson takes longer to load during the first time.

          Show
          vijayj vijayj added a comment - I have the same requirement. I don't want to delete the build, because once you delete the build then you lose all your history then i won't be able to produce the metrics....etc. o We also move our artifacts into our centralized server using scp plugin, so there is no need for hudson to keep them once we moved. o As the data grow, hudson takes longer to load during the first time.
          Hide
          mdonohue mdonohue added a comment -
              • Issue 2144 has been marked as a duplicate of this issue. ***
          Show
          mdonohue mdonohue added a comment - Issue 2144 has been marked as a duplicate of this issue. ***
          Hide
          gliptak gliptak added a comment -

          Or maybe offer configuration for the number of artifacts to keep. Thanks

          Show
          gliptak gliptak added a comment - Or maybe offer configuration for the number of artifacts to keep. Thanks
          Hide
          jglick Jesse Glick added a comment -

          There is now main/test/src/test/java/hudson/tasks/ArtifactArchiverTest.java so
          it would not likely be too hard.

          Show
          jglick Jesse Glick added a comment - There is now main/test/src/test/java/hudson/tasks/ArtifactArchiverTest.java so it would not likely be too hard.
          Hide
          kohsuke Kohsuke Kawaguchi added a comment -

          I think this is also relatively easy to do as a plugin, which allows you to
          define a large amount of options for a desirable behavior.

          Show
          kohsuke Kohsuke Kawaguchi added a comment - I think this is also relatively easy to do as a plugin, which allows you to define a large amount of options for a desirable behavior.
          Hide
          mdonohue mdonohue added a comment -
              • Issue 3343 has been marked as a duplicate of this issue. ***
          Show
          mdonohue mdonohue added a comment - Issue 3343 has been marked as a duplicate of this issue. ***
          Hide
          mdonohue mdonohue added a comment -
              • Issue 1298 has been marked as a duplicate of this issue. ***
          Show
          mdonohue mdonohue added a comment - Issue 1298 has been marked as a duplicate of this issue. ***
          Hide
          davefollett 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.

          Show
          davefollett 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.
          Hide
          mdonohue mdonohue added a comment -
              • Issue 4198 has been marked as a duplicate of this issue. ***
          Show
          mdonohue mdonohue added a comment - Issue 4198 has been marked as a duplicate of this issue. ***
          Hide
          thosor 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

          Show
          thosor 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
          Hide
          mdonohue 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

          Show
          mdonohue 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
          Hide
          flominator 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

          Show
          flominator 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
          Hide
          scm_issue_link 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

          Show
          scm_issue_link 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
          Hide
          abayer abayer added a comment -

          This will be live in 1.350.

          Show
          abayer abayer added a comment - This will be live in 1.350.
          Hide
          flominator Flominator added a comment -

          Where exactly can I find the new option?

          Show
          flominator Flominator added a comment - Where exactly can I find the new option?
          Hide
          allenr 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

          Show
          allenr 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

            People

            • Assignee:
              abayer abayer
              Reporter:
              gradopado gradopado
            • Votes:
              22 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: