title: Jenkins Pipeline string and for-loop
body: <p>I'm creating a jenkins pipeline which has a string as a variable of 1 or more items</p>
  
  <blockquote>
    <p>text="test1.var1.eu-20190414121923517200000001
    test2.var2.ue1-20190414121925623400000002
    test3.var3.ue1-20190414121926583500000003"</p>
  </blockquote>
  
  <p>I basically want to go in a loop and for each item run an action. for example echo each one in turn. The echo would look at the string and return each item in a for loop where there are 1 or more results</p>
  
  <p>expected result:</p>
  
  <blockquote>
    <p>test1.var1.eu-20190414121923517200000001</p>
    
    <p>test2.var2.ue1-20190414121925623400000002</p>
    
    <p>test3.var3.ue1-20190414121926583500000003</p>
  </blockquote>
  
  <p>I've tried a few things including adding a sh to run a for loop</p>
  
  <pre><code>#!/usr/local/bin/groovy
  
  pipeline {
    parameters {
      choice(choices: "1\n2\n3", description: 'The length of time for the environment to remain up', name: 'hours')
    }
  
    stages {
      stage('get and update hours') {
        steps {
          script {
            env.text="test1.var1.eu-20190414121923517200000001 test2.var2.ue1-20190414121925623400000002 test3.var3.ue1-20190414121926583500000003"
            sh "echo ${text}"
            sh "for value in ${text}; do echo $value; done"
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>expected result</p>
  
  <blockquote>
    <p>test1.var1.eu-20190414121923517200000001</p>
    
    <p>test2.var2.ue1-20190414121925623400000002</p>
    
    <p>test3.var3.ue1-20190414121926583500000003</p>
  </blockquote>
  
  <p>actual result:</p>
  
  <blockquote>
    <p>[Pipeline] End of Pipeline
    [Office365connector] No webhooks to notify
    groovy.lang.MissingPropertyException: No such property: value for class: > groovy.lang.Binding
      at groovy.lang.Binding.getVariable(Binding.java:63)
      at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:264)
      at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:288)
      at  org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:292)
        at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:268)</p>
  </blockquote>