CruiseControl.NET中的多个项目在同一队列中同时运行

时间:2011-02-07 15:40:39

标签: queue cruisecontrol.net cctray

我在CruiseControl.NET(版本1.4.4)中有多个项目,我已将其分配给单个队列......

   <project name="Build - A" queue="Q1">
   ...
   </project>
   <project name="Build - B" queue="Q1">
   ...
   </project>
   <project name="Build - C" queue="Q1">
   ...
   </project>
   <project name="Build - D" queue="Q1">
   ...
   </project>

所有项目都是非触发项目 - 我(与该部门的其他所有开发人员一起)使用CCTray手动启动每个项目。问题是:如果在项目A运行时,另一个用户使用Force Build启动另一个项目,它将与项目A同时运行。即使它们位于同一队列中。我原以为同一队列中的请求会是......我不知道,排队等待,也不会同时执行。我正在使用“UseFirst”的默认队列实现。

任何想法如何使队列中的项目表现得更像队列?我想将这些项目添加到一个定时调度程序中,但是没有任何信心,项目不会全部尝试同时运行并杀死我可怜的动力不足的构建机器,我不敢尝试。

2 个答案:

答案 0 :(得分:4)

奇。我使用您提到的相同配置并将强制构建请求排队。 尝试更新ccnet版本。

以下是(部分)我的ccnet配置样式(使用preprocessor):

<cruisecontrol
    xmlns:cb="urn:ccnet.config.builder" xmlns="http://thoughtworks.org/ccnet/1/5">

  <!-- Queue to make sure one build at a time - to avoid same folder SVN locking issues-->
  <queue name="Q_Synchronizer" duplicates="UseFirst" />

  <!-- ************ Common defs (CC.net pre-processor tags)*********-->
  <cb:define local_svn_root="C:\svn"/>
  <cb:define remote_svn_root="http://SVN_SERVER:8888/svn/"/>
  <cb:define svn_exe="C:\Program Files\Subversion\bin\svn.exe"/>
  <cb:define svn_user="SVNUSER" svn_pw="PPPPPWWWW"/>
  <cb:define server_url="http://CCNET_SERVER/ccnet"/>
  <cb:define build_timeout="900"/>

  <cb:define name="msbuild_task">
    <msbuild>
      <executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
      <workingDirectory>$(local_svn_root)$(project_solution_path)</workingDirectory>
      <projectFile>$(project_solution_file)</projectFile>
      <buildArgs>/p:Configuration=$(project_solution_configuration) /p:VCBuildAdditionalOptions="/useenv" /v:diag /t:rebuild</buildArgs>
      <timeout>$(build_timeout)</timeout>
    </msbuild>
  </cb:define>

  <cb:define name="svn_dependency">
    <svn>
      <executable>$(svn_exe)</executable>
      <workingDirectory>$(local_svn_root)$(internal_svn_path)</workingDirectory>
      <trunkUrl>$(remote_svn_root)$(internal_svn_path)</trunkUrl>
      <username>$(svn_user)</username>
      <password>$(svn_pw)</password>
      <timeout units="minutes">30</timeout>
    </svn>

  </cb:define>

   <cb:define name="project_template" >
    <project name="$(project_name)" queue="Q_Synchronizer" queuePriority="$(queuePriority)">
      <workingDirectory>$(local_svn_root)$(project_solution_path)</workingDirectory>
      <webURL>$(server_url)/server/local/project/$(project_name)/ViewLatestBuildReport.aspx</webURL>
      <triggers>
        <intervalTrigger seconds="30" name="continuous" buildCondition="IfModificationExists"/>
      </triggers>
      <sourcecontrol type="multi">
        <sourceControls>
          <cb:svn_dependency internal_svn_path="$(project_internal_svn_path)"/>

          <cb:additional_svn_dependencies/>

        </sourceControls>
      </sourcecontrol>
      <tasks>
        <cb:msbuild_tasks/>
      </tasks>
      <publishers>
        <xmllogger logDir="$(local_svn_root)$(project_solution_path)\BuildLogs" />        
      </publishers>
    </project>
  </cb:define>

   <!-- ************* Projects definition ************-->
  <cb:project_template
     project_name="Proj A"
     project_internal_svn_path="/code/"
     project_solution_path="/code/Proj A"
     project_solution_file="Proj A.sln"
     queuePriority="1"
     >
    <cb:define name="msbuild_tasks">
      <cb:msbuild_task project_solution_configuration="Debug"/>
      <cb:msbuild_task project_solution_configuration="Release"/>
    </cb:define>
    <cb:define name="additional_svn_dependencies">
      <cb:svn_dependency internal_svn_path="/bin"/>
    </cb:define>

  </cb:project_template>

  <cb:project_template
     project_name="Proj B"
     project_internal_svn_path="/code/"
     project_solution_path="/code/Proj B"
     project_solution_file="Proj B.sln"
     queuePriority="1"
     >
    <cb:define name="msbuild_tasks">
      <cb:msbuild_task project_solution_configuration="Debug"/>
      <cb:msbuild_task project_solution_configuration="Release"/>
    </cb:define>
    <cb:define name="additional_svn_dependencies">
      <cb:svn_dependency internal_svn_path="/third-party"/>
    </cb:define>
  </cb:project_template>


</cruisecontrol>

答案 1 :(得分:0)

您可以尝试在自己的队列中定义每个项目,并将所有其他队列添加到lockqueues参数中(参见Queue Configuration的最后一个示例)