Weird error

127 views
Skip to first unread message

Alex Vanden Abeele

unread,
Sep 5, 2012, 2:55:06 AM9/5/12
to ccnet...@googlegroups.com
Hello,

I'm running the latest ccnet server version, 1.8.0.0, on a win2008 R2 server (64bit). When running a powershell task I get the exception at the bottom of this message. The execution policy is set to unrestricted (to be sure), both for the 32bit and the 64bit version of powershell.

For some reason the task appends folders that indeed do not exist to my script paths.

The node in my project is the following:

<powershell>
                <description>Updating version number of the host</description>
                <script>build/tool/msvs/versionupdater.ps1</script>
                <buildArgs>/modules/host/</buildArgs>
            </powershell>


Anybody any idea what I can do? I never had this before and I've used this script often on several ccnet servers.

<exception><![CDATA[ThoughtWorks.CruiseControl.Core.Tasks.BuilderException: Unable to execute: FileName: [C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe] -- Arguments: [-nologo -NoProfile -NonInteractive -file "C:\Users\Administrator\Documents\WindowsPowerShell\build/tool/msvs/versionupdater.ps1" /modules/host/] -- WorkingDirectory: [C:\Users\Administrator\Documents\WindowsPowerShell\] -- StandardInputContent: [] -- Timeout: [600000]
System.IO.DirectoryNotFoundException: Directory does not exist: C:\Users\Administrator\Documents\WindowsPowerShell\
   at ThoughtWorks.CruiseControl.Core.Util.ProcessInfo.CreateProcess()
   at ThoughtWorks.CruiseControl.Core.Util.ProcessExecutor.RunnableProcess..ctor(ProcessInfo processInfo, String projectName, String publicArgs)
   at ThoughtWorks.CruiseControl.Core.Util.ProcessExecutor.Execute(ProcessInfo processInfo)
   at ThoughtWorks.CruiseControl.Core.Tasks.PowerShellTask.AttemptToExecute(ProcessInfo info) ---> System.IO.DirectoryNotFoundException: Directory does not exist: C:\Users\Administrator\Documents\WindowsPowerShell\
   at ThoughtWorks.CruiseControl.Core.Util.ProcessInfo.CreateProcess()
   at ThoughtWorks.CruiseControl.Core.Util.ProcessExecutor.RunnableProcess..ctor(ProcessInfo processInfo, String projectName, String publicArgs)
   at ThoughtWorks.CruiseControl.Core.Util.ProcessExecutor.Execute(ProcessInfo processInfo)
   at ThoughtWorks.CruiseControl.Core.Tasks.PowerShellTask.AttemptToExecute(ProcessInfo info)
   --- End of inner exception stack trace ---
   at ThoughtWorks.CruiseControl.Core.Tasks.PowerShellTask.AttemptToExecute(ProcessInfo info)
   at ThoughtWorks.CruiseControl.Core.Tasks.PowerShellTask.Execute(IIntegrationResult result)
   at ThoughtWorks.CruiseControl.Core.Tasks.TaskBase.Run(IIntegrationResult result)
   at ThoughtWorks.CruiseControl.Core.Project.RunTask(ITask task, IIntegrationResult result, Boolean isPublisher)
   at ThoughtWorks.CruiseControl.Core.Project.RunTasks(IIntegrationResult result, IList tasksToRun, Dictionary`2 parameterValues)
   at ThoughtWorks.CruiseControl.Core.Project.Run(IIntegrationResult result)
   at ThoughtWorks.CruiseControl.Core.IntegrationRunner.Build(IIntegrationResult result)
   at ThoughtWorks.CruiseControl.Core.IntegrationRunner.Integrate(IntegrationRequest request) BaseDirectory: C:\Users\Administrator\Documents\WindowsPowerShell\, PowerShell: powershell.exe]]></exception>



Alex Vanden Abeele

unread,
Sep 5, 2012, 3:37:48 AM9/5/12
to ccnet...@googlegroups.com
I just noticed there was an update that fixes a powershell issue, so I installed the 1.8.1, Still the same problem. I can specify the scripts directory, but I used to get another error if I did that. Now I get this:

<buildresults>
  <message level="Error">The term 'modules\host\' is not recognized as the name of a cmdlet, function, s</message>
  <message level="Error">cript file, or operable program. Check the spelling of the name, or if a path w</message>
  <message level="Error">as included, verify that the path is correct and try again.</message>
  <message level="Error">At line:1 char:14</message>
  <message level="Error">+ modules\host\ <<<<  -file build\tool\msvs\versionupdater.ps1</message>
  <message level="Error">    + CategoryInfo          : ObjectNotFound: (modules\host\:String) [], Comma </message>
  <message level="Error">   ndNotFoundException</message>
  <message level="Error">    + FullyQualifiedErrorId : CommandNotFoundException</message>
  <message level="Error"> </message>
</buildresults>

Which is totally different than what I got from the 1.8.0 version, so indeed a change has been made.

But seeing this I decided to look into the code of the powershell task, and behold: the line

if (!string.IsNullOrEmpty(BuildArgs)) builder.AppendArgument(BuildArgs);

apparently is put BEFORE the -file argument, so off course this cannot work.

Can this be fixed that it is back after the -file and script parameters, as it was in the 1.6 source? Thanks!


Ruben Willems

unread,
Sep 5, 2012, 4:39:40 AM9/5/12
to ccnet...@googlegroups.com
Hi

found the bug and fixed it

will release a new version this evening
sorry for the trouble

with kind regards
Ruben Willems

Alex Vanden Abeele

unread,
Sep 5, 2012, 5:23:04 AM9/5/12
to ccnet...@googlegroups.com
Hi Ruben,

I got it working here, and I wanted to share my findings. I replaced the buildargs line as I mentioned in the previous post in the 1.8.1 source and compiled that. The arguments are now passed correctly.

However, I still got the directory not found exception, and when looking into the code I came to the conclusion that the working directory is set to the default scriptsDirectory. That's weird because I did set the scripts directory, but to a relative path, relative to the project working directory. I also have this in the 1.6 version.

The only solution is to include a drive letter in the scriptsDirectory and only then the correct working directory is set. This is a solution for both the 1.6 and 1.8 versions.

Thanks for your effort,
Alex

Ruben Willems

unread,
Sep 5, 2012, 5:36:23 AM9/5/12
to ccnet...@googlegroups.com
Hi

I'll see if I can get the relative part working also,
if not, we're stuck for the moment with fixed paths



with kind regards
Ruben Willems


Reply all
Reply to author
Forward
0 new messages