4

我注意到,如果您将 Jenkins 与 SVN 或 CVS 选项一起使用,则会为每个构建创建一个 changelog.xml,其中包含该构建的作者和提交消息。

不幸的是,在我的设置中,我没有使用 SVN 或 CVS,所以我无法利用 changelog 解析器。我想知道是否可以使用相同的格式(如 SVN XML 更改日志)创建您自己的更改日志,然后在构建过程中将 Jenkins 指向它。这样,当有人单击构建的更改时,他们将能够看到更改的内容以及更改的人员。

我尝试创建一个 changelog.xml,然后更新 build.xml 以使用 SVN 解析器,但我注意到了两个问题:
1)您必须重新加载配置文件才能显示
2)Build.xml在作业完成之前似乎不会创建

有关更改日志解析器的一些信息,但您似乎无法在构建步骤中访问它:https ://wiki.jenkins-ci.org/display/JENKINS/Change+log

4

1 回答 1

0

Maybe a system groovy scripts would be a good direction (groovy script plugin). Just add a new script as your build step. You can access your AbstractBuild object by running the following code:

import hudson.model.*
import hudson.util.*
import hudson.scm.*

def thr = Thread.currentThread()
def build = thr?.executable

I'm trying to solve a similar problem currently, but my use case change a bit. I try to copy the changes from Upstream project in the similar way that BlameSubversion plugin does. Unfortunately I can't use the mentioned above SCM plugin because it doesn't work with post-commit-hook, so I have to write my own solution.

Take a look at copyChangeLogFromTriggerJob and copyRevisionFromTriggerJob methods to get know how BlameSubversion does that.

I'm able to copy changes and revision but I'm still fighting with ChangeLogParser. I would be gladfull for any help as well.

于 2012-12-27T10:20:05.540 回答