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

Post-build action "Archive the artifacts" prints exception to console when no artifacts found (regression in 2.108)

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • Jenkins version 2.121.1
    • 2.344

      In my job configuration, I have Do not fail build if archiving returns nothing checked under Post-build Actions > Archive the artifacts so that build still completes even if no artifacts are created (this is intentional). The help icon describes this field as such:

      Normally, a build fails if archiving returns zero artifacts. This option allows the archiving process to return nothing without failing the build. Instead, the build will simply throw a warning.

      In Jenkins 2.107.3 this causes the following warning to be printed to the build console:

      15:30:26 Archiving artifacts
      15:30:27 WARN: No artifacts found that match the file pattern "**/data/behat-failure/**/*". Configuration error?
      15:30:28 WARN: java.lang.InterruptedException: no matches found within 10000
      

      However, in Jenkins 2.121.1 the following big ugly stack trace is now printed to the build console:

      12:28:36 Archiving artifacts
      12:28:36 java.lang.InterruptedException: no matches found within 10000
      12:28:36 	at hudson.FilePath$34.hasMatch(FilePath.java:2678)
      12:28:36 	at hudson.FilePath$34.invoke(FilePath.java:2557)
      12:28:36 	at hudson.FilePath$34.invoke(FilePath.java:2547)
      12:28:36 	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2918)
      12:28:36 Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to [redacted]
      12:28:36 		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
      12:28:36 		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
      12:28:36 		at hudson.remoting.Channel.call(Channel.java:955)
      12:28:36 		at hudson.FilePath.act(FilePath.java:1036)
      12:28:36 		at hudson.FilePath.act(FilePath.java:1025)
      12:28:36 		at hudson.FilePath.validateAntFileMask(FilePath.java:2547)
      12:28:36 		at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:243)
      12:28:36 		at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
      12:28:36 		at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      12:28:36 		at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
      12:28:36 		at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
      12:28:36 		at hudson.model.Build$BuildExecution.post2(Build.java:186)
      12:28:36 		at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
      12:28:36 		at hudson.model.Run.execute(Run.java:1819)
      12:28:36 		at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      12:28:36 		at hudson.model.ResourceController.execute(ResourceController.java:97)
      12:28:36 		at hudson.model.Executor.run(Executor.java:429)
      12:28:36 Caused: hudson.FilePath$TunneledInterruptedException
      12:28:36 	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2920)
      12:28:36 	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
      12:28:36 	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      12:28:36 	at hudson.remoting.Request$2.run(Request.java:369)
      12:28:36 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      12:28:36 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      12:28:36 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      12:28:36 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      12:28:36 	at java.lang.Thread.run(Thread.java:748)
      12:28:36 Caused: java.lang.InterruptedException: java.lang.InterruptedException: no matches found within 10000
      12:28:36 	at hudson.FilePath.act(FilePath.java:1038)
      12:28:36 	at hudson.FilePath.act(FilePath.java:1025)
      12:28:36 	at hudson.FilePath.validateAntFileMask(FilePath.java:2547)
      12:28:36 	at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:243)
      12:28:36 	at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
      12:28:36 	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      12:28:36 	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
      12:28:36 	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
      12:28:36 	at hudson.model.Build$BuildExecution.post2(Build.java:186)
      12:28:36 	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
      12:28:36 	at hudson.model.Run.execute(Run.java:1819)
      12:28:36 	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      12:28:36 	at hudson.model.ResourceController.execute(ResourceController.java:97)
      12:28:36 	at hudson.model.Executor.run(Executor.java:429)
      12:28:36 No artifacts found that match the file pattern "**/data/behat-failure/**/*". Configuration error?
      

          [JENKINS-51913] Post-build action "Archive the artifacts" prints exception to console when no artifacts found (regression in 2.108)

          Paul Holden created issue -

          Paul Holden added a comment -

          This is the commit from JENKINS-47142 that appears to have led to this change, and caused the full stacktrace to be printed to the build console

          Paul Holden added a comment - This is the commit from JENKINS-47142 that appears to have led to this change, and caused the full stacktrace to be printed to the build console
          Paul Holden made changes -
          Link New: This issue is related to JENKINS-47142 [ JENKINS-47142 ]

          Jesse Glick added a comment -

          Seems to be a poor interaction with an old fix of JENKINS-7214. Jenkins is dutifully trying to look up artifacts matching the pattern you provided, but it gave up after examining ten thousand (!) files. Try a more specific file pattern.

          Jesse Glick added a comment - Seems to be a poor interaction with an old fix of JENKINS-7214 . Jenkins is dutifully trying to look up artifacts matching the pattern you provided, but it gave up after examining ten thousand (!) files. Try a more specific file pattern.
          Jesse Glick made changes -
          Link New: This issue relates to JENKINS-7214 [ JENKINS-7214 ]

          Paul Holden added a comment -

          Hi jglick, I'm not expecting it to find any artifacts (they would only exist if a Behat step failed); the problem is that the stacktrace I included in this issue description is now printed to the build console when no artifacts exist, which seems to be a regression caused by 2.121.1, introduced in JENKINS-47142.

          I have Do not fail build if archiving returns nothing checked for the job.

          Paul Holden added a comment - Hi jglick , I'm not expecting it to find any artifacts (they would only exist if a Behat step failed); the problem is that the stacktrace I included in this issue description is now printed to the build console when no artifacts exist, which seems to be a regression caused by 2.121.1 , introduced in JENKINS-47142 . I have Do not fail build if archiving returns nothing checked for the job.

          Paul Thevenot added a comment -

          Same issue here. Do not fail build if archiving returns nothing is checked so I don't expect to have a stacktrace if no artifact has been found.

          Paul Thevenot added a comment - Same issue here.  Do not fail build if archiving returns nothing is checked so I don't expect to have a stacktrace if no artifact has been found.

          Paul Holden added a comment -

          Just a follow up to state that the suggestion by jglick to:

          Try a more specific file pattern.

          Has resolved this for us: we no longer get the exception in job logs when no artifacts are found; and artifacts are successfully archived when they do exist

          Paul Holden added a comment - Just a follow up to state that the suggestion by jglick to: Try a more specific file pattern. Has resolved this for us: we no longer get the exception in job logs when no artifacts are found; and artifacts are successfully archived when they do exist

          Vincent Massol added a comment - - edited

          I'm having the same issue and I don't see how I could use a more specific pattern. This is what I'm using:

                  // Save videos generated by Docker-based tests, if any
                  archiveArtifacts artifacts: '**/target/*/*.flv', allowEmptyArchive: true
          
                  // Save images generated by functional tests, if any
                  archiveArtifacts artifacts: '**/target/screenshots/*.png', allowEmptyArchive: true
          

          And when executing on a small project (https://ci.xwiki.org/view/All%20Failed%20Builds/job/XWiki%20Contrib/job/latex/job/master/34/console), I get:

          [Pipeline] archiveArtifacts
          Archiving artifacts
          [Pipeline] archiveArtifacts
          Archiving artifacts
          java.lang.InterruptedException: no matches found within 10000
          	at hudson.FilePath$ValidateAntFileMask.hasMatch(FilePath.java:2847)
          	at hudson.FilePath$ValidateAntFileMask.invoke(FilePath.java:2726)
          	at hudson.FilePath$ValidateAntFileMask.invoke(FilePath.java:2707)
          	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3086)
          Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to Jenkins SSH Slave-0015psb3jxva1
          		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
          		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
          		at hudson.remoting.Channel.call(Channel.java:955)
          		at hudson.FilePath.act(FilePath.java:1072)
          		at hudson.FilePath.act(FilePath.java:1061)
          		at hudson.FilePath.validateAntFileMask(FilePath.java:2705)
          		at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:243)
          		at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
          		at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
          		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
          		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          Caused: hudson.FilePath$TunneledInterruptedException
          	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3088)
          	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
          	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)
          Caused: java.lang.InterruptedException: java.lang.InterruptedException: no matches found within 10000
          	at hudson.FilePath.act(FilePath.java:1074)
          	at hudson.FilePath.act(FilePath.java:1061)
          	at hudson.FilePath.validateAntFileMask(FilePath.java:2705)
          	at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:243)
          	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
          	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
          	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
          	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          	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 java.lang.Thread.run(Thread.java:748)
          No artifacts found that match the file pattern "**/target/screenshots/*.png". Configuration error?
          

          Interestingly the first archive didn't throw any stack trace but it's less specific than the second one!

          Any idea is most welcome. Thx

          EDIT: I think the reason we don't get a stack trace for the first archive is because there was one match in this case. So it seems the stack trace is only displayed when there's no match which really goes against the "allowEmptyArchive" parameter...

          Vincent Massol added a comment - - edited I'm having the same issue and I don't see how I could use a more specific pattern. This is what I'm using: // Save videos generated by Docker-based tests, if any archiveArtifacts artifacts: '**/target/*/*.flv', allowEmptyArchive: true // Save images generated by functional tests, if any archiveArtifacts artifacts: '**/target/screenshots/*.png', allowEmptyArchive: true And when executing on a small project ( https://ci.xwiki.org/view/All%20Failed%20Builds/job/XWiki%20Contrib/job/latex/job/master/34/console ), I get: [Pipeline] archiveArtifacts Archiving artifacts [Pipeline] archiveArtifacts Archiving artifacts java.lang.InterruptedException: no matches found within 10000 at hudson.FilePath$ValidateAntFileMask.hasMatch(FilePath.java:2847) at hudson.FilePath$ValidateAntFileMask.invoke(FilePath.java:2726) at hudson.FilePath$ValidateAntFileMask.invoke(FilePath.java:2707) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3086) Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to Jenkins SSH Slave-0015psb3jxva1 at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741) at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357) at hudson.remoting.Channel.call(Channel.java:955) at hudson.FilePath.act(FilePath.java:1072) at hudson.FilePath.act(FilePath.java:1061) at hudson.FilePath.validateAntFileMask(FilePath.java:2705) at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:243) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) Caused: hudson.FilePath$TunneledInterruptedException at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3088) at hudson.remoting.UserRequest.perform(UserRequest.java:212) 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) Caused: java.lang.InterruptedException: java.lang.InterruptedException: no matches found within 10000 at hudson.FilePath.act(FilePath.java:1074) at hudson.FilePath.act(FilePath.java:1061) at hudson.FilePath.validateAntFileMask(FilePath.java:2705) at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:243) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 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 java.lang.Thread.run(Thread.java:748) No artifacts found that match the file pattern "**/target/screenshots/*.png". Configuration error? Interestingly the first archive didn't throw any stack trace but it's less specific than the second one! Any idea is most welcome. Thx EDIT: I think the reason we don't get a stack trace for the first archive is because there was one match in this case. So it seems the stack trace is only displayed when there's no match which really goes against the "allowEmptyArchive" parameter...

          Jesse Glick added a comment -

          Not sure offhand of details. Workaround would generally be to use shell scripts running (e.g.) find to collect relevant files into a single directory before using a simpler Jenkins directive to archive them.

          Jesse Glick added a comment - Not sure offhand of details. Workaround would generally be to use shell scripts running (e.g.) find to collect relevant files into a single directory before using a simpler Jenkins directive to archive them.

            gregswift Greg Swift
            pholden Paul Holden
            Votes:
            8 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: