git - ghprb - 添加内容以构建状态消息?

标签 git jenkins

我们正在使用 ghprb在我们所有的 repo 协议(protocol)中,它很棒。不过,我希望能够将内容添加到 git 中显示的构建后信息中。我们使用 clover、findbugs 等,但大多数人都缺少这些的输出。

ghprb 可以很好地返回消息,例如

All is well — Build finished. n tests run, m skipped, k failed.

那里甚至还有一个指向 jenkins 工作的链接。

在 README 中,它暗示可以进行自定义。

You can extend the standard build comment message on github creating a comment file from shell console or any other jenkins plugin. Contents of that file will be added to the comment on GitHub. This is useful for posting some build dependent urls for users without access to the jenkins UI console.

但之后就没有更多细节了。有没有人设法添加/修改默认内容?

最佳答案

是的,您可以将任何自定义消息指定为默认内容。

有一个选项可以提及一个文件,其内容将被粘贴为作业的 pull 请求中的评论。

  <commentFilePath>/home/jenkins/<Some Directory Name>/commit.log</commentFilePath>

您可以提及 commit.log(或您命名的任何文件)中的任何内容。

要记住的 Gist -> 这个文件必须在 jenkins master 上,在 slave 上有文件会对你有所帮助。 因此,作为前/后构建步骤,您需要创建此文件并填充内容,

例如

如果你想显示 cobertura 图来 pull 请求提交,你可以添加这个。

echo "CodeCoverage Trend" > commit.log
echo "<img src="https://<Your servername>.com/job/${JOB_NAME}/cobertura/graph">" >> commit.log

关于git - ghprb - 添加内容以构建状态消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33829536/

相关文章:

android - 如何使用 Appium 在真实设备上从 jenkins 安装 *.apk 并运行用 python 编写的测试?

node.js - 在nodejs中,我可以有子文件夹,每个子文件夹都托管一个AWS lambda函数吗?

Jenkins 管道参数来保存一个数组

android - 查找 git commit 产生的一些代码

Git: merge 两个远程分支

git - 为什么 git pull --rebase 在重播现有提交时失败?

java - 在 JGit 获取异常 "org.eclipse.jgit.api.errors.InvalidConfigurationException: No value for key remote"

git - 将 git 分支转换为 git 标签

ant - 在 Jenkins 上运行时覆盖环境变量

jenkins - 我如何在 Jenkins 管道中获取对我的 SCM 对象的引用?