根据jenkins,我怎样才能访问最新的内置版本? [英] How can I access the last built revision according to jenkins?

查看:83
本文介绍了根据jenkins,我怎样才能访问最新的内置版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在构建控制台的顶部附近,我看到一个Last Built Revision:带有一个修订版#。我如何在构建脚本中访问最后一次构建的rev#?我正在使用Gradle,但我认为这不重要。詹金斯是否在系统属性中提供了最后一次生成的rev#?当然,从我的构建脚本访问这些必须是微不足道的。

解决方案

我不认为git插件导出了最后一次构建修改为一个环境变量,但通过一个简单的shell命令即可轻松获得这些信息:

  curl -sf$ BUILD_URL / api / xml?xpath = // lastBuiltRevision / SHA1 / text()

BUILD_URL总是指向构建自己的页面,其余的信息似乎可以使用xml api。


Near the top of my build console I see a "Last Built Revision:" w/ a revision #. How can I access this last built rev # in my build script? I'm using Gradle, but I don't think that matters here. Does Jenkins provide the last built rev # in a system property? Surely this must be trivial to access from my build script...

解决方案

I do not think the git plugin exports the last built revision as an environment variable, but the information is easily available using a simple shell command like:

curl -sf "$BUILD_URL/api/xml?xpath=//lastBuiltRevision/SHA1/text()"

BUILD_URL always points to the build's own page and the rest of the information seems to be available using the xml api.

这篇关于根据jenkins,我怎样才能访问最新的内置版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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