根据jenkins,我怎样才能访问最新的内置版本? [英] How can I access the last built revision according to jenkins?
问题描述
我不认为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屋!