[JIRA] (JENKINS-58421) Junit step on post-always breaks the channel on error

9 views
Skip to first unread message

kuisathaverat@gmail.com (JIRA)

unread,
Jul 10, 2019, 5:35:05 AM7/10/19
to jenkinsc...@googlegroups.com
Ivan Fernandez Calvo created an issue
 
Jenkins / New Feature JENKINS-58421
Junit step on post-always breaks the channel on error
Issue Type: New Feature New Feature
Assignee: Andrew Bayer
Components: junit-plugin, pipeline-model-definition-plugin
Created: 2019-07-10 09:34
Environment: Jenkins Core 2.184
junit 1.28
Script Security Plugin 1.61
Pipeline: Declarative 1.3.9
Pipeline: Nodes and Processes 2.32
Priority: Minor Minor
Reporter: Ivan Fernandez Calvo

After the last update we show some JNLP errors on pipeline logs, after a while the detected a pattern that related it to the junit plugin, so I make a local test and I replicated, it seems that the junit plugin breaks the channel if it throws an error on a post { always {} } stage

pipeline {
  agent {
    label 'my-agent'
  }
  stages {
    stage('error-test') {
      steps {
        echo 'Hello World'
      }
      post {
        always {
          junit(allowEmptyResults: false,
            keepLongStdio: true,
            testResults: "**/test-results/functional-tests.xml")
        }
      }
    }
  }
}
[Pipeline] echo (hide)
Hello World
Post stage
[Pipeline] junit
Recording test results
No test report files were found. Configuration error?
Error when executing always post condition:
hudson.AbortException: No test report files were found. Configuration error?
	at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:154)
	at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:118)
	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3052)
	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)
	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 hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93)
	at java.base/java.lang.Thread.run(Thread.java:834)
	Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from localhost/127.0.0.1:57014
		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)
		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
		at hudson.remoting.Channel.call(Channel.java:957)
		at hudson.FilePath.act(FilePath.java:1072)
		at hudson.FilePath.act(FilePath.java:1061)
		at hudson.tasks.junit.JUnitParser.parseResult(JUnitParser.java:114)
		at hudson.tasks.junit.JUnitResultArchiver.parse(JUnitResultArchiver.java:137)
		at hudson.tasks.junit.JUnitResultArchiver.parseAndAttach(JUnitResultArchiver.java:167)
		at hudson.tasks.junit.pipeline.JUnitResultsStepExecution.run(JUnitResultsStepExecution.java:52)
		at hudson.tasks.junit.pipeline.JUnitResultsStepExecution.run(JUnitResultsStepExecution.java:25)
		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)
		... 1 more

If we use the error step the behavior is the expected the connection to the agent is not lost

pipeline {
  agent {
    label 'my-agent'
  }
  stages {
    stage('error-test') {
      steps {
        echo 'Hello World'
      }
      post {
        always {
          error('message')
        }
      }
    }
  }
}
[Pipeline] echo
Hello World
Post stage
[Pipeline] error
Error when executing always post condition:
hudson.AbortException: failed
	at org.jenkinsci.plugins.workflow.steps.ErrorStep$Execution.run(ErrorStep.java:63)
	at org.jenkinsci.plugins.workflow.steps.ErrorStep$Execution.run(ErrorStep.java:50)
	at org.jenkinsci.plugins.workflow.steps.SynchronousStepExecution.start(SynchronousStepExecution.java:38)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:269)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:177)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
	at jdk.internal.reflect.GeneratedMethodAccessor480.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:158)
	at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:156)
	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:160)
	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:130)
	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
	at WorkflowScript.run(WorkflowScript:12)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.delegateAndExecute(ModelInterpreter.groovy:138)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.runPostConditions(ModelInterpreter.groovy:796)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.catchRequiredContextForNode(ModelInterpreter.groovy:418)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.catchRequiredContextForNode(ModelInterpreter.groovy:416)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.runPostConditions(ModelInterpreter.groovy:795)
	at com.cloudbees.groovy.cps.CpsDefaultGroovyMethods.each(CpsDefaultGroovyMethods:2030)
	at com.cloudbees.groovy.cps.CpsDefaultGroovyMethods.each(CpsDefaultGroovyMethods:2015)
	at com.cloudbees.groovy.cps.CpsDefaultGroovyMethods.each(CpsDefaultGroovyMethods:2056)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.runPostConditions(ModelInterpreter.groovy:785)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.executeSingleStage(ModelInterpreter.groovy:695)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:281)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.toolsBlock(ModelInterpreter.groovy:567)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.toolsBlock(ModelInterpreter.groovy:566)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:271)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withEnvBlock(ModelInterpreter.groovy:466)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withEnvBlock(ModelInterpreter.groovy:465)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:270)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withCredentialsBlock(ModelInterpreter.groovy:504)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withCredentialsBlock(ModelInterpreter.groovy:503)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:269)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:316)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inDeclarativeAgent(ModelInterpreter.groovy:608)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inDeclarativeAgent(ModelInterpreter.groovy:607)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:313)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.stageInput(ModelInterpreter.groovy:379)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.stageInput(ModelInterpreter.groovy:378)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:312)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inWrappers(ModelInterpreter.groovy:635)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inWrappers(ModelInterpreter.groovy:634)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:252)
	at ___cps.transform___(Native Method)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:84)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
	at jdk.internal.reflect.GeneratedMethodAccessor461.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
	at com.cloudbees.groovy.cps.Next.step(Next.java:83)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
	at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
	at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:66)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
	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)

