title: Jenkins Using result artifacts in different steps - stash and unstash
body: <p>I have a Jenkinsfile declarative pipeline which has two steps:  </p>
  
  <ol>
  <li>build an RPM file inside a docker container</li>
  <li>build a docker image with the RPM and run it</li>
  </ol>
  
  <p>The first step is built inside a docker container because it require a specific app to build the RPM.</p>
  
  <p>The second step is run directly on a Jenkins slave, can be other slave than the slave which ran the first step.</p>
  
  <p>In order to use the RPM produced by the first step I'm currently using <code>stash</code> and <code>unstash</code> steps. If I do not use them the second step doesn't have access to the RPM file.</p>
  
  <p>The RPM file is about 215MB which is more than the 100MB recommended limit so I'll like to know if there is a better solution?</p>
  
  <pre><code>pipeline {
      agent any
  
      options {
          timestamps()
      }
  
      stages {
  
          stage('Gradle: build') {
              agent {
                  docker {
                      image 'some-internal-image'
                  }
              }
  
              steps {
                  sh """
                      chmod +x gradlew
                      ./gradlew buildRpm
                  """
              }
  
              post {
                  success {
                      stash name: 'rpm', includes: 'Server/target/myapp.rpm'
                  }
              }
          }
  
          stage('Gradle: build docker image') {
              steps {
                  unstash 'rpm'
                  sh """
                      chmod +x gradlew
                      ./gradlew buildDockerImage
                  """
              }
          }
  
      }
  }
  </code></pre>