found this and it seems to work https://support.cloudbees.com/hc/en-us/articles/226419147-How-can-I-check-previous-build-status-in-a-Pipeline-Script-
-- 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/40bd3710-a4c0-4754-bbaa-324d5c7de5df%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
