views:

238

answers:

2

So far, I've only used TeamCity as a continuous build server. No true integration. Now, I have the need to copy the output from one shared project to two other dependent projects, and kick off their automated builds in turn. That is, ProjectA and ProjectB both depend on ProjectC. All three are currently being built by TC when any commit occurs in their respective repositories. What we desire, is for the output of ProjectC to be copied and committed to ProjectA and ProjectB. Such a commit would in turn start the build process of both dependent projects. This seems like it would be a common scenario when talking about continuous integration. Is it not?

To clarify, we're using TeamCity v.4.5.5 (build 9103), SVN, and nAnt as our build runner.

EDIT: I mispoke when I said something about committing to another repository. They actually all three reside in the same physical repository, just at different levels in the hierarchy.

A: 

Typically you don't commit build output to your repositories. Are you sure that's what you want?

You can make TeamCity copy the output (artifacts) from one build project into directories of another, but in order to commit it, you'll need to add some scripting, like a batch file or similar.

Lasse V. Karlsen
In this scenario, ProjectC becomes a third party to ProjectA and ProjectB. Therefore, it's output should exist in the 'lib' folders for both projects, alongside other third party assemblies. So, yes, having the output committed is definitely what I want here. Using names like ProjectA, ProjectB, and ProjectC clouds the example, but essentially, each of these projects are owned by different parts of the business and are not edited by each other. So it's desireable in this case for ProjectC to be provided to consumers in assembly format.
Kilhoffer
+1  A: 

I don't know whether TeamCity supports this, but this should be easy to script by yourself - as a last step of build in ProjectC add a script that will checkout ProjectC directories (not whole repository, just a directory where you keep binaries of ProjectC) from ProjectA and ProjectB, copy all required files and commit with some autogenerated message - seems quite simple.

However - this is dangerous. Build of ProjectA and ProjectB could break because an API of ProjectC changed, or some untested part of code was broken. This could disorganize work of teams A and B. I would go for solution where new version of libraries are commited once a day / a week / any other time period.

Also, it might be a good idea to create an automated changelog - for example, if you trust quality of your svn log messages, you could create a changelog from all "new" commits included in commited release (or append current log message, if you decide to choose to push new libraries after every commit). This way teams responsible for ProjectA and ProjectB will be able to easily fix their build if new library breaks it - they'll know exacty what was changed, without need to check manually/ask team C.

maciejkow
Great tips. It looks as though TeamCity does not do this directly, so scripting it is where I'm at now. You also made me stop and think about whether or not I want this to occur after each commit on ProjectC. I think probably during the nightly build is sufficient. The idea of the automated changelog is an interesting one as well. Haven't ever thought of doing that. Not sure if I trust the log messages enough, though.
Kilhoffer