2016-09-26 146 views
0

我正在使用Buildbot V.0.9.0rc3如何将变量传递给Buildbot?

当我通过命令行发送更改时,或者如果我接受了一个http Post请求到正确的地址,我的Buildbot会触发。

目前我发送变化以两种不同的方式Buildbot:

$ buildbot sendchange -m localhost:9999 -a example-user:pass -W me -C default 

curl -X POST -d author=aalvz -d comments=mycomment -d project=my_project -d category=default -d repository=some http://192.168.33.20:8020/change_hook/base 

调度的定义是这样的:

c['schedulers'].append(schedulers.SingleBranchScheduler(
          name="waiter", 
          builderNames=["runtests"], 
          change_filter=util.ChangeFilter(category='default'))) 
c['www'] = dict(port=8020, 
       plugins=dict(waterfall_view={}, console_view={}), 
       change_hook_dialects={ 
             'base': True, 
             'somehook': {'option1':True, 
                'option2':False}}) 

而我的步骤工厂克隆回购看起来是这样的:

factory.addStep(steps.Git(repourl='[email protected]:AAlvz/my_repo.git', mode='full', workdir='newFolder', branch='my_branch', submodules=True, clobberOnFailure=True)) 

我想收到一些数据的POST,并使用这些数据来触发不同的命令。喜欢的东西:(使用$使变量明显)

factory.addStep(steps.Git(repourl=$myjson.name, mode='full', workdir=$myjson.path, branch=$myjson.branch, submodules=True, clobberOnFailure=True)) 

这样,我可以把一个JSON,如:

{myjson: {name: github/myrepo.git, path: /tmp/my/path, branch: my_branch}} 

,并能够克隆由JSON提供的存储库。

在此先感谢!我希望这个问题很清楚。我可以提供日志或任何所需的配置。谢谢!

回答

0

这是用Buildbot Properties解决的。

您CAND经由命令行(与PBChangeSource)使用所述标志

buildbot sendchange ... --properties=my_property:myvalue 

的标志可用于多种timpes如果需要多个属性发送它们。