I have done this using the following code, but was told that this may not
work in future versions:

@NonCPS
def getLastJobInfo(build) {
  def res = null
  try {
    if(build.previousBuild != null) {
      def resp = httpRequest(quiet: true, url: "${env.BUILD_URL}/${
build.previousBuild.id}/wfapi/describe")
      res = readJSON(text: resp.content)
    }
  } catch(e) {
    res = null
  }
  return res
}


On Tue, Mar 26, 2019 at 7:13 PM Adam Bowen <[email protected]> wrote:

> Is there a way to get the status of a stage for a previous build inside of
> a Jenkinsfile (i.e. Groovy). My situation is that I have a lengthy
> multistage pipeline. A lot of the stages have conditionals that cause the
> stage only to run if  a file has been changed since the last successful
> build. Sometimes that stage may be successful in the last build, but
> perhaps the overall build failed due to another stage. I want to be able to
> query what stages were successful in a failed build. I can;t seem to find
> any syntax that supports that,
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/cc3333c0-ebe1-4f38-afb4-227dd06814de%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/cc3333c0-ebe1-4f38-afb4-227dd06814de%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Website: http://earl-of-code.com

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVeg9ndYiaF8kPpjvSmV%3DNm%2BdwOOHoVYczZYnmtDuj%2Bq9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to