Using PSExec from within CruiseControl .NET - cruisecontrol.net

I'm trying to call a PSExec task from CC.NET and running into some difficulties.
Here's the CC project
<project name="Test">
<tasks>
<exec>
<executable>C:\Utilities\psexec.exe</executable>
<buildArgs>-u [UNAME] -p [PWD] "C:\Utilities\Joel.bat"</buildArgs>
</exec>
</tasks>
</project>
Here's the source of Joel.bat
CLS
#ECHO OFF
What happens is that the first time I force the project to build, it runs successfully. The PSExec task is kicked off and the Joel.bat file is executed. I get some information in the build log about exit codes, but the task is successful.
Here's the build log output.
PsExec v1.97 - Execute processes remotely
Copyright (C) 2001-2009 Mark Russinovich
Sysinternals - www.sysinternals.com
C:\Utilities\Joel.bat exited with error code 0.
The second time I force the build I get the dreaded "The Application failed to initialize properly (0xc0000142)" error message. I can't ever run the build more than once
More so, if I try to shut down the cruise control .net service from within the services MSC, it can't. It's like there's a lock somewhere that is taken and not released. The only way I can kill the service is by killing the ccservices.exe process.
I've tried the exact same thing using an nant task and gotten the exact same results. It works the first time, and fails the second and I can't shutdown the process.
I'm not sure if this is an issue with CC.NET or with PSEXEC (or me of course).
Anybody got any ideas? I'm posting to the CC.NET forums as well.
I'm using the latest and greatest of PSExec and 1.4.4 of CC.NET.
Thx, Joel

Run CruiseControl service under administrator account

Have you tried any other psexec options?
-d Don't wait for application to terminate. Only use this option for non-interactive applications.

maybe its the old eula problem, try the /accepteula option for psexec

Related

How do you schedule a task using schtasks.exe through an installer without receiving an "Access Denied" message?

I am creating an installer for a Windows application that will be run daily at midnight. I am attempting to schedule the task by running the following command after all files have been installed:
schtasks.exe /create /tn "My Task Name" /xml "path/to/file.xml"
However, no task was created when I ran the installer. I opened command prompt and tried typing in the command manually to see what went wrong, and the only output I received was ERROR: Access is denied. I followed the suggestions of others and added the /ru switch, but even after entering the correct password, I still received the access denied error message. I found this answer, which involved modifying the registry using a program called SubInACL, which might work, but would probably be a bad idea, since this would have to be installed and run on all end users' machines just so that the task can be scheduled in the first place. Is there any other way to schedule a task through the command line, or will I have to use something other than Task Scheduler?
Okay, the problem was that running schtasks.exe from the [Run] section caused it not to be elevated to the Administrator level. I used the Exec() function in the [Code] section, and that made it run with Administrator privileges, which solved the problem.

Remote development - Edit on Windows & Build on Linux

I am looking for a solution for a remote development environment as follows:
Editor - Windows Source Insight / Visual Studio
Source control - Clearcase
Build server - Linux
The above can't be modified.
In my current setup, I can view and edit the sources on Windows using a Windows Cleacase client.
My problem is mainly the build (and the later on, the debug) process.
I need to invoke 'make' from Windows on a specific Clearcase view on the Linux Server.
I can login in a separate process using SSH to the Linux server and run 'make', but it is a cumbersome procedure.
I am also unable to view the 'make' results and double-lick them to go to the specific warning/errors.
Is there any way to remotely bind a Windows command/batch to a Linux environment?
Perhaps through SSH?
Thank you for any suggestion you might have.
The usual solution is rather a pull strategy (where your build server fetches information on Linux, rather than trying to pilot everything from Windows.
If you follow the SSH path, be aware of technote swg21351507:
Linux SSH connection hangs when attempting to exit after starting ClearCase.
This can affect the use of scripts to start/stop ClearCase remotely using SSH.
Cause
This is a due to a OpenSSH server design, which will not close the console until all process/jobs executed by the user are completed.
Refer to this SSH FAQ for further details, regarding background jobs.
Resolving the problem
Redirect the ClearCase start script to either /dev/null or to a log file.
Example:
/usr/atria/etc/clearcase start < /dev/null >& /dev/null
/usr/atria/etc/clearcase start < /tmp/ccstart >& /tmp/ccstart
Try sshfs. I don't if there is a sshfs client for windows. If not, you can try NFS, or even SAMBA. Those definately work in Windows and Linux.
I just came across this and wanted to answer, even if the original poster has surely resolved their issue. This could be quite easily resolved by installing a jenkins instance on the build machine. You could kick off the build from the web interface and have it pull the files from clearcase and tell you the results.

Get CruiseControl descriptive errors

My cruisecontrol runs two nant scripts and it builds by using msbuild. Msbuild is failing without giving any errors. Is there any way to get more error details? Below is how I have configured publishers.
<publishers>
<email from="cruise#xx..com.au" mailhost="stat-server" includeDetails="TRUE">
<users>
....
</users>
I can view the CruiseControl.net Build log through the web application "View Build Log" link. It gives all the details of the build process.
I normally start of running the build scripts from the command line on your build server.
You can also run MSBuild with a verbosity switch, that increase the amount of debug information. That will at least give you a idea of where the problem lies, perhaps your cruise control server is fine.
msbuild.exe <buildFile.msbuild> /v:d

VsPerfMon.exe and VsTestHost.exe Processes Hang when Run by MSTest from CruiseControl.NET

I'm using CruiseControl.NET with MSTest to build my vs2008 project and run my unit tests.
If I run the tests from Visual Studio 2008, they work perfectly. However, when the tests are started by CruiseControl, the VsPerfMon.exe and VsTestHost.exe processes hang until i end them from the taskmanager. This means that cruisecontrol itself hangs also and i never get a result for my build in cruisecontrol.
Does anybody have any idea what might be the solution to my problem?
Thanks,
D
This sounds like they may be waiting for user input? - You could try running the msbuild task (or NAnt if thats what you use) on the server yourself to check
Also check what user account the CruiseControl.Net service is running as and maybe switch it to your user account and see if that changes it - that way you would know if its related to account permissions etc
check this http://social.msdn.microsoft.com/Forums/pl-PL/tfsbuild/thread/af706a24-d47a-4a90-b3e6-beb5691f3aa0
have not tested yet...
Possible solution would be to add a AfterCompile target to kill the VSPerfCmd before the tests run.
<Target Name="AfterCompile">
<Message Text ="Shutdown the vsperfmon" />
<Exec Command='"C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Performance Tools\VSPerfCmd.exe" /shutdown' ContinueOnError="true" />
</Target>

CruiseControl.Net and NAnt Build Problem

I'm configuring a CruiseControl.net server for the first time. My team already uses NAnt build scripts, so we are just pointing the server at the scripts and letting NAnt do all the work.
As you can see, it's pretty simple:
<project name="ChannelIP">
<tasks>
<nant>
<executable>C:\Program Files\nant-0.86-beta1\bin\nant.exe</executable>
<baseDirectory>D:\mypath</baseDirectory>
<buildFile>D:\mypath\myNAnt.build</buildFile>
<targetList>
<target>build</target>
</targetList>
</nant>
</tasks>
</project>
The problem is that when I run it under CC, I get the following error:
Function call failed.
Expression:
${framework::get-framework-directory('net-3.5')}/msbuild.exe
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Microsoft .NET Framework 3.5 (net-3.5)
is not installed, or not correctly
configured. Object reference not set
to an instance of an object.
I do, in fact, use the ${framework::get-framework-directory('net-3.5')} variable to get the path to msbuild.exe; however, this code has never failed before. I can even RDP into the server using the user account that CC is running under and run the NAnt build file directly and it works just fine.
Why is it that this otherwise fine file fails just when CC runs it.
NOTE
-CC is running on the same machine that I normally run the build scripts from
The CC service is probably not running under an account with appropriate permissions. Have you tried running CC using the command line (which will run as the logged on user) to see if you have the same problem?
This sounds like a NAnt problem, there were some issues with it and .NET 3.5. Which version of NAnt are you using?
Also, have you seen Using 0.86 beta 1 for .NET 3.5? The guy has the same error message thrown by NAnt. The suggested solution was to use the latest nightly build.

Resources