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

Make Cobertura plug-in support the workflow plugin

      Hi,

      I am using the Cobertura plugin in my project for several jobs and now want to specify my jobs as Workflow jobs to better manage my application and reduce configuration overhead.

      Thanks,
      Yotam

          [JENKINS-30700] Make Cobertura plug-in support the workflow plugin

          Yotam Shapira created issue -
          Yotam Shapira made changes -
          Assignee Original: ssogabe [ ssogabe ] New: Stephen Connolly [ stephenconnolly ]
          Description Original: Love the Cobertura plugin!

          I'm using it with Python build jobs that are set up as multi-configuration jobs; there is a user-defined axis defined for TOXENV which lets me use a Python tool called tox to run for each build, a "sub-build" (forgive me if this is the wrong terminology) for each of several Python versions -- e.g.: py26, py27, py33, and pypy. Each of these Python versions is a "sub-build" of the build. Each of those sub-builds generates its own coverage.xml file. Here is how I set up these multi-configuration jobs:

          http://tox.readthedocs.org/en/latest/example/jenkins.html

          The Cobertura plugin kind of works with this setup in a somewhat incomplete way.

          If I go to the project page, I don't see the coverage graph (but I *do* see JUnit test results so I guess the JUnit plugin has support for multi-configuration builds). If I click on "Coverage Report", then I get back the "nodata" page. I can only view coverage by drilling into each of the individual environments. For example, I can click on the most recent build and then click the "py26" sub-build and then for that I can see a coverage report.

          What I would really like is to also be able to see some coverage information for the overall build -- either by:

          1. (simpler) having the plugin pick one of the sub-builds as representative and showing that sub-build's coverage as the coverage for the overall build. At the very simplest, it could simply pick any one of the sub-builds as the coverage is sometimes slightly different for the sub-builds, but approximately the same, so showing any one is better than nothing. Fancier would be to allow the user to specify in the plugin configuration that one of the sub-builds is the one to use. For example, since I deploy to py26, that one is most important to me, so I might pick the py26 coverage as being the one to use for the overall build.

          2. (fancier) do some merging of the coverage across the sub-builds -- e.g.: if a line is covered in any of the sub-builds then it is considered covered. This seems tricky. Another way to handle this is to leave it up to the user. I believe that the Python "coverage" tool has a merge sub-command that lets you merge multiple runs into one (I haven't used it yet though). It might be possible for me to manually run this in my build.

          If you don't have time to actively work on this issue, I am open to working on it myself, especially if you can give me a little guidance of where to look and what the overall approach might be. I've already cloned the git repo and set up Netbeans and I have messed around a little with setting breakpoints and debugging but I haven't been able to figure out yet how to get it to work. I am more of a Python guy than a Jenkins guy, but if you give me some pointers, I might be able to find my way and possibly send you a pull request.

          I think the main problem that I discovered while debugging is that in {{CoberturaProjectAction.getLastResultBuild}} when the plugin calls {{getAction}} on my build, it gets {{null}} (instead of a {{CoberturaBuildAction}}), so it doesn't consider the build to have coverage. So even if I attempt to manually copy a coverage.xml into the build directory, the plugin still doesn't think that the build has coverage because it calls {{getAction}} and gets {{null}} instead of a {{CoberturaBuildAction}}. I am guessing that at some point, the plugin registers this action (couldn't find where) and in the multi-config job case, it probably registers the action on the sub-jobs but not the parent job. Just a guess.
          New: Hi,

          I am using the Cobertura plugin in my project for several jobs and now want to specify my jobs as Workflow jobs to better manage my application and reduce configuration overhead.

          Thanks,
          Yotam
          Labels Original: matrix multi-configuration New: workflow
          Guillaume Bailleul made changes -
          Assignee Original: Stephen Connolly [ stephenconnolly ] New: Guillaume Bailleul [ laibulle ]
          Guillaume Bailleul made changes -
          Assignee Original: Guillaume Bailleul [ laibulle ] New: Stephen Connolly [ stephenconnolly ]

          kyle rockman added a comment -

          +100 on this, we just switched to jenkins pipeline (formerly workflow) and this plugin is not supported. I would hate to have to roll my own solution just to get my coverage reports publisher need back.

          kyle rockman added a comment - +100 on this, we just switched to jenkins pipeline (formerly workflow) and this plugin is not supported. I would hate to have to roll my own solution just to get my coverage reports publisher need back.

          Marcus Cobden added a comment -

          I'm working a changeset for this, but I could do with some advice from someone more familiar with how Jenkins plugins work, as I'm mostly guessing and copying from the junit and xunit plugins.

          Marcus Cobden added a comment - I'm working a changeset for this, but I could do with some advice from someone more familiar with how Jenkins plugins work, as I'm mostly guessing and copying from the junit and xunit plugins.

          Marcus Cobden added a comment -

          Marcus Cobden added a comment - This commit highlights the areas I need some advice on: https://github.com/leth/cobertura-plugin/commit/52a2ce9b2ec9dde01ff9054e1184c2e833e00a60

          I've been waiting for this support for a while now, unfortunately I do not know enough Java to do it myself or I would.

          Are there any plans to implement this? Besides eventually of course.

          Pedro Algarvio added a comment - I've been waiting for this support for a while now, unfortunately I do not know enough Java to do it myself or I would. Are there any plans to implement this? Besides eventually of course.
          Mike . made changes -
          Epic Link New: JENKINS-34657 [ 170293 ]

          Support for this plugin in pipeline would be wonderful. I have a large number of Jenkins Enterprise jobs that I'd like to port over to Pipeline, but it's a hard sell to developers and managers who enjoy having the nice test coverage graphs. Any updates?

          Benjamin Hipple added a comment - Support for this plugin in pipeline would be wonderful. I have a large number of Jenkins Enterprise jobs that I'd like to port over to Pipeline, but it's a hard sell to developers and managers who enjoy having the nice test coverage graphs. Any updates?

            mbarrien Michael Barrientos
            yotamshapira Yotam Shapira
            Votes:
            82 Vote for this issue
            Watchers:
            86 Start watching this issue

              Created:
              Updated:
              Resolved: