java.io.NotSerializableException: java.util.AbstractList$Itr
Now I understand from the docs (https://github.com/jenkinsci/workflow-plugin/blob/master/TUTORIAL.md#serialization-of-local-variables) that some variables can't be serialized before a "sh" step might happen, but as I'm new to groovy I'm struggling to understand how the above might be achieved. I've tried in a method and inline as suggested.
The workaround I have at the moment is
hostnames.each { host ->
do something interesting with host ...
}
def hostnames = ['192.168.0.1', '192.168.0.2']
def bees = ["192.168.0.1", "192.168.0.2"]
for( def b: bees ) {
echo "${b}"
}
java.io.NotSerializableException: java.util.AbstractList$Itr