If your first code sample is an accurate representation of the code you're
using, then you probably need to change:

parallelTasks["windows"] = generateLinux()

to

parallelTasks["windows"] = generateWindows()



On Fri, Oct 11, 2019 at 6:20 AM Victor Martinez <
[email protected]> wrote:

> Hi there,
>
> Not sure whether this is related to
> https://github.com/jenkinsci/durable-task-plugin/pull/98 or something
> else, in any case I've raised
> https://issues.jenkins-ci.org/browse/JENKINS-59668 recently, but worth to
> mention here that I managed to narrow down when it happens, the below
> snippet shows that when running the parallel within the stage using two
> different methods causes nohup: failed to run command 'sh': No such file or
> directory ... process apparently never started in ...@tmp/durable-29eb87c3
>
> pipeline {
>   agent { label 'linux' }
> ...
>   stages {
>     stage('Test') {
>        steps {
>           script {
>             def parallelTasks = [:]
>             parallelTasks["linux"] = generateLinux()
>             parallelTasks["windows"] = generateLinux()
>             parallel(parallelTasks)
>           }
>        }
>     }
>   }
> }
>
>
> def generateLinux() {
>   return {
>     node('linux'){
>       try {
>       // whatever
>       }catch(e){
>         error(e.toString())
>       } finally {
>         docker.image('node:12').inside("-v ${WORKSPACE}/${BASE_DIR}:/app"){
>           sh '...'
>         }
>       }
>     }
>   }
> }
>
> def generateWindows(){
>   return {
>     node('windows'){
>       // whatever
>     }
>   }
> }
>
>
>
> While if I do run two different stages one for each method then no issues
> at all, so apparently the parallel does something tricky with the tasks
> internally, see the below snippet:
>
> pipeline {
>   agent { label 'linux' }
> ...
>   stages {
>     stage('Test') {
>        steps {
>           script {
>             def parallelTasks = [:]
>             parallelTasks["linux"] = generateLinux()
>           }
>        }
>     }
>     stage('TestWindows') {
>        steps {
>           script {
>             def parallelTasks = [:]
>             parallelTasks["windows"] = generateWindows()
>           }
>        }
>     }
>   }
> }
>
>
> def generateLinux() {
>   return {
>     node('linux'){
>       try {
>       // whatever
>       }catch(e){
>         error(e.toString())
>       } finally {
>         docker.image('node:12').inside("-v ${WORKSPACE}/${BASE_DIR}:/app"){
>           sh '...'
>         }
>       }
>     }
>   }
> }
>
> def generateWindows(){
>   return {
>     node('windows'){
>       // whatever
>     }
>   }
> }
>
>
> Even though I raised the above ticket, I wanted to share with you this
> particular use case as it seems really awkward.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/dee0e222-5574-48df-b3bd-35d53803ff9c%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/dee0e222-5574-48df-b3bd-35d53803ff9c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Thanks!
Mark Waite

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAO49JtFTrXeBYFtqhV8987VBpYM%2BXR1NEwiXpt2TE-0yF-vA4w%40mail.gmail.com.

Reply via email to