简体   繁体   English

Jenkins 通过 gerrit-trigger 插件建立在标签推送上

[英]Jenkins builds on tag pushes via gerrit-trigger plugin

I have a Jenkins server running the Gerrit trigger plugin for continuous integration.我有一个 Jenkins 服务器运行 Gerrit 触发器插件以进行持续集成。 For running unit tests and style checks, it's working fantastically!对于运行单元测试和样式检查,它工作得非常好!

However, I'm interested in using Jenkins to build our deployment packages as well.但是,我也对使用 Jenkins 构建我们的部署包感兴趣。

Ideally, developers would push tags to Gerrit, and the gerrit-trigger plugin would notify Jenkins to build the tags, and deploy them appropriately.理想情况下,开发人员将标签推送到 Gerrit,并且 gerrit-trigger 插件会通知 Jenkins 构建标签,并适当地部署它们。

Is there some way to configure this through jenkins and gerrit, rather than using hooks in Gerrit's git repos to post to Jenkins's REST API, or using wasteful laggy SCM polling?有没有办法通过 jenkins 和 gerrit 来配置它,而不是使用 Gerrit 的 git repos 中的钩子发布到 Jenkins 的 REST API,或者使用浪费的滞后 SCM 轮询?

I suspect that there may be a way to do this, but I'm not quite sure where to begin.我怀疑可能有办法做到这一点,但我不太确定从哪里开始。

The Gerrit trigger plugin has several trigger options for initiating the job. Gerrit 触发器插件有几个用于启动作业的触发器选项。

In your Jenkins job, under "Gerrit Trigger" you'll find a "Trigger On" section with a drop-down list.在您的 Jenkins 工作中,在“Gerrit Trigger”下,您会找到一个带有下拉列表的“Trigger On”部分。 If you trigger on "Ref updated" it will run your job any time a developer pushes a ref directly to Gerrit without going through the review process.如果您触发“Ref 更新”,它会在开发人员将 ref 直接推送到 Gerrit 时运行您的工作,而无需经过审查过程。 This won't strictly be limited to tag events, but it will catch them.这不会严格限于标记事件,但它会捕获它们。

"Ref update" works but it also triggered by commit merged to master as well. “参考更新”有效,但它也由合并到 master 的提交触发。 If you just want to have the build been triggered by new tags.如果您只想让新标签触发构建。 Try following step:尝试以下步骤:

1, The tag should be in a form like release/xxx.xx.xx 1、标签格式为release/xxx.xx.xx

2, Git plugin Configuration: Repository URL: ssh://xxxx@mygerrit.com:29418/sweetTest.git Branches to build: master 2、Git插件配置:Repository URL:ssh://xxxx@mygerrit.com:29418/sweetTest.git 构建分支:master

3, Gerrit plugin: Select "Gerrit event" Choose "Ref updated" Fill Gerrit project Patterns: Plain : sweetTest Branches: Path : refs/tags/release/* 3、Gerrit插件:选择“Gerrit event”选择“Ref updated”填充Gerrit项目Patterns: Plain :sweetTest Branches: Path :refs/tags/release/*

4, Now push a new tag "release/tagName" to remote gerrit repo master branch will trigger the build 4、现在推送一个新标签“release/tagName”到远程gerrit repo master分支将触发构建

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM