Visual Studio task fails when running Bamboo as a Windows service
症状
All builds work fine when running the Bamboo server from the command line. However, some builds fail when Bamboo is started as a Windows Service. For example, a Visual Studio task shows this errors:
simple 24-Oct-2012 14:08:20 Starting task 'Buid using Visual Studio 2010' of type 'com.atlassian.bamboo.plugin.dotnet:devenv'
command 24-Oct-2012 14:08:20 Beginning to execute external process for build 'Plan Name - Default Job'\n ... running command line: \nC:\bamboo-home\DotNetSupport\devenvrunner.bat\n C:\bamboo-home\xml-data\build-dir\Proj1-Plan1-JOB1\n C:\Program Files (x86)\Microsoft Visual Studio 10.0\n x86\n test.sln\n /build\n Release\n ... in: C:\bamboo-home\xml-data\build-dir\Proj1-Plan1-JOB1\n
error 24-Oct-2012 14:08:20 'findstr' is not recognized as an internal or external command,
error 24-Oct-2012 14:08:20 operable program or batch file.
error 24-Oct-2012 14:08:20 The process tried to write to a non
The error message might be different for other failing tasks.
原因
This is generally caused by account permissions of the user who runs the Bamboo service. By default, Bamboo uses a SYSTEM user, and this might cause some issues.
ソリューション
Make sure to use a local admin user to run the Bamboo server as per Running Bamboo as a Windows service as the local user article.
After setting up, if you still see errors, please check the User PATH variable. There is a great chance you have a PATH (user environment variables) overwriting PATH (system environment variables). Remove the contents of the User PATH and, if needed, append to the System PATH (using %USERPROFILE%).