title: Groovy Script Error : java.io.NotSerializableException: com.xlson.groovycsv.CsvIterator
body: <p>I have a small test stage in Jenkins groovy script to get the branch values by looping into a csv file , this works fine when I don't include the HELM_REPO_BRANCH in the loop but fails with java.io.NotSerializableException: com.xlson.groovycsv.CsvIterator error if i try to fetch the value from another function. Any idea how to resolve it ?.</p>
  
  <pre><code>stage("Deploy missing Services to ${DEST_ENV}"){
  sh 'echo NAME,VERSION &gt;test.csv'
  sh 'echo account,1.17.1 &gt;&gt;test.csv'
  sh 'echo payment,1.6.9 &gt;&gt;test.csv'
  def csv  = readFile 'test.csv'
  def data = new CsvParser().parse(csv)
   for( line in data ) {
      def SERVICE_NAME = "$line.NAME"
      def SRC_VERSION = "$line.VERSION"
      def HELM_REPO_BRANCH = get_job_parameters()
      echo "$SERVICE_NAME"
      echo "$SRC_VERSION"
      echo "$HELM_REPO_BRANCH"
    }
   } 
  
  def get_job_parameters() {  
  BRANCH= readFile 'deployment_branch.txt'    
  return BRANCH
  }
  </code></pre>