3

Teamcity allow to set up the behavior of build agents. But can I somehow to run some command before the teamcity begin to communicate with build agents after receiving all updates from SVN?

Andrew Lubochkn
  • 916
  • 2
  • 7
  • 16
  • If you give more detail on the specifics of what you are trying to achieve you will have a better chance of receiving an answer. – Paul Hunt Feb 02 '12 at 09:12
  • Okay, I would like to run incremental scripts to the database. There is no problem to do it: I set up my **teamcity** in the way that **build agent** receives all script files and executes them. But I would like to run *.exe file just after **teamcity** receives the last updates from **SVN**. This exe-file should create xls-file which then should be passed to **build agent** (with all scripts). So the problem is to run exe-file (which will create xls-file) because I can't split these two actions: 1) receiving the latest data from **SVN** and 2) passing data to **build agent**. – Andrew Lubochkn Feb 02 '12 at 17:50

1 Answers1

2

Unfortunately, the you can only execute commands inside builds running on an agent. There are several ways to achieve your goal.

First (simple, but 'dirty'):

  • Place your .exe file on the agent(s)
  • Insert build step with a coommand line, that will generate xls, on the first place in target build configuration.

So the resulting workflow will look like this:

  • Agent receives an updated data from SVN
  • Your tool is started and xls file is produced
  • Build configuration continues to work

Drawback:

  • You'll need to maintain the tool on all agents.

Second (more complicated, but more stable)

  • Create new build agent (I'll call it xls-agent) on the same host with your tool (e.g., server hosting TeamCity itself)
  • Create new build confiuration (I'll call it xls-producer) with a single step that will start the tool
  • Setup artifact publishing to publish produced xls
  • Limit configuration xls-producer to the xls-agent
  • In target build configuration, add two dependencies: snapshot and artifact on xls-producer. Make sure "Get artifacts from" is set to "from the same chain"

So the resulting workflow will look like this:

  • xls-agent runs xls-producer with svn revision X
  • target configuration downloads xls from xls-producer artifacts
  • target configuration with exactly the same rev X
Nikita Skvortsov
  • 4,768
  • 24
  • 37