如何从 bash 和 php 脚本更新 Bugzilla 错误?
我们的开发过程通过大量 bash 和 php 脚本(包括 subversion hook 脚本)实现高度自动化。这些脚本执行许多操作来与我们的 Bugzilla 3.0 安装集成。
但当前的集成方法是一堆 SQL 调用,它们直接更新 bugzilla 数据库 - 这显然有很多缺点 - 包括让我对升级到 3.2 感到紧张,以防数据库模式发生变化!
例如,要向错误添加注释,我正在向 longdescs 表中执行 INSERT。
所以我(有点啰嗦)的问题是:
- 我应该使用 Bugzilla WebServices(如果是的话,除了 Bugzilla API 文档之外是否还有其他好的文档无法让我快速上手),
- 或者我应该使用一些其他的 Bugzilla API(直接 perl 调用?) - 再说一遍,这方面有什么像样的 doco 吗?
- 或者,我应该继续做我正在做的事情(直接 SQL 调用),因为数据库不会改变那么多并且它“完成工作”
Our development process is highly automated via a raft of bash and php scripts (including subversion hook scripts.) These scripts do a number of things to integrate with our Bugzilla 3.0 installation.
But the current integration approach is a bunch of SQL calls which update the bugzilla database directly - which obviously has a number of downsides - including making me nervous about upgrading to 3.2 in case the database schema has changed!
For example, to add a comment to a bug, I'm doing an INSERT into the longdescs table.
So my (slightly long-winded) question is:
- should I be using Bugzilla WebServices (and if so, is there any good documentation other than the Bugzilla API docs which aren't getting me up to speed quickly)
- or, should I be using some other Bugzilla API (direct perl calls?) - and, again, is there any decent doco on this?
- or, should I just keep doing what I'm doing (direct SQL calls) because the db doesn't change that much and it "does the job"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据 Bugzilla WebServices API,一些所需的功能(例如更改错误状态)尚不可用,因此目前,直接 SQL 调用似乎是最合适的选择。
数据库模式在版本 3.0 和 3.2 之间没有发生显着变化,因此这是一种实用的前进方式。
According to the Bugzilla WebServices API, some of the features needed (e.g. changing a bug status) are not yet available, so for the time being, direct SQL calls seem the most appropriate option.
The database schema has not changed significantly between version 3.0 and 3.2 so this is a practical way forward.
仅供参考,在 Bugzilla 3.2 发行版中,有一个
contrib/bz_webservice_demo.pl
文件,其目的是“展示如何通过 XMLRPC 与 Bugzilla 对话”。FYI, in the Bugzilla 3.2 distribution, there is a
contrib/bz_webservice_demo.pl
file whose intent is to "Show how to talk to Bugzilla via XMLRPC".当心! 一些数据库更改也意味着其他更改。 通过向 longdescs 添加一行来向错误添加注释是可行的,但您还应该更新表错误中的 delta_ts。
在 Web 服务可用之前,我将执行以下操作:使用您想要从 shell 执行的 UI 执行操作。 (假设 MySQL)使用“mysqlbinlog”查看数据库的二进制日志,您将看到 Bugzilla 在执行任何操作时通常执行哪些语句。
如果您希望下次有人进行更改时邮寄您添加的评论,请保留 bugs.last_diffed。 如果您不希望邮寄您添加的评论,请像更新 bugs.delta_ts 一样更新 bugs.last_diffed。
Bugzilla 在数据库中有许多微妙的依赖关系,您必须遵守这些依赖关系,否则您可能会得到一些意外的结果。
Be careful! Some database changes imply other changes as well. Adding a comment to a bug by adding a row to longdescs works, but you should also be updating delta_ts in table bugs.
Until web services are available, here's what I would do: perform the action using the UI that you want to do from the shell. (Assuming MySQL) Go look at the binary log for the database using 'mysqlbinlog' and you'll see what statements Bugzilla usually executes when doing whatever.
If you want the comment you added to be mailed the next time someone makes a change, leave bugs.last_diffed alone. If you don't want the comment you added to be mailed out, update bugs.last_diffed as you are doing to bugs.delta_ts.
Bugzilla has a number of subtle dependencies in the database that you must respect, or you're likely to get some unexpected results.