CruiseControl.Net with git construct does not work when service starts

We recently switched to git for our versioning needs. We have used cruisecontrol.net for some time. I created new tasks in the cc.net configuration file and installed using the git source control block. I made sure that I can use git via ssh via the command line. Cruisecontrol.net works fine for me when I launch it from the console.

However, as soon as I start cruisecontrol.net as a service, the time for git fetch (or cloning) expires. I tried to create a task to start the cc.exe process at computer startup, but the results are the same as the results of the service. I set the environment variables in the cc.net documentation to use git and I installed ssh and saved the host, etc. For bitbucket. The service runs as the same user that I run in the console.

Any ideas on how to get git as a service?

Script build example

<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> 

CC.Net Magazine on failed assembly

 <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

+4
source share
3 answers

When I tested this, it happened because git is asking for input on the console. CCNet usually works with higher privileges (than a regular user in login mode), so try running git Bash as an administrator, run git clone ... and make sure there are no prompts on the console that you should bypass. Also, double-check that you are really working as a user of the service; all SSH keys and known hosts are saved for each user.

+3
source

I had a similar problem using Cruise Control, but for me I ran a batch file to execute all my git statements that were disabled, but only when starting from Cruise Control. Logging in as a user and executing a batch file manually without problems. In my batch file, a script was being built that included steps to run some git bash shell scripts to execute my git commands.

For example, my build process would fulfill this statement:

 "c:\program files\git\git.exe" --login -i "myshellscript.sh" 

Then, the shell script will execute some logic to clear the directories, check the specified branch or hash key, click notes, etc. This will freeze after the first fetch, and this is because the $ HOME directory in git bash was different between when CC starts as a service and from the moment I test using Remote Desktop. To confirm, I added an expression to "myshellscript.sh"

 echo $HOME 

This returned a different path than when I logged in as a desktop user, so it did not detect my ssh key files, which caused any git fetch to hang waiting for a user response. I found this guide to configure portable git, and it includes steps for automatically specifying your own home profile. To do this, find where git was installed, and edit the etc \ profile file. Change the lines:

 # normalize HOME to unix path HOME="$(cd "$HOME" ; pwd)" 

To:

 # normalize HOME to unix path HOME="/c/Build Server/MyProfile" HOME="$(cd "$HOME" ; pwd)" 
+1
source

Well, with Bradley's help, I realized that my service is running in a different profile, despite the fact that the username is the same. Running git bash as an administrator (but still the same user) showed me that my ~ / folder is in windows \ system32 \ systemprofile. I just copied the .ssh profile folder that I created earlier in this folder now works fine.

0
source

Source: https://habr.com/ru/post/1393378/


All Articles