tags:

views:

2296

answers:

3

I have a simple NAnt build file, which attempts to perform an update from subversion on the specified directory. An example of the test build file content is:

<?xml version="1.0" ?>
<project name="Project_name" default="update">
<property name="root" value="C:\Subversion\UpdateDir" overwrite="false"/>
<property name="build.repos" value="http:/server/svnrepos" overwrite="false"/>
<property name="build.user" value="user" overwrite="false"/>
<property name="build.pwd" value="userpw" overwrite="false"/>
    <target name="update">
        <!-- Update all files to latest (head) revision from the repository -->
        <svn-update destination="${root}" uri="${build.repos}" username="${build.user}" password="${build.pwd}" commandline="-r HEAD -q --no-auth-cache"/>
    </target>
</project>

When the build is run in TeamCity (which has been configured to execute the test build file), the build fails with an error of 1 being returned from the Collabnet subversion client 'svn.exe' file.

The annoying thing, is that NAnt GUI can run the build file without error, so I don't see why TeamCity should fail, since I believe it to be using the same subversion client as NAnt GUI and the same MS .net framework version too.

The error log details are as follows, and the error relates to the NAnt Contrib task 'svn-update':

[16:01:56]: svn-update
[16:01:56]: [svn-update] svn: Working copy '.' locked
[16:01:56]: [svn-update] svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
[16:01:56]: C:\Subversion\ProjectBuilds\BuildFiles\Update0412.build(9,10): External Program Failed: C:\Program Files\CollabNet Subversion\svn.exe (return code was 1)
[16:01:56]: NAnt output: "C:\Program Files\NAnt-Gui\bin\NAnt.exe" -buildfile:C:\Subversion\ProjectBuilds\BuildFiles\Update0412.build -extension:C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NAntLoggers.dll -listener:JetBrains.BuildServer.NAntLoggers.NAntListener -D:teamcity.buildConfName=0412 -D:DotNetFramework1.1_Path=C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 -D:agent.home.dir=C:\BuildAgent "-D:agent.name=TeamCity Build Agent" -D:build.number=0.0.33 -D:teamcity.dotnet.nunitlauncher2.0=C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher2.0.exe -D:teamcity.dotnet.platform=C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.TeamCity.PlatformProcessRunner.1.1.exe -D:DotNetFramework1.1= -D:build.number.format=0.0.{0} -D:user.language=en -D:user.country=GB -D:os.version=5.1 -D:user.timezone=Europe/London -D:file.encoding=Cp1252 -D:file.separator=\ -D:agent.work.dir=C:\BuildAgent\work "-D:teamcity.projectName=Project 0412" -D:teamcity.dotnet.nunitlauncher2.0.vsts=C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher2.0.VSTS.exe -D:os.arch=x86 -D:DotNetFramework1.1_x86_Path=C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 -D:DotNetFramework1.1_x86= -D:teamcity.build.tempDir=C:\BuildAgent\temp\buildTmp -D:teamcity.dotnet.coveragelauncher=C:\BuildAgent\plugins\dotnetPlugin\bin\TeamCityRunners\JetBrains.dotTrace.TeamCity.CoverageRunner.exe -D:build.vcs.number=5758 -D:teamcity.dotnet.nunitlauncher=C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe -D:build.vcs.number.1=5758 -D:user.name=SYSTEM "-D:os.name=Windows XP" -D:build.vcs.number.0412=5758 "-D:teamcity.version=4.0 (build 8080)" -D:teamcity.dotnet.nunitaddin=C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.TeamCity.NUnitAddin-NUnit -D:teamcity.auth.password=YVscypn9BG9okr0ojOES7LgevrD8Wpfp -D:idea.build.agent.port=9092 -D:teamcity.build.checkoutDir=C:\Subversion\ProjectBuilds\0412 -D:teamcity.buildType.id=bt2 -D:teamcity.auth.userId=TeamCityBuildId=36 -D:teamcity.dotnet.nunitlauncher1.1=C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher1.1.exe -D:user.variant= -D:teamcity.agent.cpuBenchmark=107 -D:teamcity.dotnet.nunitlauncher.msbuild.task=C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MSBuildLoggers.dll -D:user.home=C:\ -D:idea.build.server.build.id=36 -D:path.separator=; -D:teamcity.build.workingDir=C:\Subversion\ProjectBuilds -D:teamcity.build.properties.file=C:\BuildAgent\temp\agentTmp\teamcity.build31597.properties update NAnt 0.85 (Build 0.85.2478.0; release; 14/10/2006) Copyright (C) 2001-2006 Gerry Shaw http://nant.sourceforge.net Buildfile: file:///C:/Subversion/ProjectBuilds/BuildFiles/Update0412.build Target framework: Microsoft .NET Framework 1.1 Target(s) specified: update update: [svn-update] svn: Working copy '.' locked [svn-update] svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) BUILD FAILED - 0 non-fatal error(s), 2 warning(s) C:\Subversion\ProjectBuilds\BuildFiles\Update0412.build(9,10): External Program Failed: C:\Program Files\CollabNet Subversion\svn.exe (return code was 1) Total time: 0.4 seconds.
[16:01:56]: Process exit code: 1

EDIT: The problem was indeed related to the SVN checkout being in a state. I fixed it by allowing TeamCity to do it's own checkout (and I probably did a clean up in the meantime as well). Looks like both James Gregory and Ruben Bartelink were correct!

+4  A: 

TeamCity has it's own checkout location in the agent that's running the build. The error message points to that working copy having gotten muddled somehow; this can sometimes happen if a build fails and it was in the middle of an update. I'd suggest trying to do a svn cleanup in the specific agent's working copy.

James Gregory
A: 

Also if you go to the project page and select "Enforce Clean Checkout" from the actions menu (or force it permanenently in the project settings), it may get you over this (i.e., force it to get a clean copy versus the normal [quicker] approach of just getting the deltas).

You could also blow away the working directory and see if that cures it.

Ruben Bartelink
+1  A: 

TeamCity supports svn checkout on agent. It is able to call svn update automatically in build checkout directory. Please select checkout on agent under build configuration settings/2.Version Control.

Please have a look to documentation page at http://www.jetbrains.net/confluence/display/TCD4/Build+Checkout+Directory

Eugene Petrenko