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

Allow cleaning up parts of Jacoco report artifcats retained

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • jacoco-plugin
    • None

      I'm using Jacoco to record code coverage in my builds. I'd love to be able to keep a long term trend chart to see how the coverage is increasing or decreasing over time. However, If I choose to keep say 30 builds but only the last build's artifacts, my jacoco/classes folder under all those builds still retains my compiled code for those 30 builds. In my case that folder is roughly 480Mb, so Jacoco is eating disk space like crazy.

      I'd love the option for jacoco to keep N builds' worth of classes/sources (or honor my existing artifacts settings) but retain the entire history of execfiles for trend charts.

      We don't really care that much about doing deep dives into old builds' coverage for specific classes/etc but do compare about seeing the trends and doing deep dives on the last N builds' data.

          [JENKINS-23066] Allow cleaning up parts of Jacoco report artifcats retained

          Andrew Harris added a comment -

          I have the exact use-case described here. I don't want to keep all of the Jacoco artifacts, but I do want to maintain a long-term coverage graph. I can't find a good way to do this without a slightly dangerous shell script. Having the option to remove Jacoco artifacts after publishing would be great.

          Andrew Harris added a comment - I have the exact use-case described here. I don't want to keep all of the Jacoco artifacts, but I do want to maintain a long-term coverage graph. I can't find a good way to do this without a slightly dangerous shell script. Having the option to remove Jacoco artifacts after publishing would be great.

          Just the same here. Very much space eaten on disk by jacoco (like 30M per build, hungreds of builds), don't want to dive deep into old coverage reports, but want to see the historical graphs only.

          Andrey Regentov added a comment - Just the same here. Very much space eaten on disk by jacoco (like 30M per build, hungreds of builds), don't want to dive deep into old coverage reports, but want to see the historical graphs only.

          Same problem here, 36MB per build and want to see just the historical graphs.

          Marcos Holgado added a comment - Same problem here, 36MB per build and want to see just the historical graphs.

          Hua Zhang added a comment -

          Same here. Does anybody have a workaround in the mean time?

          Hua Zhang added a comment - Same here. Does anybody have a workaround in the mean time?

          Nikolas Falco added a comment -

          Me too.
          In addition due actually limitation of plugin to describe which source folder should be keept, for a tycho-maven build for example, we specify something like /src//,
          all files in these folder (source and resources like .xml .pdf .js .html .jps .gif.....) are copied to jobs/JOB1/builds/$BUILD_ID/jacoco/sources, gathering about 2.2GB for each build.
          I think plugins should collect only files that matches entry in .exec file and/or permit a better selector on which resources have to copy.

          Actual workaround add a shell script that delete sources folder in jacoco folder for previous build.

          export BUILDS_FOLDER=`dirname $WORKSPACE`/builds
          
          for folder in `ls $BUILDS_FOLDER | grep "[0-9]\{1,\}" | grep -v $BUILD_ID`; do
              echo Deleting "$BUILDS_FOLDER/$folder/jacoco/sources" ; rm -rf "$BUILDS_FOLDER/$folder/jacoco/sources" ;
          done;
          

          Nikolas Falco added a comment - Me too. In addition due actually limitation of plugin to describe which source folder should be keept, for a tycho-maven build for example, we specify something like /src/ / , all files in these folder (source and resources like .xml .pdf .js .html .jps .gif.....) are copied to jobs/JOB1/builds/$BUILD_ID/jacoco/sources, gathering about 2.2GB for each build. I think plugins should collect only files that matches entry in .exec file and/or permit a better selector on which resources have to copy. Actual workaround add a shell script that delete sources folder in jacoco folder for previous build. export BUILDS_FOLDER=`dirname $WORKSPACE`/builds for folder in `ls $BUILDS_FOLDER | grep "[0-9]\{1,\}" | grep -v $BUILD_ID`; do echo Deleting "$BUILDS_FOLDER/$folder/jacoco/sources" ; rm -rf "$BUILDS_FOLDER/$folder/jacoco/sources" ; done;

          Michiel Hendriks added a comment - - edited

          This disk eating feature makes the plugin pretty much unusable for us. Build jobs went up from around 70MiB to over 900MiB.

          The classes directory is close to 500MiB even though the actual produced class files is less than 100MiB.
          It's storing files more than once is different directories, once per path element:

          ./SomeCensoredClass.class
          ./action/SomeCensoredClass.class
          ./shipmenttype/action/SomeCensoredClass.class
          ./control/shipmenttype/action/SomeCensoredClass.class
          ./oms/control/shipmenttype/action/SomeCensoredClass.class
          ./foobarquux/oms/control/shipmenttype/action/SomeCensoredClass.class
          ./com/foobarquux/oms/control/shipmenttype/action/SomeCensoredClass.class
          

          The same happens in the source directory. So there is something seriously wrong with copying the files.

          Michiel Hendriks added a comment - - edited This disk eating feature makes the plugin pretty much unusable for us. Build jobs went up from around 70MiB to over 900MiB. The classes directory is close to 500MiB even though the actual produced class files is less than 100MiB. It's storing files more than once is different directories, once per path element: ./SomeCensoredClass.class ./action/SomeCensoredClass.class ./shipmenttype/action/SomeCensoredClass.class ./control/shipmenttype/action/SomeCensoredClass.class ./oms/control/shipmenttype/action/SomeCensoredClass.class ./foobarquux/oms/control/shipmenttype/action/SomeCensoredClass.class ./com/foobarquux/oms/control/shipmenttype/action/SomeCensoredClass.class The same happens in the source directory. So there is something seriously wrong with copying the files.

          Ignore my previous comment.
          I had a config error, I had a trailing ** one of the paths.

          Michiel Hendriks added a comment - Ignore my previous comment. I had a config error, I had a trailing ** one of the paths.

          Moshe Zvi added a comment -

          +1

          Moshe Zvi added a comment - +1

            ognjenb Ognjen Bubalo
            seadub Chris Williams
            Votes:
            15 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated: