-
Bug
-
Resolution: Unresolved
-
Minor
-
None
I'm trying to run some code on all nodes in list one by one (in my example node labels is Amason node IDs)
def amazonIDs = ["i-123456","i-345678"] for ( int i = 0; i < amazonIDs.size; i++ ) { println amazonIDs.get(i) println "=========" node(amazonIDs.get(i)) { sh "echo 122121" } }
This code should run echo on each node in list, one by one.
In fact, I got exception, please see below.
I tried to use `build ()` to run pre-created job for each node but got the same issue.
Are any workaround to run code on each node in list?
an exception which occurred: in field launcher in field locals in field parent in field parent in field parent in field capture in field def in field closures in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@4585ae8d Caused: java.io.NotSerializableException: hudson.slaves.JNLPLauncher at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:569) at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65) at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56) at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50) at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344) at java.util.HashMap.internalWriteEntries(HashMap.java:1785) at java.util.HashMap.writeObject(HashMap.java:1362) at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65) at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56) at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50) at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344) at java.util.HashMap.internalWriteEntries(HashMap.java:1785) at java.util.HashMap.writeObject(HashMap.java:1362) at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58) at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111) at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:140) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:458) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:434) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:422) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:362) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:82) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:242) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:230) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64) 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:748)
Environment details:
lsb_release -a Description: Ubuntu 16.04.2 LTS Release: 16.04 Codename: xenial dpkg -l | grep jenkins ii jenkins 2.60.2 java -version java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode) /usr/bin/java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://127.0.0.1:8080 list-plugins --username=jenkins_admin --password=<PASSWORD> pipeline-aggregator-view Pipeline Aggregator 1.7 pipeline-graph-analysis Pipeline Graph Analysis Plugin 1.5 pipeline-model-declarative-agent Pipeline: Declarative Agent API 1.1.1 external-monitor-job External Monitor Job Type Plugin 1.7 workflow-api Pipeline: API 2.20 script-security Script Security Plugin 1.33 structs Structs Plugin 1.9 (1.10) pipeline-maven Pipeline Maven Integration Plugin 3.0.0 docker-workflow Docker Pipeline 1.12 workflow-support Pipeline: Supporting APIs 2.14 groovy-label-assignment Groovy Label Assignment plugin 1.2.0 pipeline-model-api Pipeline: Model API 1.1.9 mercurial Mercurial plugin 2.0 (2.1) workflow-durable-task-step Pipeline: Nodes and Processes 2.13 (2.14) pipeline-stage-tags-metadata Pipeline: Stage Tags Metadata 1.1.9 branch-api Branch API Plugin 2.0.11 pipeline-utility-steps Pipeline Utility Steps 1.4.0 ldap LDAP Plugin 1.16 resource-disposer Resource Disposer Plugin 0.6 (0.7) ldapemail LDAP Email Plugin 0.8 momentjs JavaScript GUI Lib: Moment.js bundle plugin 1.1.1 durable-task Durable Task Plugin 1.14 bitbucket Bitbucket Plugin 1.1.5 pipeline-build-step Pipeline: Build Step 2.5.1 windows-slaves Windows Slaves Plugin 1.3.1 plain-credentials Plain Credentials Plugin 1.4 config-file-provider Config File Provider Plugin 2.16.1 (2.16.3) build-blocker-plugin Build Blocker Plugin 1.7.3 junit JUnit Plugin 1.20 (1.21) pipeline-milestone-step Pipeline: Milestone Step 1.3.1 workflow-scm-step Pipeline: SCM Step 2.6 docker-commons Docker Commons Plugin 1.8 pipeline-stage-step Pipeline: Stage Step 2.2 role-strategy Role-based Authorization Strategy 2.5.1 credentials-binding Credentials Binding Plugin 1.12 (1.13) ansicolor AnsiColor 0.5.0 (0.5.2) pipeline-stage-view Pipeline: Stage View Plugin 2.8 pipeline-model-definition Pipeline: Model Definition 1.1.9 timestamper Timestamper 1.8.8 pipeline-input-step Pipeline: Input Step 2.7 (2.8) groovy-events-listener-plugin Groovy Events Listener Plugin 1.014 matrix-auth Matrix Authorization Strategy Plugin 1.7 ssh-credentials SSH Credentials Plugin 1.13 git Git plugin 3.5.0 (3.5.1) build-name-setter build-name-setter 1.6.7 jquery-detached JavaScript GUI Lib: jQuery bundles (jQuery and jQuery UI) plugin 1.2.1 workflow-job Pipeline: Job 2.12.1 (2.12.2) jobConfigHistory Job Configuration History Plugin 2.16 (2.17) pipeline-rest-api Pipeline: REST API Plugin 2.8 ace-editor JavaScript GUI Lib: ACE Editor bundle plugin 1.1 javadoc Javadoc Plugin 1.4 display-url-api Display URL API 2.0 authentication-tokens Authentication Tokens API Plugin 1.3 ws-cleanup Workspace Cleanup Plugin 0.34 icon-shim Icon Shim Plugin 2.0.3 mailer Mailer Plugin 1.20 dashboard-view Dashboard View 2.9.11 pam-auth PAM Authentication plugin 1.3 bouncycastle-api bouncycastle API Plugin 2.16.2 git-server GIT server Plugin 1.7 nexus-artifact-uploader Nexus Artifact Uploader 2.9 (2.10) extended-read-permission Extended Read Permission Plugin 2.0 gitlab-plugin GitLab Plugin 1.4.7 groovy-postbuild Groovy Postbuild 2.3.1 workflow-cps-global-lib Pipeline: Shared Groovy Libraries 2.8 ant Ant Plugin 1.5 (1.7) workflow-aggregator Pipeline 2.5 workflow-step-api Pipeline: Step API 2.12 maven-plugin Maven Integration plugin 2.17 scm-api SCM API Plugin 2.2.0 (2.2.1) global-post-script Global Post Script Plugin 1.1.3 matrix-project Matrix Project Plugin 1.11 credentials Credentials Plugin 2.1.14 handlebars JavaScript GUI Lib: Handlebars bundle plugin 1.1.1 statistics-gatherer Statistics Gatherer Plugin 1.1.2 cloudbees-folder Folders Plugin 6.1.0 (6.1.2) pipeline-model-extensions Pipeline: Declarative Extension Points API 1.1.9 workflow-basic-steps Pipeline: Basic Steps 2.6 workflow-multibranch Pipeline: Multibranch 2.16 token-macro Token Macro Plugin 2.1 (2.2) groovy Groovy 2.0 workflow-cps Pipeline: Groovy 2.39 git-client Git client plugin 2.5.0 antisamy-markup-formatter OWASP Markup Formatter Plugin 1.5