Jenkins 工作流构建信息 [英] Jenkins Workflow Build Information

查看:34
本文介绍了Jenkins 工作流构建信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从 Jenkins 工作流程常规脚本中访问当前和相关的构建信息?

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

我可以看到诸如 currentBuild.result 和 currentBuild.previousBuild 之类的内容被记录下来,但我看不到我如何访问,例如:

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

  • 当前构建作业的 URL.
  • 此工作流触发的构建作业的 URL.
  • 特定失败构建作业的控制台输出等.

感谢您的指点.

推荐答案

currentBuild.rawBuild 会给你非缓存的 hudson.model.Run 对象,见 hudson.model.Run

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 也是 hudson.model 类型.AbstractBuild 可以为您提供其他详细信息,例如 changesetactions

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

这篇关于Jenkins 工作流构建信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