title: Jenkins Pipeline build step - getBuildVariables() returns empty map
body: <p>I have the following code in a test Jenkinsfile:</p>
  
  <pre><code>node {
      stage 'Build'
      def job1 = build 'Sample_Freestyle'
  
      def dur = job1.getDuration()
      println dur
  
      def vars = job1.getBuildVariables()
      println vars
  
      def myMap = [k1:'v1', k2:'v2', k3:'v3']
      println myMap
  }
  </code></pre>
  
  <p>As I understand it, when I use the build step a RunWrapper object is returned. I am trying to get the build variables of my test job named "Sample_Freestyle", which at them moment runs a simple Windows batch command:</p>
  
  <pre><code>echo "Hello World"
  </code></pre>
  
  <p>Whenever I run this, it executes correctly, however I'm left with an empty map. I tested the getDuration() method and that returns as expected. I took a look at the RunWrapper class <a href="https://github.com/jenkinsci/workflow-support-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.java" rel="noreferrer">here</a> and it may be that env is null (circa line 212), but that's only a hypothesis.</p>
  
  <p>Does anyone know why I would be getting an empty map when calling getBuildVariables()? Am I going about this in the wrong way?</p>