title: Jenkins: Cobertura plugin cannot find coverage report
body: <p>Here are my build logs. I am absolutely baffled and would appreciate any help.
  I'm using <code>cobertura</code> plugin version <code>1.16</code>.</p>
  <pre><code>+ ls
  Dockerfile
  Jenkinsfile
  README.md
  babel.config.js
  coverage
  dev-server.sh
  jenkins-agent.yaml
  jest.config.ts
  package-lock.json
  package.json
  src
  tsconfig.json
  webpack.config.js
  + ls ./coverage
  cobertura-coverage.xml
  + pwd
  /home/jenkins/agent/workspace/api_PR-8
  + cat ./coverage/cobertura-coverage.xml
  &lt;?xml version=&quot;1.0&quot; ?&gt;
  &lt;!DOCTYPE coverage SYSTEM &quot;http://cobertura.sourceforge.net/xml/coverage-04.dtd&quot;&gt;
  &lt;coverage lines-valid=&quot;129&quot; lines-covered=&quot;46&quot; line-rate=&quot;0.3566&quot; branches-valid=&quot;1&quot; branches-covered=&quot;1&quot; branch-rate=&quot;1&quot; timestamp=&quot;1609204078913&quot; complexity=&quot;0&quot; version=&quot;0.1&quot;&gt;
    &lt;sources&gt;
      &lt;source&gt;/app&lt;/source&gt;
    &lt;/sources&gt;
    &lt;packages&gt;
      ...
    &lt;/packages&gt;
  &lt;/coverage&gt;
  [Pipeline] cobertura
  [Cobertura] Publishing Cobertura coverage report...
  
  [Cobertura] No coverage results were found using the pattern './coverage/cobertura-coverage.xml' relative to '/home/jenkins/agent/workspace/api_PR-8'.  Did you enter a pattern relative to the correct directory?  Did you generate the XML report(s) for Cobertura?
  </code></pre>
  <p>I have also tried using the pattern <code>'coverage/cobertura-coverage.xml'</code> as well, and I got the same error.</p>
  <p>This is the relevant section of my <code>Jenkinsfile</code>:</p>
  <pre><code>        stage('Test') {
              steps {
                  sh '''
                      docker build . --target test
                      DOCKER_BUILDKIT=1 docker build . -o ./coverage --target coverage
                      ls
                      ls ./coverage
                      pwd
                      cat ./coverage/cobertura-coverage.xml
                  '''
                  cobertura(coberturaReportFile: './coverage/cobertura-coverage.xml')
              }
          }
  </code></pre>
  <h1>Update 1</h1>
  <p>This is interesting... I tried changing the value of <code>coberturaReportFile</code> to <code>coverage/*.xml</code>, and the build produced the following error:</p>
  <pre><code>[Pipeline] cobertura
  [Cobertura] Publishing Cobertura coverage report...
  
  FATAL: Unable to find coverage results
  java.io.IOException: IO error scanning directory '/home/jenkins/agent/workspace/api_PR-8/coverage'
      at hudson.FilePath.glob(FilePath.java:1975)
      at hudson.FilePath.access$3400(FilePath.java:212)
      at hudson.FilePath$ListGlob.invoke(FilePath.java:1949)
      at hudson.FilePath$ListGlob.invoke(FilePath.java:1937)
      at hudson.FilePath.act(FilePath.java:1076)
      at hudson.FilePath.act(FilePath.java:1059)
      at hudson.FilePath.list(FilePath.java:1935)
      at hudson.FilePath.list(FilePath.java:1919)
      at hudson.FilePath.list(FilePath.java:1904)
      at hudson.plugins.cobertura.CoberturaPublisher$ParseReportCallable.invoke(CoberturaPublisher.java:896)
      at hudson.plugins.cobertura.CoberturaPublisher$ParseReportCallable.invoke(CoberturaPublisher.java:885)
      at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3122)
      at hudson.remoting.UserRequest.perform(UserRequest.java:211)
      at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      at hudson.remoting.Request$2.run(Request.java:369)
      at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:117)
      at java.lang.Thread.run(Thread.java:748)
      Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 10.0.4.46/10.0.4.46:49386
          at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1800)
          at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
          at hudson.remoting.Channel.call(Channel.java:1001)
          at hudson.FilePath.act(FilePath.java:1070)
          at hudson.FilePath.act(FilePath.java:1059)
          at hudson.plugins.cobertura.CoberturaPublisher.perform(CoberturaPublisher.java:548)
          at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
          at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
          at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
          at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
          at java.base/java.lang.Thread.run(Thread.java:834)
  </code></pre>
  <p>So maybe there was a try-catch in the Cobertura plugin code that was silencing this IO error.</p>
  <p>It's not clear to me why this IO error is occurring or what it means. The workspace is created fresh for every build.</p>
  <h1>Update 2</h1>
  <p>I also tried using the pattern <code>**/cobertura-coverage.xml</code>, but got the same error as in my initial post.</p>
  <pre><code>[Cobertura] Publishing Cobertura coverage report...
  
  [Cobertura] No coverage results were found using the pattern '**/cobertura-coverage.xml' relative to '/home/jenkins/agent/workspace/api_PR-8'.  Did you enter a pattern relative to the correct directory?  Did you generate the XML report(s) for Cobertura?
  </code></pre>