简体   繁体   English

Jenkins - 将上次构建更改保存到文本文件中

[英]Jenkins - Save last build changes to a text file

I have a Jenkins server with a job that has git SCM. 我有一个Jenkins服务器,其作业具有git SCM。 I want to be able to save the changes (comments+author) of every build to a different text file . 我希望能够将每个构建的更改(注释+作者)保存到不同的文本文件中 Please don't tell me to scrape a html file. 请不要告诉我刮一个html文件。 There must be an elegant way. 必须有一种优雅的方式。

You can use the Jenkins REST API to retrieve the list of builds for a job with details about each build. 您可以使用Jenkins REST API检索作业的构建列表,其中包含有关每个构建的详细信息。 In the example URL below, I've used the tree parameter to limit the result set , but you may want to retrieve more information about each build: 在下面的示例URL中,我使用了tree参数来限制结果集 ,但您可能想要检索有关每个构建的更多信息:

http://jenkins:8080/job/JOB_NAME/api/json?pretty=true&tree=builds[id,changeSet[items[author,msg]]]

There's some documentation of the API within Jenkins, each page has a REST API link at the bottom with generic syntax and content-specific documentation. 在Jenkins中有一些API的文档,每个页面底部都有一个REST API链接,其中包含通用语法和特定于内容的文档。

You can use your favorite scripting language to both retrieve the information from the Jenkins API and parse the JSON and create text files in whatever format you need. 您可以使用自己喜欢的脚本语言从Jenkins API检索信息并解析JSON并以您需要的任何格式创建文本文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM