Set a stage status in Jenkins Pipelines : <p>Is there any way in a scripted pipeline to mark a stage as unstable but only show that stage as unstable without marking every stage as unstable in the output?</p>

<p>I can do something like this:</p>

<pre><code>node()
{
  stage("Stage1")
  {
      // do work (passes)
  }
  stage("Stage2")
  {
      // something went wrong, but it isn't catastrophic...
      currentBuild.result = 'UNSTABLE'
  }
  stage("Stage3")
  {
      // keep going... 
  }
}
</code></pre>

<p>But when I run this, Jenkins marks everything as unstable... but I'd like the first and last stages to show green if possible and just the stage that had an issue to go yellow.</p>

<p>It's ok if the whole pipeline gets flagged unstable, but it might also be nice to have a later stage over ride that and set the final-result to pass if possible too.</p>
