2017-02-15 62 views
1

任何分支我在一個項目中使用buildbot和我有一個調度器的設定,自動建立每當有變化時該項目,以測試它是否編譯罰款。這工作和buildbot檢測所有分支上的變化,但調度總是構建master分支,無論哪個分支的變化上。我希望它能夠建立改變的分支,但是我無法完成這項工作。下面是buildbot配置的相關部分:如何觸發一個構建在buildbot

GitPoller:

c['change_source'].append(GitPoller(
    repourl='[email protected]:someproject.git', 
    branches=True, 
    pollinterval=60)) 

調度:

c['schedulers'].append(AnyBranchScheduler(
    name='all', 
    treeStableTimer=2*60, 
    builderNames=['builder 1', 'builder 2'])) 

這是我用幾個建築商有檢出代碼的輔助功能。我幾乎總是調用它沒有參數。使用參數是特定分支的罕見情況,上述調度程序不會運行這樣的構建器。我認爲,當我使用沒有任何參數,我總是在else塊運行:

def CheckoutFactory(whichBranch = ''): 
    factory = BuildFactory() 
    if whichBranch: 
     factory.addStep(Git(repourl='[email protected]:someproject.git', branch=whichBranch, mode='full', method='fresh', alwaysUseLatest=True, progress=True)) 
    else: 
     factory.addStep(Git(repourl='[email protected]:someproject.git', mode='full', method='fresh', alwaysUseLatest=True, progress=True)) 
    return factory 

這裏有什麼問題?我做錯了什麼,我該如何讓buildbot運行帶有更改的分支上的構建?

配置:

  • 的buildbot主站上的Xubuntu 16.04.1 64位運行。
  • 的buildbot版本是0.8.12。 (從回購)
  • GIT中是2.7.4版本。 (從回購)

回答

0

我已經固定它。這似乎不像我想象的那樣自動。分支必須被傳遞到Git步驟,使用branch屬性的值。我這樣做是這樣的:

factory.addStep(Git(repourl='[email protected]:someproject.git', branch=WithProperties('%s', 'branch'), mode='full', method='fresh', alwaysUseLatest=True, progress=True)) 

相關的變化是,這個參數已添加:

branch=WithProperties('%s', 'branch') 

我使用的是過時WithProperties而不是Propery,因爲這將引發this problem,和我沒有」不想改變我的配置太多。