jenkinsci / cobertura-plugin

Jenkins cobertura plugin
https://plugins.jenkins.io/cobertura/
MIT License
109 stars 133 forks source link

Source file mentioned in coverage report not found although absolute path given in xml #210

Open simmarn opened 11 months ago

simmarn commented 11 months ago

Jenkins and plugins versions report

Environment ```Jenkins: 2.401.2 OS: Linux - 5.4.0-70-generic Java: 11.0.10 - Ubuntu (OpenJDK 64-Bit Server VM) --- Office-365-Connector:4.20.0 ace-editor:1.1 analysis-model-api:11.3.0 android-signing:2.2.5 ansicolor:1.0.2 ant:497.v94e7d9fffa_b_9 antisamy-markup-formatter:159.v25b_c67cd35fb_ apache-httpcomponents-client-4-api:4.5.14-150.v7a_b_9d17134a_5 authentication-tokens:1.53.v1c90fd9191a_b_ aws-credentials:191.vcb_f183ce58b_9 aws-java-sdk-ec2:1.12.481-392.v8b_291cfcda_09 aws-java-sdk-minimal:1.12.481-392.v8b_291cfcda_09 blueocean:1.27.5 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.27.5 blueocean-commons:1.27.5 blueocean-config:1.27.5 blueocean-core-js:1.27.5 blueocean-dashboard:1.27.5 blueocean-display-url:2.4.2 blueocean-events:1.27.5 blueocean-git-pipeline:1.27.5 blueocean-github-pipeline:1.27.5 blueocean-i18n:1.27.5 blueocean-jira:1.27.5 blueocean-jwt:1.27.5 blueocean-personalization:1.27.5 blueocean-pipeline-api-impl:1.27.5 blueocean-pipeline-editor:1.27.5 blueocean-pipeline-scm-api:1.27.5 blueocean-rest:1.27.5 blueocean-rest-impl:1.27.5 blueocean-web:1.27.5 bootstrap4-api:4.6.0-6 bootstrap5-api:5.3.0-1 bouncycastle-api:2.29 branch-api:2.1122.v09cb_8ea_8a_724 build-timeout:1.31 caffeine-api:3.1.6-115.vb_8b_b_328e59d8 checks-api:2.0.0 cloudbees-bitbucket-branch-source:825.va_6a_dc46a_f97d cloudbees-folder:6.815.v0dd5a_cb_40e0e cobertura:1.17 code-coverage-api:4.7.0 command-launcher:100.v2f6722292ee8 commons-httpclient3-api:3.1-3 commons-lang3-api:3.12.0-36.vd97de6465d5b_ commons-text-api:1.10.0-36.vc008c8fcda_7b_ conditional-buildstep:1.4.2 credentials:1271.v54b_1c2c6388a_ credentials-binding:604.vb_64480b_c56ca_ dashboard-view:2.487.vcf0ff9008a_c0 data-tables-api:1.13.5-1 display-url-api:2.3.7 docker-commons:439.va_3cb_0a_6a_fb_29 docker-workflow:563.vd5d2e5c4007f doxygen:178.v6ea_ef5f7dfdb durable-task:510.v324450f8dca_4 echarts-api:5.4.0-5 email-ext:2.99 emma:1.31 envinject:2.901.v0038b_6471582 envinject-api:1.199.v3ce31253ed13 external-monitor-job:207.v98a_a_37a_85525 favorite:2.4.2 filesystem-list-parameter-plugin:0.0.8 font-awesome-api:6.4.0-2 forensics-api:2.3.0 git:5.2.0 git-client:4.4.0 git-parameter:0.9.19 git-server:99.va_0826a_b_cdfa_d github:1.37.1 github-api:1.314-431.v78d72a_3fe4c3 github-branch-source:1728.v859147241f49 gradle:2.8.1 handlebars:3.0.8 handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953 htmlpublisher:1.31 instance-identity:173.va_37c494ec4e5 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.15.2-350.v0c2f3f8fc595 jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javadoc:233.vdc1a_ec702cff javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.8-1 jdk-tool:66.vd8fa_64ee91b_d jenkins-design-language:1.27.5 jersey2-api:2.40-1 jira:3.10 jjwt-api:0.11.5-77.v646c772fddb_0 jquery:1.12.4-1 jquery-detached:1.2.1 jquery3-api:3.7.0-1 jsch:0.2.8-65.v052c39de79b_2 junit:1217.v4297208a_a_b_ce ldap:682.v7b_544c9d1512 list-git-branches-parameter:0.0.13 lockable-resources:1172.v4b_8fc8eed570 mailer:457.v3f72cb_e015e5 mapdb-api:1.0.9-28.vf251ce40855d matrix-auth:3.1.10 matrix-project:789.v57a_725b_63c79 mattermost:3.1.3 maven-plugin:3.22 mercurial:1260.vdfb_723cdcc81 mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_ mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_ momentjs:1.1.1 msbuild:1.30 mstest:1.0.1 nodelabelparameter:1.12.0 nunit:394.v65c09a_8408b_a_ okhttp-api:4.11.0-145.vcb_8de402ef81 pam-auth:1.10 parameterized-trigger:2.46 periodicbackup:2.0 pipeline-build-step:496.v2449a_9a_221f2 pipeline-github-lib:42.v0739460cda_c4 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:656.va_a_ceeb_6ffb_f7 pipeline-input-step:468.va_5db_051498a_4 pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2144.v077a_d1928a_40 pipeline-model-declarative-agent:1.1.1 pipeline-model-definition:2.2144.v077a_d1928a_40 pipeline-model-extensions:2.2144.v077a_d1928a_40 pipeline-rest-api:2.33 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2144.v077a_d1928a_40 pipeline-stage-view:2.33 pipeline-utility-steps:2.16.0 plain-credentials:143.v1b_df8b_d3b_e48 plot:2.1.12 plugin-util-api:3.3.0 popper-api:1.16.1-3 popper2-api:2.11.6-2 powershell:2.0 preSCMbuildstep:71.v1f2990a_37e27 prism-api:1.29.0-7 pubsub-light:1.17 rebuild:320.v5a_0933a_e7d61 resource-disposer:0.22 rocketchatnotifier:1.5.2 run-condition:1.6 schedule-build:467.vf48c1532e9eb_ scm-api:676.v886669a_199a_a_ script-security:1251.vfe552ed55f8d skip-certificate-check:1.1 slack:664.vc9a_90f8b_c24a_ snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4 sse-gateway:1.26 ssh-credentials:305.v8f4381501156 ssh-slaves:2.877.v365f5eb_a_b_eec sshd:3.303.vefc7119b_ec23 structs:324.va_f5d6774f3a_d subversion:2.17.2 test-results-aggregator:1.2.14 test-results-analyzer:0.4.0 timestamper:1.25 token-macro:359.vb_cde11682e0c trilead-api:2.84.v72119de229b_7 tuleap-api:2.5.2 tuleap-git-branch-source:3.2.7 tuleap-oauth:1.1.20 variant:59.vf075fe829ccb versioncolumn:162.v85841b_0790d5 vstestrunner:1.0.8 warnings-ng:10.2.0 windows-slaves:1.8.1 workflow-aggregator:596.v8c21c963d92d workflow-api:1241.v4edc8b_44933b_ workflow-basic-steps:1017.vb_45b_302f0cea_ workflow-cps:3717.va_180a_fe9d3cd workflow-cps-global-lib:609.vd95673f149b_b workflow-durable-task-step:1247.v7f9dfea_b_4fd0 workflow-job:1316.vd2290d3341a_f workflow-multibranch:756.v891d88f2cd46 workflow-scm-step:415.v434365564324 workflow-step-api:639.v6eca_cd8c04a_a_ workflow-support:839.v35e2736cfd5c ws-cleanup:0.45 xframe-filter-plugin:1.2 ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Controller: Ubuntu 20.04.2 LTS Agent: Windows 10 Professional

Reproduction steps

  1. Pipeline is running on windows agent, workspace is "C:\jenkins\workspace\CustomBuildAndUnitTest\".

  2. Pipeline creates Cobertura.xml with following content:

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
    <coverage line-rate="0.8598459809624537" branch-rate="1" lines-covered="52031" lines-valid="60512" branches-covered="0" branches-valid="0" complexity="NaN" version="0" timestamp="1695231119">
    <sources />
    <packages>
    <package name="ermms.base.dll" line-rate="0.8979949386801636" branch-rate="1" complexity="NaN">
      <classes>
        <class name="Ermms.Base.Alarms.AlarmDto" filename="C:\jenkins\workspace\CustomBuildAndUnitTest\sw\CrossApplicationsDlls\Ermms.Base\Ermms.Base\Alarms\AlarmDto.cs" line-rate="1" branch-rate="1" complexity="NaN">
          <methods>
            <method name="AlarmDto" signature="(string, string, System.Collections.Generic.List&lt;string&gt;, System.DateTime)" line-rate="1" branch-rate="1">
              <lines>
                <line number="13" hits="12" branch="false" />
                <line number="14" hits="12" branch="false" />
                <line number="15" hits="12" branch="false" />
    (and so on)
  3. In pipeline groovy coberura plugin is called with following command cobertura coberturaReportFile: 'TestResults/Cobertura.xml', enableNewApi: true, failUnstable: false, failUnhealthy: true, autoUpdateHealth: false, autoUpdateStability: false, lineCoverageTargets: '85, 60, 85', methodCoverageTargets: '0, 0, 0', classCoverageTargets: '0, 0, 0'

Expected Results

Coverage report on Jenkins pipeline with source code should be created.

Actual Results

Source code is not found. Printout from console:

[Cobertura] Publishing Cobertura coverage report...

[Cobertura] Publishing Cobertura coverage results...

[Cobertura] Cobertura coverage report found.

Source file mentioned in coverage report not found: C:\jenkins\workspace\CustomBuildAndUnitTest\C:\jenkins\workspace\CustomBuildAndUnitTest\sw\CrossApplicationsDlls\Ermms.Infrastructure\Utilities\WcfSetting.cs Source file mentioned in coverage report not found: C:\jenkins\workspace\CustomBuildAndUnitTest\C:\jenkins\workspace\CustomBuildAndUnitTest\sw\CrossApplicationsDlls\Ermms.WPF\CustomControls\IconButton.xaml.cs Source file mentioned in coverage report not found: C:\jenkins\workspace\CustomBuildAndUnitTest\C:\jenkins\workspace\CustomBuildAndUnitTest\sw\CrossApplicationsDlls\Ermms.Base\Ermms.Base\Interfaces\IXmlSigner.cs Source file mentioned in coverage report not found: C:\jenkins\workspace\CustomBuildAndUnitTest\C:\jenkins\workspace\CustomBuildAndUnitTest\sw\Ermms.FleetServer.FleetServer\Ermms.Fleetserver.MixedTraffic\AutoParkMission.cs Source file mentioned in coverage report not found: C:\jenkins\workspace\CustomBuildAndUnitTest\C:\jenkins\workspace\CustomBuildAndUnitTest\sw\Ermms.Gateway.MachineServer\Ermms.Gateway.MachineServer\Messages\VehiclePerformedDump.cs Source file mentioned in coverage report not found: C:\jenkins\workspace\CustomBuildAndUnitTest\C:\jenkins\workspace\CustomBuildAndUnitTest\sw\CrossApplicationsDlls\Ermms.Base\Ermms.Base\Interfaces\IFeatureRepository.cs Source file mentioned in coverage report not found: C:\jenkins\workspace\CustomBuildAndUnitTest\C:\jenkins\workspace\CustomBuildAndUnitTest\sw\CrossApplicationsDlls\Ermms.Base\Ermms.Base\Licence\LicenseFileWriter.cs Source file mentioned in coverage report not found: C:\jenkins\workspace\CustomBuildAndUnitTest\C:\jenkins\workspace\CustomBuildAndUnitTest\sw\CrossApplicationsDlls\Ermms.Base\Ermms.Base\Geometry\EpirocScooptramST7Geometry.cs ....

Anything else?

No response

Foxhunter42 commented 6 months ago

I'm seeing the same problem running on Jenkins 2.414.1 and a Windows 10 Agent. Any insight? Why would Cobertura double up the beginning of the workspace path? (e.g. "C:\jenkins\workspace\CustomBuildAndUnitTest\C:...")