Jenkins Workflow Build Information

旧街凉风 提交于 2019-12-18 14:52:11

问题


How do you access current, and related, build information from within a Jenkins workflow groovy script?

I can see things like currentBuild.result and currentBuild.previousBuild being documented, but I can't see how I can access, for example:

  • The URL of the current build job.
  • The URL of build jobs that this workflow triggered.
  • The console output of a particular failed build job, etc.

Thanks for any pointers.


回答1:


currentBuild.rawBuild will give you the non cached hudson.model.Run object, see hudson.model.Run

from there, to access i.e. the build log:

def buildLog = currentBuild.rawBuild.log

currentBuild.rawBuild is also of type hudson.model.AbstractBuild which can give you other details like changeset, actions



来源:https://stackoverflow.com/questions/33531868/jenkins-workflow-build-information

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!