繁体   English   中英

针对特定分支Jenkins的投票SCM

[英]Poll SCM for a specific branch Jenkins

我有一个有很多分支的Github项目。

Example

master
staging
feature-1
feature-2

我有一个詹金斯工作,其中的“轮询SCM”选项已启用以下cronjob(10 7,9,11,13,15,17,19 * * 1-5)

但是,对母版进行更改时也会开始这项工作。

我希望Jenkins的工作仅在提交到暂存分支时才开始。

这是轮询日志的输出

Started on Nov 20, 2018 1:10:00 PM
no polling baseline in /var/jenkins_workspace/workspace/Staging-ALL-Deploy@libs/jenkins-pipeline-global-lib on 
Using strategy: Default
[poll] Last Built Revision: Revision efccc8e212470802d64537e0a5e710f9b5c063b6 (refs/remotes/origin/staging)
 > git --version # timeout=10
 > git ls-remote -h http://git.company.com/org/repo.git # timeout=10
Found 56 remote heads on http://git.company.com/org/repo.git
[poll] Latest remote head revision on refs/heads/staging is: efccc8e212470802d64537e0a5e710f9b5c063b6 - already built by 171
Using strategy: Default
[poll] Last Built Revision: Revision efccc8e212470802d64537e0a5e710f9b5c063b6 (refs/remotes/origin/staging)
 > git --version # timeout=10
 > git ls-remote -h http://git.company.com/org/repo.git # timeout=10
Found 56 remote heads on http://git.company.com/org/repo.git
[poll] Latest remote head revision on refs/heads/master is: 865459e59ef5f91fddbd7453d9f2205560327c44
Done. Took 0.46 sec
Changes found

这可能吗?

谢谢约翰

您可以通过以下方式设置要构建的分支:

配置->源代码管理选项卡->要构建的分支->分支说明符

只需在本节中编写阶段。 然后转到“构建触发器”选项卡,为GITScm轮询选择GitHub挂钩触发器。

不要忘记将webhook <YOUR-JENKINS-URL>/github-webhook/到您的Github项目中,并选择发送推送事件作为json。

通过这种方式,您可以在每次推送到特定分支时创建构建。 有了池,它将以给定的时间间隔拉动存储库,这会增加成本。

暂无
暂无

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

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