Reputation: 309
I have created a pipeline where for build there is one job and for mail notification another job. I need to get the build job latest BUILD_NUMBER(either success or failure whatever) in mail notification job and i should publish the build job latest url as a mail notification regarding the buildstatus. How could i achieve this?
Upvotes: 1
Views: 4724
Reputation: 61
I think there are multiple ways that you could achieve this. Let's call your 2 builds A (build) and B (mail notification).
For #2, I'm thinking you would have something like this in your B job:
def jobname = "<name of Job A>"
def job = Jenkins.instance.getItemByFullName(jobname)
def build = job.getLastBuild()
Upvotes: 3