Hi Zilla, this doesn't work for me. I get:

java.io.NotSerializableException: hudson.slaves.EnvironmentVariablesNodeProperty


Any ideas?


Thanks,


Nick


On Friday, 27 July 2018 01:14:23 UTC+10, ZillaYT wrote:
>
> I just had to do this to fix it.
>
> Jenkins instance = Jenkins.getInstance()
> def globalNodeProperties = instance.getGlobalNodeProperties()
> def envVarsNodePropertyList = globalNodeProperties.getAll(hudson.slaves.
> EnvironmentVariablesNodeProperty.class)
> def newEnvVarsNodeProperty = null
> def envVars = null
>
>
>
> On Thursday, July 26, 2018 at 10:52:49 AM UTC-4, ZillaYT wrote:
>>
>> I copy/pasted this code in my Jenkinsfile (including import calls above) 
>> and I get
>>
>> an exception which occurred:
>>         in field groovy.lang.Closure.delegate
>>         in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@4d78782
>>         in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.closures
>>         in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@41f97d3f
>>         in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@41f97d3f
>> Caused: java.io.NotSerializableException: hudson.model.Hudson
>>         at 
>> org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
>>         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.LinkedHashMap.internalWriteEntries(LinkedHashMap.java:333)
>>         at java.util.HashMap.writeObject(HashMap.java:1362)
>>         at sun.reflect.GeneratedMethodAccessor139.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:273)
>>         at 
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
>>         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 
>> com.cloudbees.groovy.cps.SerializableScript.writeObject(SerializableScript.java:26)
>>         at sun.reflect.GeneratedMethodAccessor149.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:273)
>>         at 
>> org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
>>         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</span
>>
>>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/83087438-a9a9-4f2f-ab89-cb16395de10c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to