Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fork process with CC .NET

Is there any way to fork a process inside Cruise Control .NET? I want CC .NET to launch a program when everything's done but right now, CC .NET insists on waiting for the program to close before saying that the build is complete.

The program that is launched must run for up to weeks at a time.

like image 290
Zian Choy Avatar asked Dec 01 '09 02:12

Zian Choy


3 Answers

The way I would do it is to use a PowerShell or Batch script. The script can launch your process and return back normally to CC.NET after spawning the executable. This is the only way I can see doing it, as CC.NET does need to know it returned and the script can return, even with the process you spawned still out there running. A sample PowerShell script that will do what you want. Then you just call the powershell script with the path to the exe as a paratemeter.

    param(  [string] $exePath = $(throw "A path to executable required.")
    )

Invoke-Item $exePath

here on CC.NET 1.5 would be how to set up the powershell task

<powershell> 
    <script>yourScriptName.ps1</script> 
    <scriptsDirectory>D:\CruiseControl</scriptsDirectory> 
    <buildArgs>full path to exe you want to kick-off</buildArgs>     
</powershell>
like image 95
Alex Avatar answered Oct 26 '22 23:10

Alex


How about this... 2 Small programs

1) A process that runs all the time (maybe a windows service?), and listens on a tcp socket, when it gets a connection, execute your 3 week process.

2) A process that can be called by CC.NET, and opens a tcp connection to process #1, and then exits.

You could use any form of inter-process communication, but TCP sockets are easy and reliable.

like image 23
karoberts Avatar answered Oct 27 '22 00:10

karoberts


Put the launch of the program into a separate CCNET project and add a ForceBuildPublisher to the original project.

<project name="OriginalProject">
  <!-- ... -->
  <publishers>
    <!-- ... -->
    <forcebuild>
      <project>LaunchProgram</project>
   </forcebuild>
  </publishers>
</project>
like image 29
The Chairman Avatar answered Oct 27 '22 01:10

The Chairman