title: Dynamically defining parallel steps in declarative jenkins pipeline
body: <p>I try to parallelize dynamically defined set of functions as follows: </p>
  
  <pre><code>def somefunc() {
      echo 'echo1'
  }
  
  def somefunc2() {
      echo 'echo2'
  }
  
  running_set = [
      { somefunc() },
      { somefunc2() }
  ]
  
  pipeline {
      agent none
      stages{
          stage('Run') {
              steps {
                  parallel(running_set)                
              }
  
          }
      }
  }
  </code></pre>
  
  <p>And what I end up with is:</p>
  
  <pre><code>org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
  WorkflowScript: 17: No "steps" or "parallel" to execute within stage "Run" @ line 17, column 9.
             stage('Run') {
  </code></pre>
  
  <p>Although steps are defined within stage 'Run'. Anyway what I would like to achieve running is a dynamically defined set of functions to execute in parallel. </p>