[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: failed
Finished: FAILURE
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

kuisathaverat@gmail.com (JIRA)

unread,
Jul 10, 2019, 7:54:01 AM7/10/19
to jenkinsc...@googlegroups.com
Ivan Fernandez Calvo commented on New Feature JENKINS-58421
 
Re: Junit step on post-always breaks the channel on error

the archiveArtifacts step has the same behaviour even do you enable allowEmptyArchive: true

[2019-07-10T11:48:06.270Z] [Pipeline] archiveArtifacts
[2019-07-10T11:48:06.276Z] Archiving artifacts
[2019-07-10T11:48:07.679Z] java.lang.InterruptedException: no matches found within 10000
[2019-07-10T11:48:07.679Z] 	at hudson.FilePath$ValidateAntFileMask.hasMatch(FilePath.java:2805)
[2019-07-10T11:48:07.679Z] 	at hudson.FilePath$ValidateAntFileMask.invoke(FilePath.java:2684)
[2019-07-10T11:48:07.679Z] 	at hudson.FilePath$ValidateAntFileMask.invoke(FilePath.java:2665)
[2019-07-10T11:48:07.679Z] 	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3052)
[2019-07-10T11:48:07.679Z] Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from my-agent
[2019-07-10T11:48:07.679Z] 		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)
[2019-07-10T11:48:07.679Z] 		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
[2019-07-10T11:48:07.679Z] 		at hudson.remoting.Channel.call(Channel.java:957)
[2019-07-10T11:48:07.679Z] 		at hudson.FilePath.act(FilePath.java:1072)
[2019-07-10T11:48:07.679Z] 		at hudson.FilePath.act(FilePath.java:1061)
[2019-07-10T11:48:07.679Z] 		at hudson.FilePath.validateAntFileMask(FilePath.java:2663)
[2019-07-10T11:48:07.679Z] 		at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:248)
[2019-07-10T11:48:07.679Z] 		at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
[2019-07-10T11:48:07.679Z] 		at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
[2019-07-10T11:48:07.679Z] 		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[2019-07-10T11:48:07.679Z] 		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[2019-07-10T11:48:07.679Z] 		at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2019-07-10T11:48:07.679Z] 		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2019-07-10T11:48:07.679Z] 		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2019-07-10T11:48:07.679Z] Caused: hudson.FilePath$TunneledInterruptedException
[2019-07-10T11:48:07.679Z] 	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3054)
[2019-07-10T11:48:07.679Z] 	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
[2019-07-10T11:48:07.679Z] 	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
[2019-07-10T11:48:07.679Z] 	at hudson.remoting.Request$2.run(Request.java:369)
[2019-07-10T11:48:07.679Z] 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
[2019-07-10T11:48:07.679Z] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2019-07-10T11:48:07.679Z] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2019-07-10T11:48:07.679Z] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2019-07-10T11:48:07.679Z] 	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93)
[2019-07-10T11:48:07.679Z] Caused: java.lang.InterruptedException: java.lang.InterruptedException: no matches found within 10000
[2019-07-10T11:48:07.679Z] 	at hudson.FilePath.act(FilePath.java:1074)
[2019-07-10T11:48:07.679Z] 	at hudson.FilePath.act(FilePath.java:1061)
[2019-07-10T11:48:07.679Z] 	at hudson.FilePath.validateAntFileMask(FilePath.java:2663)
[2019-07-10T11:48:07.679Z] 	at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:248)
[2019-07-10T11:48:07.679Z] 	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
[2019-07-10T11:48:07.679Z] 	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
[2019-07-10T11:48:07.679Z] 	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[2019-07-10T11:48:07.679Z] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[2019-07-10T11:48:07.679Z] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2019-07-10T11:48:07.679Z] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2019-07-10T11:48:07.679Z] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2019-07-10T11:48:07.679Z] 	at java.lang.Thread.run(Thread.java:748)
[2019-07-10T11:48:07.679Z] No artifacts found that match the file pattern "**/tests-results/functional-tests.xml". Configuration error?

kuisathaverat@gmail.com (JIRA)

unread,
Jul 10, 2019, 8:03:03 AM7/10/19
to jenkinsc...@googlegroups.com
Ivan Fernandez Calvo updated an issue
 
After the last update we show some JNLP errors on pipeline logs, after a while the detected a pattern that related it to the junit plugin, so I make a local test and I replicated, it seems that the junit plugin breaks the channel if it throws an error on a post { always {} } stage

{code}

pipeline {
  agent {
    label 'my-agent'
  }
  stages {
    stage('error-test') {
      steps {
        echo 'Hello World'
      }
      post {
        always {
          junit(allowEmptyResults: false,
            keepLongStdio: true,
            testResults: "**/test-results/functional-tests.xml")
        }
      }
    }
  }
    post {
        cleanup {
           sh "echo 'la -la' > script.sh"
           sh '/bin/bash -c script.sh'
}
    }
}
{code}

{code}
{code}




If we use the error step the behavior is the expected the connection to the agent is not lost

{code}

pipeline {
  agent {
    label 'my-agent'
  }
  stages {
    stage('error-test') {
      steps {
        echo 'Hello World'
      }
      post {
        always {
          error('message')
        }
      }
    }
  }
}
{code}

{code}
{code}

kuisathaverat@gmail.com (JIRA)

unread,
Jul 10, 2019, 8:10:12 AM7/10/19
to jenkinsc...@googlegroups.com

...

[Pipeline]
{ (Declarative: Post Actions)
[Pipeline] sh
+ echo 'la -la'
[Pipeline] sh
+ /bin/bash -c script.sh
/bin/bash: script.sh: command not found
Error when executing cleanup post condition:
hudson.AbortException: script returned exit
code 127
at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.handleExit(DurableTaskStep.java:599)
at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.check(DurableTaskStep.java:545)
at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.run(DurableTaskStep.java:489)

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.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
}
Reply all
Reply to author
Forward
0 new messages