title: Run stage only if previous stage was successful in Jenkins Scripted Pipeline
body: <p>I am trying to run conditional steps in a Jenkins scripted pipeline, however I am not sure how to only run a step if a previous step was successful. For instance, in the following I only want to run the 'Push Artifacts' stage if the 'Test' stage was successful:</p>
  
  <pre><code>node ('docker2') {
  
      stage ('Build') {
          // build application
      }
  
      stage ('Test') {
          // run tests
      }
  
      stage ('Push Artifacts') { 
          if (Tests Were Successful) {  
              // push to artifactory
          }
      }
  }
  </code></pre>
  
  <p>I know that declarative pipelines allow you to use 'post' conditions, but my understanding of declarative vs. scripted pipelines in Jenkins is that scripted pipelines offer more flexibility. Is there a way to run stages based on other stages' success in a scripted pipeline? </p>