title: Stages based on a list on Jenkinsfile
body: <p>I have something like this:</p>
  
  <pre><code>def projects = [
    "foo",
    "bar",
    "foobar",
    "etc",
  ]
  
  pipeline {
    agent any
    stages {
      stage('lint') {
        parallel {
          stage('lint: foo') {
            steps {
              sh "lint foo"
            }
          }
          stage('lint: bar') {
            steps {
              sh "lint bar"
            }
          }
          stage('lint: foobar') {
            steps {
              sh "lint foobar"
            }
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>I didn't really want to repeat myself there, is there a way I can "generate" the <code>stage</code> code for each project?</p>
  
  <p>I was able to do something similar, without the <code>parallel</code> part with this:</p>
  
  <pre><code>pipeline {
    agent any
    stages {
      stage('initialize') {
        steps {
          script {
            for (int i = 0; i &lt; projects.size(); i++) {
              stage("lint: ${projects[i]}") {
                sh "lint ${project}"
              }
            }
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>Any help appreciated.</p>