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

Coverage plugin fails to copy over coverage files

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • coverage-plugin
    • Coverage 1.17, Jenkins 2.246.2

      Hello, 

      I did update my code-coverage plugin, to the new coverage one, without major issues. But since, every two, three builds, the sources aren't copied over to the build artefacts, and not accessible through the coverage report. 

      The steps look like : 

      stage('Coverage') {
          steps {
              sh('gcovr --add-tracefile "coverage_*.json" --cobertura-pretty > coverage_unified.xml')
              recordCoverage(tools: [[parser: 'COBERTURA', pattern: 'coverage_unified.xml']],
                  sourceCodeRetention: 'EVERY_BUILD',
                  qualityGates: [
                      [threshold: 100.0, metric: 'LINE', baseline: 'PROJECT', criticality: 'UNSTABLE'],
                      [threshold: 100.0, metric: 'BRANCH', baseline: 'PROJECT', criticality: 'UNSTABLE'],
                      [threshold: 100.0, metric: 'CLASS', baseline: 'PROJECT', criticality: 'UNSTABLE'],
                      [threshold: 100.0, metric: 'FILE', baseline: 'PROJECT', criticality: 'UNSTABLE']
                  ],
                  enabledForFailure: true,
                  failOnError: true, 
                  skipPublishingChecks: true
              )
          }
      }

      The issue looks like : 

      Errors during source code painting:Cannot create temporary directory in folder '/home/user/jenkins/workspace/project_name_PR-784' for the painted source filesjava.nio.file.NoSuchFileException: /media/jenkins/data/tmp/coverage106438501229433012	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)	at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:397)	at java.base/java.nio.file.Files.createDirectory(Files.java:700)	at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:134)	at java.base/java.nio.file.TempFileHelper.createTempDirectory(TempFileHelper.java:171)	at java.base/java.nio.file.Files.createTempDirectory(Files.java:1017)	at io.jenkins.plugins.coverage.metrics.source.SourceCodePainter$AgentCoveragePainter.invoke(SourceCodePainter.java:152)	at io.jenkins.plugins.coverage.metrics.source.SourceCodePainter$AgentCoveragePainter.invoke(SourceCodePainter.java:117)	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3578)	at hudson.remoting.UserRequest.perform(UserRequest.java:211)	at hudson.remoting.UserRequest.perform(UserRequest.java:54)	at hudson.remoting.Request$2.run(Request.java:377)	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)	at java.base/java.lang.Thread.run(Thread.java:840)Can't copy zipped sources from agent to controllerjava.nio.file.NoSuchFileException: /home/user/jenkins/workspace/project_name_PR-784/coverage-sources.zip	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)	at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)	at java.base/java.nio.file.Files.newByteChannel(Files.java:380)	at java.base/java.nio.file.Files.newByteChannel(Files.java:432)	at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422)	at java.base/java.nio.file.Files.newInputStream(Files.java:160)	at hudson.FilePath$CopyTo.invoke(FilePath.java:2687)	at hudson.FilePath$CopyTo.invoke(FilePath.java:2677)	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3578)	at hudson.remoting.UserRequest.perform(UserRequest.java:211)	at hudson.remoting.UserRequest.perform(UserRequest.java:54)	at hudson.remoting.Request$2.run(Request.java:377)	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78) [wrapped] java.io.IOException: Failed to copy /home/user/jenkins/workspace/project_name_PR-784/coverage-sources.zip to /var/lib/jenkins/jobs/project_new/branches/PR-784/builds/92/coverage-sources/coverage-sources.zip	at hudson.FilePath.copyTo(FilePath.java:2626)	at io.jenkins.plugins.coverage.metrics.source.SourceCodeFacade.copySourcesToBuildFolder(SourceCodeFacade.java:135)	at io.jenkins.plugins.coverage.metrics.source.SourceCodePainter.processSourceCodePainting(SourceCodePainter.java:86)	at io.jenkins.plugins.coverage.metrics.steps.CoverageReporter.paintSourceFiles(CoverageReporter.java:165)	at io.jenkins.plugins.coverage.metrics.steps.CoverageReporter.computeCoverageBasedOnReferenceBuild(CoverageReporter.java:137)	at io.jenkins.plugins.coverage.metrics.steps.CoverageReporter.publishAction(CoverageReporter.java:54)	at io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder.perform(CoverageRecorder.java:424)	at io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder.perform(CoverageRecorder.java:402)	at io.jenkins.plugins.coverage.metrics.steps.CoverageStep$Execution.run(CoverageStep.java:365)	at io.jenkins.plugins.coverage.metrics.steps.CoverageStep$Execution.run(CoverageStep.java:333)	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)	at java.base/java.lang.Thread.run(Thread.java:840) 

      I did add the paths to security / prism syntax highlighting already.
      Anything I could be doing wrong ? 

      On another build, same steps, looks like : 

      Painting 164 source files on agent-> finished painting successfully-> zipping sources from folder '/home/user/jenkins-agent/workspace/project_name_PR-437/coverage' as '/home/user/jenkins-agent/workspace/project_name_PR-437/coverage-sources.zip'Copying painted sources from agent to build folder 

      I got concerned reading the jenkins security update : 
      https://github.com/jenkinsci/jep/tree/master/jep/235
      https://www.jenkins.io/doc/book/security/controller-isolation/jep-235/
      Could it be linked ? 

          [JENKINS-72548] Coverage plugin fails to copy over coverage files

          Yoann created issue -
          Yoann made changes -
          Description Original: Hello, 

          I did update my code-coverage plugin, to the new coverage one, without major issues. But since, every two, three builds, the sources aren't copied over to the build artefacts, and not accessible through the coverage report. 

          The steps look like : 


          {code:java}
          stage('Coverage') {
              steps {
                  sh('gcovr --add-tracefile "coverage_*.json" --cobertura-pretty > coverage_unified.xml')
                  recordCoverage(tools: [[parser: 'COBERTURA', pattern: 'coverage_unified.xml']],
                      sourceCodeRetention: 'EVERY_BUILD',
                      qualityGates: [
                          [threshold: 100.0, metric: 'LINE', baseline: 'PROJECT', criticality: 'UNSTABLE'],
                          [threshold: 100.0, metric: 'BRANCH', baseline: 'PROJECT', criticality: 'UNSTABLE'],
                          [threshold: 100.0, metric: 'CLASS', baseline: 'PROJECT', criticality: 'UNSTABLE'],
                          [threshold: 100.0, metric: 'FILE', baseline: 'PROJECT', criticality: 'UNSTABLE']
                      ],
                      enabledForFailure: true,
                      failOnError: true, 
                      skipPublishingChecks: true
                  )
              }
          }{code}


          The issue looks like : 


          {code:java}
          Errors during source code painting:Cannot create temporary directory in folder '/home/user/jenkins/workspace/project_name_PR-784' for the painted source filesjava.nio.file.NoSuchFileException: /media/jenkins/data/tmp/coverage106438501229433012 at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:397) at java.base/java.nio.file.Files.createDirectory(Files.java:700) at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:134) at java.base/java.nio.file.TempFileHelper.createTempDirectory(TempFileHelper.java:171) at java.base/java.nio.file.Files.createTempDirectory(Files.java:1017) at io.jenkins.plugins.coverage.metrics.source.SourceCodePainter$AgentCoveragePainter.invoke(SourceCodePainter.java:152) at io.jenkins.plugins.coverage.metrics.source.SourceCodePainter$AgentCoveragePainter.invoke(SourceCodePainter.java:117) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3578) at hudson.remoting.UserRequest.perform(UserRequest.java:211) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:377) at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:840)Can't copy zipped sources from agent to controllerjava.nio.file.NoSuchFileException: /home/user/jenkins/workspace/project_name_PR-784/coverage-sources.zip at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218) at java.base/java.nio.file.Files.newByteChannel(Files.java:380) at java.base/java.nio.file.Files.newByteChannel(Files.java:432) at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422) at java.base/java.nio.file.Files.newInputStream(Files.java:160) at hudson.FilePath$CopyTo.invoke(FilePath.java:2687) at hudson.FilePath$CopyTo.invoke(FilePath.java:2677) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3578) at hudson.remoting.UserRequest.perform(UserRequest.java:211) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:377) at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78) [wrapped] java.io.IOException: Failed to copy /home/user/jenkins/workspace/project_name_PR-784/coverage-sources.zip to /var/lib/jenkins/jobs/project_new/branches/PR-784/builds/92/coverage-sources/coverage-sources.zip at hudson.FilePath.copyTo(FilePath.java:2626) at io.jenkins.plugins.coverage.metrics.source.SourceCodeFacade.copySourcesToBuildFolder(SourceCodeFacade.java:135) at io.jenkins.plugins.coverage.metrics.source.SourceCodePainter.processSourceCodePainting(SourceCodePainter.java:86) at io.jenkins.plugins.coverage.metrics.steps.CoverageReporter.paintSourceFiles(CoverageReporter.java:165) at io.jenkins.plugins.coverage.metrics.steps.CoverageReporter.computeCoverageBasedOnReferenceBuild(CoverageReporter.java:137) at io.jenkins.plugins.coverage.metrics.steps.CoverageReporter.publishAction(CoverageReporter.java:54) at io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder.perform(CoverageRecorder.java:424) at io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder.perform(CoverageRecorder.java:402) at io.jenkins.plugins.coverage.metrics.steps.CoverageStep$Execution.run(CoverageStep.java:365) at io.jenkins.plugins.coverage.metrics.steps.CoverageStep$Execution.run(CoverageStep.java:333) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:840) {code}

          I did add the paths to security / prism syntax highlighting already.
          Anything I could be doing wrong ? 

          On another build, same steps, looks like : 


          {code:java}
          Painting 164 source files on agent-> finished painting successfully-> zipping sources from folder '/home/user/jenkins-agent/workspace/project_name_PR-437/coverage' as '/home/user/jenkins-agent/workspace/project_name_PR-437/coverage-sources.zip'Copying painted sources from agent to build folder {code}
           
          New: Hello, 

          I did update my code-coverage plugin, to the new coverage one, without major issues. But since, every two, three builds, the sources aren't copied over to the build artefacts, and not accessible through the coverage report. 

          The steps look like : 
          {code:java}
          stage('Coverage') {
              steps {
                  sh('gcovr --add-tracefile "coverage_*.json" --cobertura-pretty > coverage_unified.xml')
                  recordCoverage(tools: [[parser: 'COBERTURA', pattern: 'coverage_unified.xml']],
                      sourceCodeRetention: 'EVERY_BUILD',
                      qualityGates: [
                          [threshold: 100.0, metric: 'LINE', baseline: 'PROJECT', criticality: 'UNSTABLE'],
                          [threshold: 100.0, metric: 'BRANCH', baseline: 'PROJECT', criticality: 'UNSTABLE'],
                          [threshold: 100.0, metric: 'CLASS', baseline: 'PROJECT', criticality: 'UNSTABLE'],
                          [threshold: 100.0, metric: 'FILE', baseline: 'PROJECT', criticality: 'UNSTABLE']
                      ],
                      enabledForFailure: true,
                      failOnError: true, 
                      skipPublishingChecks: true
                  )
              }
          }{code}
          The issue looks like : 
          {code:java}
          Errors during source code painting:Cannot create temporary directory in folder '/home/user/jenkins/workspace/project_name_PR-784' for the painted source filesjava.nio.file.NoSuchFileException: /media/jenkins/data/tmp/coverage106438501229433012 at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:397) at java.base/java.nio.file.Files.createDirectory(Files.java:700) at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:134) at java.base/java.nio.file.TempFileHelper.createTempDirectory(TempFileHelper.java:171) at java.base/java.nio.file.Files.createTempDirectory(Files.java:1017) at io.jenkins.plugins.coverage.metrics.source.SourceCodePainter$AgentCoveragePainter.invoke(SourceCodePainter.java:152) at io.jenkins.plugins.coverage.metrics.source.SourceCodePainter$AgentCoveragePainter.invoke(SourceCodePainter.java:117) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3578) at hudson.remoting.UserRequest.perform(UserRequest.java:211) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:377) at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:840)Can't copy zipped sources from agent to controllerjava.nio.file.NoSuchFileException: /home/user/jenkins/workspace/project_name_PR-784/coverage-sources.zip at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218) at java.base/java.nio.file.Files.newByteChannel(Files.java:380) at java.base/java.nio.file.Files.newByteChannel(Files.java:432) at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422) at java.base/java.nio.file.Files.newInputStream(Files.java:160) at hudson.FilePath$CopyTo.invoke(FilePath.java:2687) at hudson.FilePath$CopyTo.invoke(FilePath.java:2677) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3578) at hudson.remoting.UserRequest.perform(UserRequest.java:211) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:377) at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78) [wrapped] java.io.IOException: Failed to copy /home/user/jenkins/workspace/project_name_PR-784/coverage-sources.zip to /var/lib/jenkins/jobs/project_new/branches/PR-784/builds/92/coverage-sources/coverage-sources.zip at hudson.FilePath.copyTo(FilePath.java:2626) at io.jenkins.plugins.coverage.metrics.source.SourceCodeFacade.copySourcesToBuildFolder(SourceCodeFacade.java:135) at io.jenkins.plugins.coverage.metrics.source.SourceCodePainter.processSourceCodePainting(SourceCodePainter.java:86) at io.jenkins.plugins.coverage.metrics.steps.CoverageReporter.paintSourceFiles(CoverageReporter.java:165) at io.jenkins.plugins.coverage.metrics.steps.CoverageReporter.computeCoverageBasedOnReferenceBuild(CoverageReporter.java:137) at io.jenkins.plugins.coverage.metrics.steps.CoverageReporter.publishAction(CoverageReporter.java:54) at io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder.perform(CoverageRecorder.java:424) at io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder.perform(CoverageRecorder.java:402) at io.jenkins.plugins.coverage.metrics.steps.CoverageStep$Execution.run(CoverageStep.java:365) at io.jenkins.plugins.coverage.metrics.steps.CoverageStep$Execution.run(CoverageStep.java:333) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:840) {code}
          I did add the paths to security / prism syntax highlighting already.
          Anything I could be doing wrong ? 

          On another build, same steps, looks like : 
          {code:java}
          Painting 164 source files on agent-> finished painting successfully-> zipping sources from folder '/home/user/jenkins-agent/workspace/project_name_PR-437/coverage' as '/home/user/jenkins-agent/workspace/project_name_PR-437/coverage-sources.zip'Copying painted sources from agent to build folder {code}

          I got concerned reading the jenkins security update : 
          [https://github.com/jenkinsci/jep/tree/master/jep/235]
          [https://www.jenkins.io/doc/book/security/controller-isolation/jep-235/]
          Could it be linked ? 

          Ulli Hafner added a comment -

          It looks like the process cannot write the files to /media/jenkins/data/tmp/coverage106438501229433012 (the number is replaced every time). Is there not enough space on your disk?
          Or are you cleaning you workspace after a build?

          Ulli Hafner added a comment - It looks like the process cannot write the files to /media/jenkins/data/tmp/coverage106438501229433012 (the number is replaced every time). Is there not enough space on your disk? Or are you cleaning you workspace after a build?

          Yoann added a comment -

          Hello ! I found out that it comes from java.io.tmpdir. This is set to /media/jenkins/data/tmp on one agent, and just /tmp on working agents. No clue why yet, as they all are initialised the same. Thank you for the support ! 

          Yoann added a comment - Hello ! I found out that it comes from java.io.tmpdir. This is set to /media/jenkins/data/tmp on one agent, and just /tmp on working agents. No clue why yet, as they all are initialised the same. Thank you for the support ! 
          Yoann made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

            drulli Ulli Hafner
            yoann_d Yoann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: