如何添加更多数据以存储在Jenkins Rest API中 [英] How to add more data to be stored in jenkins rest api

查看:73
本文介绍了如何添加更多数据以存储在Jenkins Rest API中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为使问题变得简单,我知道可以通过 https://jenkins_server/获得一些构建信息. ///api/json | xml | python.而且我获得了有关该构建记录的很多信息.

To make the question simple, I know that I can get some build information with https://jenkins_server/...///api/json|xml|python. And I get a lot of information for that build record.

但是,我想向该构建记录添加更多信息.例如,创建的Docker映像,或将票证或文件从上次构建更改为创建发行说明,等等.

However, I want to add more information to that build record. For example, the docker image created, or the tickets or files changed from last build to create release note, ... etc. How do I do that?

就目前而言,我使用脚本创建了一个作为工件的json文件,并调用该json文件来获取这些信息,但是如果可以直接向jenkins构建对象中添加更多数据,这似乎是重复的.

For now, I use a script to create a json file as an artifact and call that json file to get these information, but it seems a duplicate if I can add more data to the jenkins build object directly.

推荐答案

Jenkins远程访问API旨在提供对通用Jenkins- 内部信息的访问,例如内部编号,时间戳,指纹等.

The Jenkins remote access API is designed to provide access to generic Jenkins-internal information, like build numbers, timestamps, fingerprints etc.

如果要在此添加自己的数据,则必须相应地扩展Jenkins,例如,通过设计一个插件来宣传您的(自定义)信息项作为标准Jenkins-内部"数据.如果要这样做,您可能想看看它们处理指纹信息的方式(我发现这很有启发性).

If you want to add your own data there, then you must extend Jenkins accordingly, e.g., by designing a plugin that advertises your (custom) information items as standard Jenkins-"internal" data. If you want to do that, you may want to have a look at they way fingerprint information is handled (I found that quite instructive).

但是,我建议您坚持使用当前的方法,并将通用Jenkins内部信息与Job特定数据分开.这样做省力省力,并且可以将您自己的数据与Jenkins的数据清楚地分开.

However, I'd recommend that you stick with your current approach, and keep generic Jenkins-internal information separated from Job-specific data. It is less effort and clearly separates your own data from Jenkins' data.

这篇关于如何添加更多数据以存储在Jenkins Rest API中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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