在Jenkins API中,有没有一种方法可以找到上一个版本的git commit? [英] In the Jenkins API is there a way to find the git commit of the last build?
本文介绍了在Jenkins API中,有没有一种方法可以找到上一个版本的git commit?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想编写一个脚本来自动为修补程序创建功能分支.为此,我需要弄清楚如何查看当前构建中的最后一次提交.
I would like to write a script to automate the feature branch creation for hot-fixes. In order to do that I need to figure out how to see what was the last commit in the current build.
是否可以从Jenkins API获取最后的提交?
Is there a way to get the last commit from the Jenkins API?
git checkout -b hotfix <commit>
推荐答案
您没有指定要使用的API. 但是假设使用Jenkins XML API,它将是这样的:
You did not specify which API would you prefer to use. But assuming Jenkins XML API it would be something like:
http://myjenkins/job/myJobName/lastBuild/api/xml?xpath=//lastBuiltRevision/SHA1
这篇关于在Jenkins API中,有没有一种方法可以找到上一个版本的git commit?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文