Buildbot和多个SVN分支

时间:2012-06-11 03:38:50

标签: python svn buildbot

我的SVN存储库布局......

Project_Name(root)/trunk
            /branches/
            /branches/new_feature_of_trunk1
            /branches/new_feature_of_trunk2
            /tags/
            /tags/ETC1
            /tags/ETC2

我试图让buildbot构建我的存储库的几个分支,例如... / trunk和/ branches / new_feature_of_trunk1。这就是我编码的方式

from buildbot.changes.svnpoller import SVNPoller, split_file_branches
source_code_svn_url='http://domain.com/svn/Project_Name/'
c['change_source'].append(
    SVNPoller(
        svnurl=source_code_svn_url,
        split_file=split_file_branches,
        pollinterval=60,
        histmax=10,
    )
)

def modified_files(change):
    for name in change.files:
        if name.endswith(".c"):
            return True
        elif name.endswith(".h"):
            return True
    return False

from buildbot import scheduler
from buildbot.changes.filter import ChangeFilter
s1=scheduler.AnyBranchScheduler(
    name="Project_Test",
    treeStableTimer=2*60,
    change_filter=ChangeFilter(
        branch=[
            'trunk',
            'branches/new_feature_of_trunk1'
        ]
    ),
    builderNames=[
        "Windows-x64-VS10",
    ],
    fileIsImportant=modified_files
)

c['schedulers']=[s1]

from buildbot.process import factory
from buildbot.steps import source,shell
from buildbot.process.properties import WithProperties
from buildbot.config import BuilderConfig
step_source_svn=source.SVN(
    mode='copy',
    baseURL=source_code_svn_url,
    defaultBranch='trunk',
    retry=(30,2)
)

f2=factory.BuildFactory()
f2.addStep(step_source_svn)
f2.addStep(
    shell.Compile(
        command=[
            "devenv.com",
            "MakeMe.sln",
            "/build",
            "Release^|Win32"
        ],
        logEnviron=False
    )
)

问题是这个..我知道我添加了defaultBranch ='trunk'。但为什么它只检查干线 不是全根?然后每当我删除它defaultBranch。我收到了这个错误

  

exceptions.RuntimeError:属于构建器的SVN源步骤   'Windows-x64-VS10'不知道使用哪个分支。这意味着   更改源没有指定分支和defaultBranch   是没有。

然后我发布的代码是我的buildmaster告诉slave如果在/ trunk或/ branches / new_feature_of_trunk1中有modified_files,如果在同一个SVN Revision中的两个分支中都有修改,则告诉slave。然后它将在/ branches / new_feature_of_trunk1 ...

之前编译/ trunk

但正如我所说 它不像我想要的那样工作

2 个答案:

答案 0 :(得分:0)

如果单个更改集包含两个分支中的更改,则应创建两个更改,并为每个更改触发一个更改。

答案 1 :(得分:0)

旧帖我知道,但对于其他任何人来说,这可能会有所帮助:

您需要为分支机构创建调度程序。现在看起来你只有一个分支机构,但是如果你有一个通过分支的调度程序,那么你可能会更好。

Nightly(name="new1",          builderNames=["Project_Test"], branch="branches/new_feature_of_trunk1", onlyIfChanged=True, hour=range(0, 24, 2)),
Nightly(name="new2",          builderNames=["Project_Test"], branch="branches/new_feature_of_trunk2", onlyIfChanged=True, hour=range(0, 24, 2)),

如果您希望一次性检查所有内容并且您的编译步骤构成了所有分支,那么您的source_code_svn_url需要更高一个分支