Closed olnistratov closed 1 year ago
Any chance that you can provide the Cobertura XML report?
Please, find Cobertura.xml in zip. Cobertura.zip
Thanks for this detailed bug report!
Thanks for this detailed bug report!
You are welcome. Please feel free to ask additional information if any.
@uhafner for what is worth, I am also getting an error logged by the plugin. The code coverage displays in Jenkins, but I cannot open the file to view it and the path is wrong. This was working correctly a year ago.
Section from Jenkinsfile that publishes the result:
publishCoverage (
adapters: [coberturaAdapter('coverage/cobertura-coverage.xml')],
sourceFileResolver: sourceFiles('STORE_LAST_BUILD'),
failNoReports: false
)
Path displayed in Jenkins is concatenating the package name main
with filename stage\app\src\lambda\status\status-lambda.ts
and matches the path shown in the error message. My code is in the path indicated by filename, as indicated by the Cobertura file.
We just updated our Jenkins server and got this same problem:
[Coverage] [-ERROR-] Errors during source code painting:
[Coverage] [-ERROR-] Source file 'thing/what.py' not found
The problem is that our file paths are all missing the project directory in the path: project/thing/what.py
.
I see this Issue was closed as "completed". What was the solution?
You need to specify some sourceDirectories
, see https://www.jenkins.io/doc/pipeline/steps/code-coverage-api/#recordcoverage-record-code-coverage-results.
@uhafner Thanks! That worked for me too!
Jenkins and plugins versions report
Jenkins: 2.375.2 OS: Linux - 4.14.35-2047.519.2.1.el7uek.x86_64
Parameterized-Remote-Trigger:3.1.6.3 ace-editor:1.1 active-directory:2.30 analysis-model-api:10.22.0 ansicolor:1.0.2 ant:481.v7b_09e538fcca antisamy-markup-formatter:155.v795fb_8702324 apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61 artifactory:3.18.0 authentication-tokens:1.4 aws-credentials:191.vcb_f183ce58b_9 aws-java-sdk:1.12.287-357.vf82d85a_6eefd aws-java-sdk-cloudformation:1.12.287-357.vf82d85a_6eefd aws-java-sdk-codebuild:1.12.287-357.vf82d85a_6eefd aws-java-sdk-ec2:1.12.287-357.vf82d85a_6eefd aws-java-sdk-ecr:1.12.287-357.vf82d85a_6eefd aws-java-sdk-ecs:1.12.287-357.vf82d85a_6eefd aws-java-sdk-efs:1.12.287-357.vf82d85a_6eefd aws-java-sdk-elasticbeanstalk:1.12.287-357.vf82d85a_6eefd aws-java-sdk-iam:1.12.287-357.vf82d85a_6eefd aws-java-sdk-logs:1.12.287-357.vf82d85a_6eefd aws-java-sdk-minimal:1.12.287-357.vf82d85a_6eefd aws-java-sdk-sns:1.12.287-357.vf82d85a_6eefd aws-java-sdk-sqs:1.12.287-357.vf82d85a_6eefd aws-java-sdk-ssm:1.12.287-357.vf82d85a_6eefd blueocean:1.26.0 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.26.0 blueocean-commons:1.27.1 blueocean-config:1.27.1 blueocean-core-js:1.27.1 blueocean-dashboard:1.27.1 blueocean-display-url:2.4.1 blueocean-events:1.26.0 blueocean-git-pipeline:1.26.0 blueocean-github-pipeline:1.26.0 blueocean-i18n:1.27.1 blueocean-jira:1.27.1 blueocean-jwt:1.27.1 blueocean-personalization:1.27.1 blueocean-pipeline-api-impl:1.26.0 blueocean-pipeline-editor:1.26.0 blueocean-pipeline-scm-api:1.27.1 blueocean-rest:1.27.1 blueocean-rest-impl:1.27.1 blueocean-web:1.27.1 bootstrap4-api:4.6.0-5 bootstrap5-api:5.2.1-3 bouncycastle-api:2.27 branch-api:2.1071.v1a_188a_562481 build-blocker-plugin:1.7.8 build-monitor-plugin:1.13+build.202205140447 build-name-setter:2.2.0 build-timeout:1.28 caffeine-api:2.9.3-65.v6a_47d0f4d1fe checks-api:1.8.1 cloudbees-bitbucket-branch-source:791.vb_eea_a_476405b cloudbees-folder:6.800.v71307ca_b_986b code-coverage-api:3.5.0 command-launcher:90.v669d7ccb7c31 commons-lang3-api:3.12.0-36.vd97de6465d5b commons-text-api:1.10.0-27.vb_fa_3896786a_7 conditional-buildstep:1.4.2 config-file-provider:3.11.1 configuration-as-code:1569.vb_72405b_80249 copyartifact:681.va_a_298c7f9c01 credentials:1214.v1de940103927 credentials-binding:523.vd859a_4b_122e6 data-tables-api:1.12.1-4 dependency-check-jenkins-plugin:5.2.1 depgraph-view:1.0.5 display-url-api:2.3.7 docker-commons:1.21 docker-java-api:3.1.5.3-33.ve54af4fabd95 docker-plugin:1.2.9 docker-workflow:563.vd5d2e5c4007f durable-task:504.vb10d1ae5ba2f echarts-api:5.4.0-1 email-ext:2.93 emailext-template:1.5 external-monitor-job:203.v683c09d993b_9 favorite:2.4.1 file-parameters:264.v1733d9b_2a_380 font-awesome-api:6.2.1-1 forensics-api:1.17.0 fortify:22.1.38 git:4.14.3 git-client:3.13.1 git-parameter:0.9.18 git-server:99.va_0826a_b_cdfa_d github:1.36.1 github-api:1.303-400.v35c2d8258028 github-branch-source:1701.v00cc8184df93 gitlab-plugin:1.6.0 gradle:2.2 handlebars:3.0.8 handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953 htmlpublisher:1.31 ignore-committer-strategy:1.0.4 instance-identity:142.v04572ca_5b_265 ionicons-api:31.v4757b_6987003 ivy:2.4 jackson2-api:2.14.1-313.v504cdd45c18b jakarta-activation-api:2.0.1-2 jakarta-mail-api:2.0.1-2 javadoc:226.v71211feb_e7e9 javax-activation-api:1.2.0-5 javax-mail-api:1.6.2-8 jaxb:2.3.7-1 jdk-tool:63.v62d2fd4b_4793 jenkins-design-language:1.27.1 jersey2-api:2.38-1 jira:3.8 jjwt-api:0.11.5-77.v646c772fddb_0 jnr-posix-api:3.1.16-1 jobConfigHistory:1198.v4d5736c2308c jquery:1.12.4-1 jquery-detached:1.2.1 jquery3-api:3.6.1-2 jsch:0.1.55.61.va_e9ee26616e7 junit:1166.va_436e268e972 ldap:659.v8ca_b_a_fe79fa_d lockable-resources:1117.v157231b_03882 mailer:438.v02c7f0a_12fa_4 matrix-auth:3.1.6 matrix-project:785.v06b_7f47b_c631 maven-plugin:3.20 mercurial:1260.vdfb_723cdcc81 mina-sshd-api-common:2.9.2-50.va_0e1f42659a_a mina-sshd-api-core:2.9.2-50.va_0e1f42659a_a momentjs:1.1.1 msbuild:1.30 nodejs:1.5.1 okhttp-api:4.9.3-108.v0feda04578cf pam-auth:1.10 parameterized-trigger:2.45 pipeline-aws:1.43 pipeline-build-step:2.18 pipeline-github-lib:38.v445716eaedda pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:629.vb_5627b_ee2104 pipeline-input-step:466.v6d0a_5df34f81 pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2118.v31fd5b_9944b_5 pipeline-model-definition:2.2118.v31fd5b_9944b_5 pipeline-model-extensions:2.2118.v31fd5b_9944b_5 pipeline-rest-api:2.30 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2118.v31fd5b_9944b_5 pipeline-stage-view:2.30 pipeline-utility-steps:2.15.0 plain-credentials:143.v1b_df8b_d3b_e48 plugin-util-api:2.20.0 popper-api:1.16.1-3 popper2-api:2.11.6-2 prism-api:1.29.0-2 pubsub-light:1.17 pwauth:0.4 rebuild:1.34 resource-disposer:0.20 role-strategy:587.v2872c41fa_e51 run-condition:1.5 saml:2.333.vc81e525974a_c scm-api:631.v9143df5b_e4a_a script-security:1229.v4880b_b_e905a_6 slack:631.v40deea_40323b snakeyaml-api:1.33-90.v80dcb_3814d35 sonar:2.15 sse-gateway:1.26 ssh-agent:295.v9ca_a_1c7cc3aa ssh-credentials:305.v8f4381501156 ssh-slaves:1.834.v622da_57f702c sshd:3.275.v9e17c10f2571 structs:324.va_f5d6774f3a_d thinBackup:1.15 throttle-concurrents:2.10 timestamper:1.21 token-macro:321.vd7cc1f2a_52c8 trilead-api:1.71.v9e7860a_67a_df variant:59.vf075fe829ccb versionnumber:1.10 warnings-ng:9.23.0 windows-slaves:1.8.1 workflow-aggregator:590.v6a_d052e5a_a_b_5 workflow-api:1208.v0cc7c6e0da_9e workflow-basic-steps:994.vd57e3ca_46d24 workflow-cps:3606.v0b_d8b_e512dcf workflow-durable-task-step:1223.v7f1a_98a_8863e workflow-job:1268.v6eb_e2ee1a_85a workflow-multibranch:716.vc692ae52371b workflow-scm-step:400.v6b_89a1317c9a workflow-step-api:639.v6eca_cd8c04aa workflow-support:839.v35e2736cfd5c ws-cleanup:0.44 xvfb:1.2
What Operating System are you using (both controller, and any agents involved in the problem)?
Windows Server 2016 (amd64) --Reproduction steps
Build stage configuration:
stage('Build') { steps { echo "Building started..." echo "Restore dotnet" powershell "dotnet restore" echo "Build Numbers.jsproj" powershell "dotnet build Numbers\\Numbers.csproj -c Debug" echo "Build Numbers.Test" powershell "dotnet build Numbers.Tests\\Numbers.Tests.csproj -c Debug" echo "Build finished" } }
Test stage configuration:stage('Test') { steps{ catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { echo "Test starting..." echo "dotnet tools restore" powershell "dotnet tool restore" echo "finish dotnet tool restore" powershell "dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --no-build" } } }
Code coverage step configuration: ` stage('Coverage report') { steps { echo "Starting code coverage report generation..." catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { powershell "dotnet reportgenerator -reports:'.\*\coverage.cobertura.xml' -targetdir:'coveragereport' -reporttypes:'cobertura'" } echo "Code coverage report generation completed." echo "Publishing coverage data..."10:41:33 Branch indexing 10:41:33 10:41:33 Fetching origin... 10:41:33 10:41:33 [INFO] Currently running in a labeled security context 10:41:33 [INFO] Currently SELinux is 'enforcing' on the host 10:41:33 10:41:34 [Pipeline] Start of Pipeline 10:41:34 [Pipeline] properties 10:41:35 [Pipeline] node 10:41:35 Running on windows in D:\Build\workspace\esignPlugins_test-jenkins-plugin ... 10:41:48 Jenkins node name: windows 10:41:48 [Pipeline] echo 10:41:48 Building started... 10:41:48 [Pipeline] echo 10:41:48 Restore dotnet 10:41:48 [Pipeline] powershell 10:41:51 Determining projects to restore... 10:41:51 Restored D:\Build\workspace\esignPlugins_test-jenkins-plugin\Numbers.Tests\Numbers.Tests.csproj (in 217 ms). 10:41:51 [Pipeline] echo 10:41:51 Build Numbers.jsproj 10:41:51 [Pipeline] powershell 10:41:53 MSBuild version 17.3.2+561848881 for .NET 10:41:53 Determining projects to restore... 10:41:53 Nothing to do. None of the projects specified contain packages to restore. 10:41:54 Numbers -> D:\Build\workspace\esignPlugins_test-jenkins-plugin\Numbers\bin\Debug\Numbers.dll 10:41:54 10:41:54 Build succeeded. 10:41:54 0 Warning(s) 10:41:54 0 Error(s) 10:41:54 10:41:54 Time Elapsed 00:00:01.78 10:41:54 [Pipeline] echo 10:41:54 Build Numbers.Test 10:41:54 [Pipeline] powershell 10:41:55 MSBuild version 17.3.2+561848881 for .NET 10:41:56 Determining projects to restore... 10:41:56 All projects are up-to-date for restore. 10:41:57 Numbers -> D:\Build\workspace\esignPlugins_test-jenkins-plugin\Numbers\bin\Debug\Numbers.dll 10:41:57 Numbers.Tests -> D:\Build\workspace\esignPlugins_test-jenkins-plugin\Numbers.Tests\bin\Debug\net48\Numbers.Tests.dll 10:41:57 10:41:57 Build succeeded. 10:41:57 0 Warning(s) 10:41:57 0 Error(s) 10:41:57 10:41:57 Time Elapsed 00:00:01.82 10:41:57 [Pipeline] echo 10:41:57 Build finished ... 10:41:57 [Pipeline] stage 10:41:57 [Pipeline] { (Test) 10:41:57 [Pipeline] catchError 10:41:57 [Pipeline] { 10:41:57 [Pipeline] echo 10:41:57 Test starting... 10:41:57 [Pipeline] echo 10:41:57 dotnet tools restore 10:41:57 [Pipeline] powershell 10:41:59 Tool 'cake.tool' (version '2.2.0') was restored. Available commands: dotnet-cake 10:41:59 Tool 'dotnet-reportgenerator-globaltool' (version '5.1.12') was restored. Available commands: reportgenerator 10:41:59 ... 10:41:59 Restore was successful. 10:41:59 [Pipeline] echo 10:41:59 finish dotnet tool restore 10:41:59 [Pipeline] powershell 10:42:02 C:\Windows\system32\config\systemprofile\.nuget\packages\coverlet.msbuild\3.2.0\build\coverlet.msbuild.targets(39,5): warning : [coverlet] BadImageFormatException during MetadataReaderProvider.FromPortablePdbStream in InstrumentationHelper.PortablePdbHasLocalSource, unable to check if module has got local source. [D:\Build\workspace\esignPlugins_test-jenkins-plugin\Numbers.Tests\Numbers.Tests.csproj] 10:42:03 Test run for D:\Build\workspace\esignPlugins_test-jenkins-plugin\Numbers.Tests\bin\Debug\net48\Numbers.Tests.dll (.NETFramework,Version=v4.8) 10:42:03 Microsoft (R) Test Execution Command Line Tool Version 17.3.1 (x64) 10:42:03 Copyright (c) Microsoft Corporation. All rights reserved. 10:42:03 10:42:03 Starting test execution, please wait... 10:42:03 A total of 1 test files matched the specified pattern. 10:42:05 10:42:05 Passed! - Failed: 0, Passed: 11, Skipped: 0, Total: 11, Duration: - Numbers.Tests.dll (net48) 10:42:05 10:42:05 Calculating coverage result... 10:42:05 Generating report 'D:\Build\workspace\esignPlugins_test-jenkins-plugin\Numbers.Tests\coverage.cobertura.xml' 10:42:05 10:42:05 +---------+------+--------+--------+ 10:42:05 | Module | Line | Branch | Method | 10:42:05 +---------+------+--------+--------+ 10:42:05 | Numbers | 100% | 100% | 100% | 10:42:05 +---------+------+--------+--------+ 10:42:05 10:42:05 +---------+------+--------+--------+ 10:42:05 | | Line | Branch | Method | 10:42:05 +---------+------+--------+--------+ 10:42:05 | Total | 100% | 100% | 100% | 10:42:05 +---------+------+--------+--------+ 10:42:05 | Average | 100% | 100% | 100% | 10:42:05 +---------+------+--------+--------+ 10:42:05 10:42:06 [Pipeline] { (Coverage report) 10:42:06 [Pipeline] echo 10:42:06 Starting code coverage report generation... 10:42:06 [Pipeline] catchError 10:42:06 [Pipeline] { 10:42:06 [Pipeline] powershell 10:42:07 2023-02-03T08:42:07: Arguments 10:42:07 2023-02-03T08:42:07: -reports:.\**\*coverage.cobertura.xml 10:42:07 2023-02-03T08:42:07: -targetdir:coveragereport 10:42:07 2023-02-03T08:42:07: -reporttypes:cobertura 10:42:07 2023-02-03T08:42:07: Writing report file 'coveragereport\Cobertura.xml' 10:42:07 2023-02-03T08:42:07: Report generation took 0.1 seconds 10:42:07 Code coverage report generation completed. 10:42:07 [Pipeline] echo 10:42:07 Publishing coverage data... 10:42:07 [Pipeline] publishCoverage 10:42:07 Publishing Coverage report.... 10:42:07 A total of 1 reports were found 10:42:07 Report coverage diff: 0.0%. Add to CoverageResult. 10:42:07 Group coverage diff: 0.0%. Add to CoverageResult. 10:42:07 Package coverage diff: 0.0%. Add to CoverageResult. 10:42:07 File coverage diff: 0.0%. Add to CoverageResult. 10:42:07 Class coverage diff: 0.0%. Add to CoverageResult. 10:42:07 Method coverage diff: 0.0%. Add to CoverageResult. 10:42:07 Line coverage diff: 0.0%. Add to CoverageResult. 10:42:07 Conditional coverage diff: 0.0%. Add to CoverageResult. 10:42:07 [Coverage] Computing coverage delta report 10:42:07 [Coverage] Reference build recorder is not configured 10:42:07 [Coverage] -> No reference build defined, falling back to previous build 10:42:07 [Coverage] -> Found reference result 'io.jenkins.plugins.coverage.CoverageAction@54c32c29' 10:42:08 [Coverage] [-ERROR-] Errors during source code painting: 10:42:08 [Coverage] [-ERROR-] Source file 'Numbers/D:\Build\workspace\esignPlugins_test-jenkins-plugin\Numbers\PrimeService.cs' not found 10:42:08 [Coverage] Verify uniqueness of file paths... 10:42:08 [Coverage] Obtaining action of reference build 10:42:08 [Coverage] Reference build recorder is not configured 10:42:08 [Coverage] -> No reference build defined, falling back to previous build: '#9' 10:42:08 [Coverage] -> Found reference result in build '#9' 10:42:08 [Coverage] Calculating the code delta... 10:42:08 [Coverage] -> No delta calculator installed yet. You need to install the 'git-forensics' plugin to enable it for Git. 10:42:08 [Coverage] Calculating coverage deltas... 10:42:08 [Coverage] Executing source code painting... 10:42:08 [Coverage] Painting 1 source files on agent 10:42:08 [Coverage] Searching for source code files in 'D:/Build/workspace/esignPlugins_test-jenkins-plugin/src/main/java' 10:42:08 [Coverage] -> finished painting (0 files have been painted, 1 files failed) 10:42:08 [Coverage] -> zipping sources from folder 'D:\Build\workspace\esignPlugins_test-jenkins-plugin\coverage' as 'D:\Build\workspace\esignPlugins_test-jenkins-plugin\coverage-sources.zip' 10:42:08 [Coverage] Copying painted sources from agent to build folder 10:42:08 [Coverage] -> extracting... 10:42:08 [Coverage] -> done 10:42:08 [Coverage] Deleting source code files of build #9 10:42:08 [Coverage] Finished coverage processing - adding the action to the build... 10:42:08 [Checks API] No suitable checks publisher found. 10:42:08 [Pipeline] echo 10:42:08 Coverage data published. ... 10:42:20 [Pipeline] End of Pipeline 10:42:20 Finished: SUCCESS
There is an error in logs:
10:42:08 [Coverage] [-ERROR-] Errors during source code painting: 10:42:08 [Coverage] [-ERROR-] Source file 'Numbers/D:\Build\workspace\esignPlugins_test-jenkins-plugin\Numbers\PrimeService.cs' not found
There is no "Source code view" in Coverage Report.
Expected Results
1.There is no error in Console Output.
Actual Results
There is an error in logs:
10:42:08 [Coverage] [-ERROR-] Errors during source code painting: 10:42:08 [Coverage] [-ERROR-] Source file 'Numbers/D:\Build\workspace\esignPlugins_test-jenkins-plugin\Numbers\PrimeService.cs' not found
There is no "Source code view" in Coverage Report.
Anything else?
Please see Output console error. FileName is "D:\Build\workspace\esignPlugins_test-jenkins-plugin\Numbers\PrimeService.cs" but should be "PrimeService.cs".