title: Jenkins Pipeline and stash Pull Request Builder not working on PR create/update
body: <p>Below is the requirement needed to achieve using the Jenkins Pipeline and i am new bee into Jenkins Pipeline. </p>
  
  <ul>
  <li><p>After completing development work and pushing his changes to
  Bitbucket the user creates a pull request.    </p></li>
  <li><p>In order to approve a pull request we require at least one successful
  Jenkins build. Thereby we would like to get only the build result of
  the code checked in for the pull request.</p></li>
  <li><p>When a pull request is created/updated Jenkins shall be triggered
  automatically for real continuous integration.</p></li>
  <li><p>The build result shall be reported back to Bitbucket.</p></li>
  </ul>
  
  <p><strong>Used Stash Pull Request Builder and stash Notifier for the above process which is working for Normal Freestyle Project.</strong></p>
  
  <p>We need to migrate the similar functionality using Jenkins pipeline, So have created the jenkins job as below.
  <a href="https://i.stack.imgur.com/eC6Np.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eC6Np.jpg" alt="enter image description here"></a>
  The pipeline script to checks out the PR branch and trigger build is as below</p>
  
  <pre><code>node {
      stage('Checkout') {         
          checkout(
          [
              $class: 'GitSCM',
              extensions: [               
                  [$class: 'CleanCheckout'],              
              ],
              branches: [
                  [name: '']
              ], 
              userRemoteConfigs: 
              [[
                  credentialsId: 'id', 
                  url: 'repourl.git'
                  refspec: ('+refs/pull-requests/*/from:refs/remotes/origin/pr/*/from'), 
                  branch: ('origin/pr/${pullRequestId}/from')
  
              ]]
          ])
      }
  
      stage('Build') {    
          sh 'make'
      }
      stage('notify') {
        step([$class: 'StashNotifier'])
          try {
          // Do stuff
          currentBuild.result = 'SUCCESS'     
      } catch(err) {
          currentBuild.result = 'FAILED'
      }
     step([$class: 'StashNotifier'])
   }
  }
  </code></pre>
  
  <p>Though i have done the above configuration when i create/update the PR, the build is not automatically triggered in jenkins. I guess the notification from stash to jenkins did not happen because we specify <code>"origin/${pullRequestId}/from"</code> in free style project. But i do not have that option to specify in pipeline job.</p>
  
  <p>Tried few alternatives as below.</p>
  
  <p>Instead of stash Pull Request Builder i tried with just "Poll SCM" project and specified cron job to trigger as <code>"H/2 * * * *</code>". Upon commits the job is triggered at jenkins. It means that for every commit the jenkins job gets triggered. But <strong>Jenkins should trigger the job when PR is created/updated</strong>.</p>
  
  <p>Also based on below <a href="https://stackoverflow.com/questions/42513365/jenkins-pipeline-svn-polling">question</a>,  one answer says "In freestyle job add a trigger to start your pipeline job as build step" which i did not found.</p>
  
  <p>I am missing something here certainly which could be basic and new to jenkins pipeline. </p>
  
  <p>Any hint on achieving the desired behavior?</p>