Error with parallel pipeline

67 views
Skip to first unread message

Ramesh Bar

unread,
Nov 17, 2017, 12:49:35 PM11/17/17
to Jenkins Users
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()
}

Michael Pailloncy

unread,
Nov 20, 2017, 7:13:48 AM11/20/17
to jenkins...@googlegroups.com
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.

--
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 jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/85bc4dfb-6ab6-43e8-944c-09e215b26d4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages