Continuous deployment and running with TeamCiy

78 views Asked by At

I have a project that is built into an executable. Some kind of server. And a Team City as CI. I configured Team City to automatically build my sources.

I would like to achive the following steps:

  1. Sources are built by Team City when someone commits into repo. (done)
  2. Built binaries are copied to some location. (On the same machine where Team City server is running)
  3. My executable is launched with some parameters.

First two steps I managed to configure with creating separate Build configuration for deployment with Artifacts dependency. But I don`t know how to start my executable. If I do it with Command Line Build step than Build Agent hangs until the application is killed. And I need the opposite - launched by Build Agent application should live for a long time while the Build Agent itself finishes right after running my exe.

Is it possible to do this or am I misusing CI?

Also I need to be able to do Redeployment:

  1. Kill previously run application (by process image f.e.)
  2. Do all steps from regular deployment.

Searching "Continuous deployment" gives results only for Web-based deployment which is not my case.

2

There are 2 answers

1
Matt On BEST ANSWER

In order to achieve what you want to, you could try using a PowerShell build step and use the following script.

Start-Process myprogram.exe

This will return an object to you, but won't block the thread and won't cause your agents to wait for the process to end.

Further documentation can be found on MSDN - Start-Process Documentation

Hope this helps

0
Krzysztof Wolny On

I'm not an expert in terms of Windows programming, but IMHO you need kind of "deployment script" that do all the job. Configuring everything on TC side can be dangerous (when TC is down your pipeline is stuck).

How about creating couple of scripts that do what you described in 2. and 3. and running them in separated build configuration with artifact dependency (as you described)? In this case TC setup is simpler, you can keep this scripts in some VCS repo and update them easily so TC will use latest version. In case TC is down you can deploy manually simply by running same script as TC does.