如何从jenkins gerrit触发器发布自定义标签上的投票? [英] How to post votes on custom labels from jenkins gerrit trigger?

查看:650
本文介绍了如何从jenkins gerrit触发器发布自定义标签上的投票?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jenkins gerrit-trigger插件.它确实触发了工作.问题在于,工作完成后,詹金斯无法发送评论,因为我在gerrit中没有已验证"标签.

I'm using jenkins gerrit-trigger plugin. It does trigger the job. The problem is that after job is finished jenkins cannot send review becasue I have no 'verified' label in gerrit.

我发现在配置中有 Gerrit报告值部分(Jenkins->管理器-> Gerrit触发器->单击您的Gerrit编辑"按钮). 在该部分中,验证"和代码审查"都有硬编码的小节.另一小节是"Gerrit验证命令",其中包含以下命令:

I found that in configuration there is Gerrit Reporting Values section (Jenkins -> Manager -> Gerrit Trigger -> Click on your gerrit "edit" button). In that section there are hardcoded subsections for "Verify" and "Code Review". Another subsection is "Gerrit Verified Commands" with commands like:

gerrit review <CHANGE>,<PATCHSET> --message 'Build Successful <BUILDS_STATS>'  --verified <VERIFIED> --code-review <CODE_REVIEW>

如何在此处添加自定义标签?

我试图将命令更改为类似的内容:

I've tried to change commands to something like:

gerrit review <CHANGE>,<PATCHSET> --message 'Build Successful <BUILDS_STATS>'  --acceptance-tests $ACCEPTANCE_TESTS_VOTE --code-quality $CODE_QUALITY_VOTE

来自文档:

变量和具有上面定义的值.该变量将具有生成结果的URL.

The variables and will have the values defined above. The variable will have the URL to the build result.

您还可以使用以$ ENV_VAR语法开头的版本中的任何环境变量.

You can also use any environment variable from the build that was started with the $ENV_VAR syntax.

如何添加新的参数"或如何传递环境变量?

我尝试使用EnvInject插件,但是似乎环境变量中未填充值(jenkins的错误消息说没有$ VAR参数).

I've tried to use EnvInject plugin, but it seems the environment variable is not filled with value (the error message from jenkins says that there is no $VAR parameter).

推荐答案

我将gerrit触发器配置的高级部分中的命令更改为例如,在自定义标签上发布+ 1/-1.

I'm posting +1/-1 on a custom label by changing the commands in the advanced section of the gerrit trigger configuration to e.g.

gerrit review <CHANGE>,<PATCHSET> --message 'Build Successful <BUILDS_STATS>' --label 'MyCustomVerifiedLabel=<VERIFIED>' --code-review <CODE_REVIEW>

这篇关于如何从jenkins gerrit触发器发布自定义标签上的投票?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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