NAnt tasks failing to run with path errors

486 views
Skip to first unread message

David Keaveny

unread,
Sep 3, 2014, 9:46:12 PM9/3/14
to go...@googlegroups.com
I am trying to create my first Go jobs based on NAnt, and am experiencing the following issue.

I have two Materials defined for my pipeline, Subversion and Build. Subversion checks out the source code for my project into "src" and Build checks out the NAnt scripts and other build tools into "build". I then have a Stage which is responsible for generating the appropriate versioning information for the project, which is created by a NAnt task. The XML for the configuration is:

<materials>
 
<svn url="https://svn_repo:8084/svn/MyProject/trunk" dest="src" materialName="Subversion" />
 
<svn url="https://svn_repo:8084/svn/ContinuousIntegration" dest="build" materialName="Build" />
</materials>
<stage name="Version">
 
<jobs>
   
<job name="GenerateCommonAssemblyInfo">
     
<tasks>
       
<nant nantpath=".\build\tools\nant-0.92-bin" buildfile=".\build\scripts\GenerateGlobalAssemblyInfo.build" target="go" workingdir="src">
         
<runif status="passed" />
       
</nant>
     
</tasks>
   
</job>
 
</jobs>
</stage>

When I run the build, I get the following in the logs:

[go] Start to build MyFirstPipeline/9.1.0.7871/Version/1/GenerateCommonAssemblyInfo on gocd [C:\Program Files (x86)\Go Agent] at Thu Sep 04 11:29:09 EST 2014
[go] Current job status: passed.
[go] Start to execute task: <nant nantpath=".\build\tools\nant-0.92-bin" buildfile=".\build\scripts\GenerateGlobalAssemblyInfo.build" target="go" workingdir="src" />. 
[go] setting environment variable 'GO_ENVIRONMENT_NAME' to value 'Development'
[go] setting environment variable 'GO_SERVER_URL' to value 'https://gocd:8154/go/'
[go] setting environment variable 'GO_TRIGGER_USER' to value 'changes'
[go] setting environment variable 'GO_PIPELINE_NAME' to value 'MyFirstPipeline'
[go] setting environment variable 'GO_PIPELINE_LABEL' to value '9.1.0.7871'
[go] setting environment variable 'GO_STAGE_NAME' to value 'Version'
[go] setting environment variable 'GO_STAGE_COUNTER' to value '1'
[go] setting environment variable 'GO_JOB_NAME' to value 'GenerateCommonAssemblyInfo'
The system cannot find the path specified.
[go] Start to create properties MyFirstPipeline/9.1.0.7871/Version/1/GenerateCommonAssemblyInfo on gocd [C:\Program Files (x86)\Go Agent] at Thu Sep 04 11:29:09 EST 2014
[go] Start to upload MyFirstPipeline/9.1.0.7871/Version/1/GenerateCommonAssemblyInfo on gocd [C:\Program Files (x86)\Go Agent] at Thu Sep 04 11:29:09 EST 2014
[go] Job completed MyFirstPipeline/9.1.0.7871/Version/1/GenerateCommonAssemblyInfo on gocd [C:\Program Files (x86)\Go Agent] at Thu Sep 04 11:29:09 EST 2014

I've checked the build agent's pipelines folder, and the material is being checked out into the correct folders, I've tried removing the .\ from the nantpath and buildfile properties, but I still get "The system cannot find the path specified". Without entering absolute paths, how can I get things working again?

Jyoti Singh

unread,
Sep 4, 2014, 3:41:26 AM9/4/14
to go...@googlegroups.com
In the task definition, nantpath is defined as '.\build\tools\nant-0.92-bin' which seems correct based on your description. However, the working directory for this task is set to 'src' which I believe is incorrect. Here, Go could not find build\tool\nant inside the 'src' folder and hence throws the path not found error.

David Keaveny

unread,
Sep 4, 2014, 7:11:03 AM9/4/14
to go...@googlegroups.com
Looking at the go-agent.log file, I see the following entries:

