We recently switched to git for our source control needs. We have been using cruisecontrol.net for some time. I’ve created new tasks within the cc.net config file and set the up with a git source control block. I’ve made sure I can use git over ssh via the command line. I have cruisecontrol.net working fine when I run it from the console.
However as soon as I run cruisecontrol.net as a service the git fetch (or clone) times out. I tried creating a task to run the cc.exe process on computer startup but the results are the same as running as a service. I’ve set the environment variables in the cc.net documentation for using git and I’ve setup ssh and saved the host etc for bitbucket. The service is running as the same user I’m running in the console.
Any ideas how to get git running as a service?
Example Build Script
<project name="******* Develop" queue="Q1" queuePriority="1">
<webURL>http://cc.*******two.co.uk/server/local/project/*******Develop/ViewLatestBuildReport.aspx</webURL>
<workingDirectory>D:\Integration\********* Develop\WorkingDirectory</workingDirectory>
<artifactDirectory>D:\Integration\********* Develop\Artifacts</artifactDirectory>
<modificationDelaySeconds>10</modificationDelaySeconds>
<triggers>
<intervalTrigger seconds="600" name="continuous" />
</triggers>
<sourcecontrol type="git">
<repository>git@bitbucket.org:*******/*******-2.git</repository>
<branch>develop</branch>
<autoGetSource>true</autoGetSource>
<executable>C:\Program Files\Git\cmd\git.cmd</executable>
<tagOnSuccess>false</tagOnSuccess>
<commitBuildModifications>false</commitBuildModifications>
<commitUntrackedFiles>false</commitUntrackedFiles>
<committerName>*******BuildServer</committerName>
<committerEMail>devserver@*******.co.uk</committerEMail>
<workingDirectory>D:\Integration\*******Develop\WorkingDirectory</workingDirectory>
<timeout>300000</timeout>
</sourcecontrol>
<tasks>
<exec>
<executable>e2prebuild.bat</executable>
<baseDirectory>D:\Integration\*******Develop\Scripts</baseDirectory>
<buildTimeoutSeconds>30</buildTimeoutSeconds>
</exec>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
<workingDirectory>D:\Integration\*******Develop\WorkingDirectory</workingDirectory>
<projectFile>*********.sln</projectFile>
<buildArgs>/p:Configuration=Release /v:diag</buildArgs>
<targets>Build</targets>
<timeout>900</timeout>
<logger>D:\CruiseControl\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>
<exec>
<executable>e2deploy.bat</executable>
<baseDirectory>D:\Integration\*******Develop\Scripts</baseDirectory>
<buildTimeoutSeconds>900</buildTimeoutSeconds>
</exec>
<exec>
<executable>ecrondeploy.bat</executable>
<baseDirectory>D:\Integration\*******Develop\Scripts</baseDirectory>
<buildTimeoutSeconds>900</buildTimeoutSeconds>
</exec>
</tasks>
</project>
Log From CC.Net on failed build
<cruisecontrol project="********* Develop">
<request source="*********DEV" buildCondition="ForceBuild">Build (ForceBuild) triggered from *********DEV</request>
<parameters>
<parameter name="$CCNetArtifactDirectory" value="D:\Integration\********* Develop\Artifacts" />
<parameter name="$CCNetBuildCondition" value="ForceBuild" />
<parameter name="$CCNetBuildDate" value="2012-01-26" />
<parameter name="$CCNetBuildTime" value="15:10:27" />
<parameter name="$CCNetFailureUsers" value="System.Collections.ArrayList" />
<parameter name="$CCNetIntegrationStatus" value="Unknown" />
<parameter name="$CCNetLabel" value="3" />
<parameter name="$CCNetLastIntegrationStatus" value="Success" />
<parameter name="$CCNetListenerFile" value="D:\Integration\********* Develop\Artifacts\********* Develop_ListenFile.xml" />
<parameter name="$CCNetModifyingUsers" value="System.Collections.ArrayList" />
<parameter name="$CCNetNumericLabel" value="3" />
<parameter name="$CCNetProject" value="********* Develop" />
<parameter name="$CCNetProjectUrl" value="http://cc.*********.co.uk/server/local/project/*********Develop/ViewLatestBuildReport.aspx" />
<parameter name="$CCNetRequestSource" value="*********DEV" />
<parameter name="$CCNetUser" value="" />
<parameter name="$CCNetWorkingDirectory" value="D:\Integration\********* Develop\WorkingDirectory" />
</parameters>
<modifications />
<integrationProperties>
<CCNetArtifactDirectory>D:\Integration\********* Develop\Artifacts</CCNetArtifactDirectory>
<CCNetBuildCondition>ForceBuild</CCNetBuildCondition>
<CCNetBuildDate>2012-01-26</CCNetBuildDate>
<CCNetBuildTime>15:10:27</CCNetBuildTime>
<CCNetFailureUsers />
<CCNetIntegrationStatus>Exception</CCNetIntegrationStatus>
<CCNetLabel>3</CCNetLabel>
<CCNetLastIntegrationStatus>Success</CCNetLastIntegrationStatus>
<CCNetListenerFile>D:\Integration\********* Develop\Artifacts\********* Develop_ListenFile.xml</CCNetListenerFile>
<CCNetModifyingUsers />
<CCNetNumericLabel>3</CCNetNumericLabel>
<CCNetProject>********* Develop</CCNetProject>
<CCNetProjectUrl>http://cc.*********.co.uk/server/local/project/*********Develop/ViewLatestBuildReport.aspx</CCNetProjectUrl>
<CCNetRequestSource>*********DEV</CCNetRequestSource>
<CCNetWorkingDirectory>D:\Integration\********* Develop\WorkingDirectory</CCNetWorkingDirectory>
<LastIntegrationStatus>Success</LastIntegrationStatus>
<LastSuccessfulIntegrationLabel>3</LastSuccessfulIntegrationLabel>
<LastModificationDate>25/01/2012 15:15:29</LastModificationDate>
</integrationProperties>
<build date="2012-01-26 15:10:27" buildtime="00:05:01" buildcondition="ForceBuild" />
<exception><![CDATA[ThoughtWorks.CruiseControl.Core.CruiseControlException: Source control operation has timed out.
at ThoughtWorks.CruiseControl.Core.Sourcecontrol.ProcessSourceControl.Execute(ProcessInfo processInfo)
at ThoughtWorks.CruiseControl.Core.Sourcecontrol.Git.GitFetch(IIntegrationResult result)
at ThoughtWorks.CruiseControl.Core.Sourcecontrol.Git.CreateUpateLocalRepository(IIntegrationResult result)
at ThoughtWorks.CruiseControl.Core.Sourcecontrol.Git.GetModifications(IIntegrationResult from, IIntegrationResult to)
at ThoughtWorks.CruiseControl.Core.Sourcecontrol.QuietPeriod.GetModifications(ISourceControl sourceControl, IIntegrationResult lastBuild, IIntegrationResult thisBuild)
at ThoughtWorks.CruiseControl.Core.IntegrationRunner.GetModifications(IIntegrationResult from, IIntegrationResult to)
at ThoughtWorks.CruiseControl.Core.IntegrationRunner.Integrate(IntegrationRequest request)]]></exception>
</cruisecontrol>
CruiseControl.net Version: 1.5.7256.1
When I’ve experienced this, it has been because git is prompting for input at the console. The CCNet service usually runs with higher privileges (than a regular logged-on user), so try running Git Bash as administrator, execute
git clone ..., and make sure there are no prompts you have to bypass at the console. Also, double-check that you’re really running as the service user; all the SSH keys and known hosts are saved per-user.