使用CruiseControl将头部SVN文件夹复制到Release文件夹

Jos*_*ton 3 .net svn cruisecontrol.net nant

我刚刚开始使用CruiseControl.NET和nAnt,并且对整个过程的工作原理并不十分了解.我们目前在Visual Source"Safe"中拥有大部分解决方案,并使用AssemblyInfo文件自动为每个版本生成构建服务器标签.

我们正在将我们的VSS项目迁移到SVN,并相应地修改了项目构建文件以检出并更新SVN存储库.我们想要实现的是在源代码控制中获得源代码的副本,该副本与正在部署的项目的版本完全匹配.

我们的SVN设置如下:

svn://solution/  
    TRUNK/
    RELEASES/
         1.0.0/
         1.2.0/
    BRANCHES/
Run Code Online (Sandbox Code Playgroud)

因此,当我们强制构建我们的解决方案时,其assemblyinfo版本设置为1.3.0,我们希望构建服务器将TRUNK目录复制到RELEASES/1.3.0 /目录中.

SVN命令相当简单.svn copy src/directory dst/directory.但是我会在哪里放置此命令,以及如何获取目标的版本号?

在构建服务器上,这是.xml文件的示例:

    <sourcecontrol type="svn">
    <trunkUrl>svn://project/trunk</trunkUrl>
            <workingDirectory>D:\Builds\project\Src</workingDirectory>
            <executable>C:\Subversion\bin\svn.exe</executable>
    <username>sf_service_dev</username>
    <password>SFx4vi-r</password>
            <tagOnSuccess>true</tagOnSuccess>
    <cleanCopy>true</cleanCopy>
</sourcecontrol>
Run Code Online (Sandbox Code Playgroud)

在项目.build文件中我们有这个(当然还有很多):

<target name="Deploy_Release">
     <property name="fileandpathformyfile" value="${CCNetWorkingDirectory}\Bin\project.exe"/>
  <echo message="fileandpathformyfile is ${fileandpathformyfile}."/>
  <property name="ReleaseNumber" value="${fileversioninfo::get-file-version(fileversioninfo::get-version-info(fileandpathformyfile))}"/>
  <echo message="ReleaseNumber has been detected to be ${ReleaseNumber}."/>

  <!--Use version as needed-->

  <!--Create the release direcory-->
  <mkdir dir="${CCNetWorkingDirectory}\..\Releases\${ReleaseNumber}"/>
  <!--Copy stuff to the release directory-->
  <copy todir="${CCNetWorkingDirectory}\..\Releases\${ReleaseNumber}">
    <fileset basedir="${CCNetWorkingDirectory}\bin">
      <include name="*.dll" />
      <include name="*.exe" />
      <include name="*.config" />
      <include name="*.xml" />
      <include name="*.stp" />
    </fileset>
  </copy>
</target>
Run Code Online (Sandbox Code Playgroud)

现在,如果我想运行一个SVN命令将$ {trunkURL}复制到$ {trunkURL} /../ releases/$ {ReleaseNumber},我该怎么办呢?它会在什么文件中运行?我现在的理解是,我们需要从.build文件中获取ReleaseNumber,进入.xml文件,然后从那里运行.或者,我们需要将.URML中的trunkURL传递给.build,并从.build文件运行svn命令.

请帮忙!

Ryu*_*Ryu 5

一种选择是在每次成功构建时标记(也称为svn副本).实际上有内置的功能.

我看到你<tagOnSuccess>启用了真实

你还应该设置<tagBaseUrl>svn://project/trunk/Releases</tagBaseUrl><tagBaseUrl>svn://project/trunk/Tags</tagBaseUrl>

您可能遇到的问题是每次成功构建,无论是强制还是连续都会标记.我猜你不想复制发布每个版本.

你能做的是

  1. 使用nAnt exec任务执行批处理文件
  2. %CCNetRequestSource%为ForceBuild 编写if语句检查环境变量
  3. 执行命令行svn操作(CCNetWorkingDirectory将作为环境变量使用,您可能必须传入release#作为参数)

也可以结帐nantcontrib,似乎有svn任务

编辑

您可能希望通过贴标机查看CC.Net管理您的版本#并通过CCNetLabel环境变量将其传递给nAnt .根据我的阅读,你很可能想要文件标签,因为其他人自动为你生成标签,我个人使用迭代贴标机.

使用CC.Net贴标机进行版本控制的优点是构建电子邮件将显示正确的发行版本,我相信<tagOnSuccess>使用目录名称的标签.