title: Jenkinsfile variable used in two separate stages
body: <p>I have a pipeline job that uses two separate nodes (one for build, one for test), and I'd like to share a variable between two of these blocks of code in my <code>Jenkinsfile</code>. I assume it's possible, but I'm very new to groovy and the <code>Jenkinsfile</code> concept. Here is the relevant code so far:</p>
  
  <pre class="lang-groovy prettyprint-override"><code>node('build') {
      stage('Checkout') {
          checkout scm
      }
      stage('Build') {
          bat(script: 'build')
          def rev = readFile('result')
      }
  }
  
  node('test') {
      stage('Test') {
              def SDK_VERSION = "5.0.0001.${rev}"
              bat "test.cmd ${env.BUILD_URL} ${SDK_VERSION}"
              archiveArtifacts artifacts: 'artifacts/**/*.xml'
              junit 'artifacts/**/*.xml'
         }
  }
  </code></pre>
  
  <p>I want to assign the "rev" variable in the build stage, but then concatenate it to the SDK_VERSION variable in the Test stage. My error is: </p>
  
  <pre><code>groovy.lang.MissingPropertyException: No such property: rev for class: groovy.lang.Binding
  </code></pre>