简体   繁体   中英

Jenkins Pipeline job to fetch another jenkins job build status

I have a Jenkins pipeline Job, which need to monitor the another Jenkins job (say JobA) current build and publish the status (Build Status: Success or Failure) in current pipeline stage. How to achieve that. The job(JobA) will not be triggered from the pipeline job. It will run Independently. From Pipeline job, need to fetch the status of JobA.

To get the last build result of Job A:

jenkins.model.Jenkins.instance.getItem("JobA").lastBuild.result

Unclear what exactly you mean by "monitor", but you may get build number of "lastBuild" and watch if it has changed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM