簡體   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