title: Prepending build steps to a jenkins dsl job
body: <p>I'd like to use a function to apply changes to a number of job definitions (so that common parameters, credentials and build steps can be added consistently to a number of jobs). While most of the configuration I want to add doesn't depend on ordering, the build step I'm trying to add has to run first so must be prepended to any existing build steps.</p>
  <p>I tried doing:</p>
  <pre><code>def j = job('ci') {
    steps {
      shell 'main\n'
    }
  }
  j.with {
    steps {
      stepNodes.add(0, new NodeBuilder().'hudson.tasks.Shell' {
        delegate.command(&quot;prepend\n&quot;)
      })
    }
  }
  </code></pre>
  <p>using the job dsl playground, <a href="http://job-dsl.herokuapp.com/" rel="nofollow noreferrer">http://job-dsl.herokuapp.com/</a>, but counter-intuitively (to me anyway) this results in the &quot;prepend&quot; step being appended. That is, it results in:</p>
  <pre><code>&lt;project&gt;
    &lt;actions&gt;&lt;/actions&gt;
    &lt;description&gt;&lt;/description&gt;
    &lt;builders&gt;
      &lt;hudson.tasks.Shell&gt;
        &lt;command&gt;main
  &lt;/command&gt;
      &lt;/hudson.tasks.Shell&gt;
      &lt;hudson.tasks.Shell&gt;
        &lt;command&gt;prepend
  &lt;/command&gt;
      &lt;/hudson.tasks.Shell&gt;
    &lt;/builders&gt;
  &lt;/project&gt;
  </code></pre>
  <p>Does anyone know how I can prepend a step to an existing job definition in this way?</p>
  <p>Thanks for any insights.</p>