Jenkins插件Gerrit Trigger配置,实现代码review后提交时(change-merged)自动触发Jenkins工程build和部署。
安装Jenkins插件
Gerrit Trigger
配置Gerrit Trigger
Manage Jenkins >> Gerrit Trigger
添加新的Gerrit服务器,如下图
Gerrit服务器相关配置,如下图
配置完成后,点击 [Test Connection] 按钮,测试连接是否正常,如果正常就可以去创建Jenkins工程了。
创建Jenkins工程
可以增加多个Gerrit Project.
注意:
-
如果是具体的Gerrit Project和branch,Type 选择 Plain,Pattern填写具体的Gerrit Project和branch,区分大小写; -
如果Gerrit Project和branch需要模糊匹配,Type 应选择 Path,**表示任意字符串。
触发build的条件解释: Which type of Gerrit events should trigger the build. Patch set created : Trigger when a new change or patch set is uploaded (default) Draft published : Trigger when a draft change or patch set is published (default, if available in Gerrit version) Change abandoned : Trigger when a change is abandoned Change merged : Trigger when a change is merged/submitted Change restored : Trigger when a change is restored Comment added : Trigger when a review comment is left with the indicated vote category and value Reference updated : Trigger when a reference (e.g., branch or tag) is updated * * * 此时,配置的代码库只要有代码提交,Jenkins就会触发build,我们可以配置让其Jenkins工程每当代码提交时,自动更新本地代码,然后自动构建以及部署。
|