Can you share your Pipeline related plugins version please ?
Originally using .each{} syntax was not working as expected, but it should
be working on latest versions.

Hopefully it helps.

Le 17 nov. 2017 18:49, "Ramesh Bar" <[email protected]> a écrit :

> We are getting the below error with parallel pipeline for the 'Test' Stage
> which essentially tries to spin-up docker containers equal to number of
> tests for parallel execution. Will appreciate any thoughts/suggestions to
> fix this.
>
> java.lang.UnsupportedOperationException: Calling public static java.util.List 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(java.util.List,groovy.lang.Closure)
>  on a CPS-transformed closure is not yet supported (JENKINS-26481); 
> encapsulate in a @NonCPS method, or use Java-style loops
>
>
> *pipeline code:*
> def cucumberTestImage
> pipeline {
> agent any
> options {
> echo "options stuff"
> }
>
>   stages {
>     stage('Build & Deploy'){
> steps {
>         parallel (
>   SPA: {
>             script {
>                   echo "deploying SPA app"
>                 }
>               }
>             }
> echo 'SPA JOB COMPLETED!!'
>           },
>           Tests: {
>             script {
>               }
>               //building docker image name cucumberTestImage
>
>             }
>           }
>         )
>       }
>     }
>
> stage('Test') {
> steps {
> script {
> def tests = [:]
> getFeatures().each {stage -> tests[stage] = {
> cucumberTestImage.inside{sh "echo ${stage}"}
> }}
> parallel tests;
> }
> }
>     }
>   }
> }
>
> @NonCPS
> def getFeatures() {
>     return sh(script: 'cd testfolder && find features -type f -name
> \'*.feature\'', returnStdout: true).tokenize()
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" 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-users/85bc4dfb-6ab6-43e8-944c-09e215b26d4f%40googlegroups.
> com
> <https://groups.google.com/d/msgid/jenkinsci-users/85bc4dfb-6ab6-43e8-944c-09e215b26d4f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" 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-users/CAPO77c03VG6Y%2BPRBsm_vKdQb6LQcSAUoJ%2BvpNNgHovMn2vdXtw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to