2014-09-04 20:46:29,488 [loopThread] INFO  thoughtworks.go.work.DefaultGoPublisher:95 - Agent [gocd, 10.0.30.5, 16be7273-6f05-4cd7-adfe-5090da118c81] is reporting status [Preparing] to Go Server for Build [Development/4/Version/1/GenerateCommonAssemblyInfo/35]
2014-09-04 20:46:45,673 [loopThread] INFO  thoughtworks.go.work.DefaultGoPublisher:95 - Agent [gocd, 10.0.30.5, 16be7273-6f05-4cd7-adfe-5090da118c81] is reporting status [Building] to Go Server for Build [Development/4/Version/1/GenerateCommonAssemblyInfo/35]
2014-09-04 20:46:45,687 [loopThread] INFO  go.util.command.CommandLine:455 - Running command: cmd /c .\build\tools\nant-0.92-bin\nant -buildfile:./build/scripts/GenerateGlobalAssemblyInfo.build go
2014-09-04 20:46:45,687 [loopThread] INFO  go.util.command.CommandLine:62 - [go] setting environment variable 'GO_ENVIRONMENT_NAME' to value 'Development'
2014-09-04 20:46:45,688 [loopThread] INFO  go.util.command.CommandLine:62 - [go] setting environment variable 'GO_SERVER_URL' to value 'https://gocd:8154/go/'
2014-09-04 20:46:45,688 [loopThread] INFO  go.util.command.CommandLine:62 - [go] setting environment variable 'GO_TRIGGER_USER' to value 'changes'
2014-09-04 20:46:45,689 [loopThread] INFO  go.util.command.CommandLine:62 - [go] setting environment variable 'GO_PIPELINE_NAME' to value 'Development'
** snipping a whole load of environment variables **
2014-09-04 20:46:45,731 [Thread-298] WARN  go.util.command.CommandLine:62 - The system cannot find the path specified.
2014-09-04 20:46:45,833 [loopThread] WARN  go.domain.builder.BaseCommandBuilder:103 - return code is 1
2014-09-04 20:46:45,833 [loopThread] INFO  thoughtworks.go.work.DefaultGoPublisher:101 - Agent [gocd, 10.0.30.5, 16be7273-6f05-4cd7-adfe-5090da118c81] is reporting build result [Failed] to Go Server for Build [Development/4/Version/1/GenerateCommonAssemblyInfo/35]
2014-09-04 20:46:45,850 [loopThread] INFO  thoughtworks.go.work.DefaultGoPublisher:95 - Agent [gocd, 10.0.30.5, 16be7273-6f05-4cd7-adfe-5090da118c81] is reporting status [Completing] to Go Server for Build [Development/4/Version/1/GenerateCommonAssemblyInfo/35]
2014-09-04 20:46:45,859 [loopThread] INFO  thoughtworks.go.work.DefaultGoPublisher:107 - Agent [gocd, 10.0.30.5, 16be7273-6f05-4cd7-adfe-5090da118c81] is reporting build result [Failed] to Go Server for Build [Development/4/Version/1/GenerateCommonAssemblyInfo/35]
2014-09-04 20:46:45,963 [loopThread] INFO  thoughtworks.go.work.DefaultGoPublisher:90 - Stopping Transmission for Build [Development/4/Version/1/GenerateCommonAssemblyInfo/35]

If I open a command prompt, switch to the Go agent pipeline directory, and paste in the command that it is trying to execute (cmd /c .\build\tools\nant-0.92-bin\nant -buildfile:./build/scripts/GenerateGlobalAssemblyInfo.build go), then the task runs just fine.

Aravind SV

unread,
Sep 4, 2014, 9:40:31 AM9/4/14
to David Keaveny, go...@googlegroups.com
I think, as Jyoti said, the issue might be that you have set workingdir="src". This means that you probably have a setup like this:

C:
  -> GoAgent
     -> pipelines
        -> yourpipeline
           -> src
              -> some
                 -> source
                    -> files
           -> build
              -> tools
                 -> nant-0.92-bin

Given that kind of a setup, and given that workingdir is set to src, it looks like Go is doing the equivalent of the commands shown below. This will fail since it cannot find the "build" directory inside "src".

cd C:/GoAgent/pipelines/yourpipeline/src

cmd /c .\build\tools\nant-0.92-bin\nant -buildfile:./build/scripts/GenerateGlobalAssemblyInfo.build go



Possible solutions:

1. Can you try removing the workingdir part? Like this:
<nant nantpath=".\build\tools\nant-0.92-bin" buildfile=".\build\scripts\GenerateGlobalAssemblyInfo.build" target="go">

Then, Go should then do the equivalent of:

cd C:/GoAgent/pipelines/yourpipeline

cmd /c .\build\tools\nant-0.92-bin\nant -buildfile:./build/scripts/GenerateGlobalAssemblyInfo.build go


Assuming the directories are setup as shown above, this should work.




2. Otherwise, you can try this:
<nant nantpath="..\build\tools\nant-0.92-bin" buildfile="..\build\scripts\GenerateGlobalAssemblyInfo.build" target="go" workingdir="src">

I haven't tried this, but it should work too.

Cheers,
Aravind



--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rustin Daniels

unread,
Sep 4, 2014, 12:18:10 PM9/4/14
to go...@googlegroups.com, davidk...@gmail.com
I would agree.

Remove the workingdir, also try the updated path below.

<nant nantpath="build\tools\nant-0.92-bin" buildfile="Build\scripts\GenerateGlobalAssemblyInfo.build" target="go" />

David Keaveny

unread,
Sep 4, 2014, 7:18:46 PM9/4/14
to go...@googlegroups.com
That did the trick - thanks all!
Reply all
Reply to author
Forward
0 new messages