Compatability with parallel

60 views
Skip to first unread message

fkp...@gmail.com

unread,
Sep 21, 2016, 8:03:03 AM9/21/16
to Jenkins Developers
Hi,
I'd like our plugin to support the parallel step (in pipelines).
I haven't found any documentation on what steps / methods i should implement to ensure our support.

Is there any known issues / methods or etc. i should go through?

Thanks ahead!

Jesse Glick

unread,
Sep 21, 2016, 9:37:05 AM9/21/16
to Jenkins Dev
On Wed, Sep 21, 2016 at 8:03 AM, <fkp...@gmail.com> wrote:
> I'd like our plugin to support the parallel step (in pipelines).
> I haven't found any documentation on what steps / methods i should implement
> to ensure our support.

There is nothing specific you need to implement. Does it currently
work in a Pipeline build that is not using `parallel` but fail in one
that is? If so, how?

The Pipeline APIs are designed to allow access to contextual objects
using dynamic scopes; each step accepting a block argument potentially
introduces a scope with added/overridden context, and each step may
access a context. For example, in

parallel linux: {
node('linux') {
sh 'make'
}
}, windows: {
node('windows') {
bat 'msbuild'
}
}

the `sh` and `bat` steps each get access to various API objects such
as a `FilePath` and `Launcher`, supplied by the enclosing `node`.

One thing to note: if a script sets environment variables using the syntax

env.SOME_SERVICE_URL = 'https://someservice.corp/'

that setting takes effect for the remainder of the build, regardless
of scopes. (Such variables also get exposed via the REST API and to
upstream builds using the `build` step, so they can be used to
“export” simple data from a build.) Any variables that might need to
vary by machine or operating system should generally be set using the
`withEnv` step so they scope properly:

parallel linux: {
node('linux') {
withEnv(["PATH=${tool 'gnumake'}/bin:${env.PATH}"]) {
sh 'make'
}
}
}, windows: {
node('windows') {
// uses default %Path%
bat 'msbuild'
}
}

(Various other block-scoped steps such as `withCredentials` also set
environment variables contextually.)
Message has been deleted

fkp...@gmail.com

unread,
Sep 26, 2016, 12:00:25 PM9/26/16
to Jenkins Developers
Thanks!
Yes, I still can't trace the source, I need to inspect threads more carefully to try to catch it.
Are there any methods that i need to look into - given the below exceptions?


PM org.jenkinsci.plugins.workflow.cps.CpsStepContext onFailure
WARNING: already completed CpsStepContext[30]:Owner[new pipe test/5:new pipe test #5]
java.lang.IllegalStateException: org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
    at org.jenkinsci.plugins.workflow.cps.CpsStepContext.onFailure(CpsStepContext.java:325)
    at org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback$Wrapper.onFailure(BodyExecutionCallback.java:89)
    at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$FailureAdapter.receive(CpsBodyExecution.java:278)
    at com.cloudbees.groovy.cps.impl.ThrowBlock$1.receive(ThrowBlock.java:68)
    at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
    at com.cloudbees.groovy.cps.Next.step(Next.java:58)
    at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
    at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
    at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    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:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
    at org.jenkinsci.plugins.workflow.cps.CpsStepContext$2.onSuccess(CpsStepContext.java:382)
    at org.jenkinsci.plugins.workflow.cps.CpsStepContext$2.onSuccess(CpsStepContext.java:362)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$4$1.run(CpsFlowExecution.java:627)
    at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:35)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    ... 8 more
Caused by: org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
    at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution.cancel(CpsBodyExecution.java:189)
    at org.jenkinsci.plugins.workflow.steps.BodyExecution.cancel(BodyExecution.java:76)
    at org.jenkinsci.plugins.workflow.cps.steps.ParallelStepExecution.stop(ParallelStepExecution.java:66)
    at org.jenkinsci.plugins.workflow.cps.steps.ParallelStep$ResultHandler$Callback.checkAllDone(ParallelStep.java:144)
    at org.jenkinsci.plugins.workflow.cps.steps.ParallelStep$ResultHandler$Callback.onFailure(ParallelStep.java:131)
    at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$FailureAdapter.receive(CpsBodyExecution.java:278)
    at com.cloudbees.groovy.cps.impl.ThrowBlock$1.receive(ThrowBlock.java:68)
    at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
    at com.cloudbees.groovy.cps.Next.step(Next.java:58)
    at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
    at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
    at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
    ... 8 more
    Suppressed: java.lang.UnsupportedOperationException
        at org.jenkinsci.plugins.workflow.support.steps.StageStepExecution.stop(StageStepExecution.java:102)
        at org.jenkinsci.plugins.workflow.cps.CpsThread.stop(CpsThread.java:283)
        at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$1.onSuccess(CpsBodyExecution.java:197)
        at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$1.onSuccess(CpsBodyExecution.java:194)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$4$1.run(CpsFlowExecution.java:627)
        at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:35)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        ... 8 more

Jesse Glick

unread,
Sep 27, 2016, 9:59:38 AM9/27/16
to Jenkins Dev
On Mon, Sep 26, 2016 at 11:53 AM, <fkp...@gmail.com> wrote:
> I can't seem to pinpoint the exact issue when it crashes

Without at least some information about the step you are writing and
the script you are trying to demonstrate it with, it is hard to help.
Narrow it down to a minimal reproducible test case.

BTW you seem to be using deprecated non-block-scoped `stage`, and
doing it inside `parallel` which was never supported.
Reply all
Reply to author
Forward
0 new messages