How do I setup TeamCity to only generate changed artifacts?

Hi,

Is it possible to make teamcity only generate changed artifacts, rather than always bundling all of my code into each build? I am testing out TC with Subversion and PHPStorm. Every time a checkin to SVN takes place I want TC to analyse which files have changed versus the repository and only generate artifacts and an SVN tag for them. At the moment if I click on the artifacts link next to each build it seems to include every file. The tag within SVN also contains every file, whether changed or not.

It is desirable to be able to work with incremental releases of code rather than having to re-deploy the whole project each time.

I am using Teamcity 6.03 Professional.

Thanks,
-James

11 comments
Comment actions Permalink

Break the product down to multiple build configuations for each module.
That way, only one module will build upon a code change.
You can then have a packaging build configuration that downloads them all and ties them together.

0
Comment actions Permalink

If you do that, how do you prevent the packaging build from running multiple times if multiple component builds run?

0
Comment actions Permalink

Hmm good point... Packaging is a nightly build for us.
This isn't a big problem for us because each module creates a few DLLs, and each developers just pick up the DLLs and test those specifically.
YMMV

0
Comment actions Permalink

Thank you for your comments and suggestions but building like that won't work for me. Here's why:

The PHP web application I'm supporting consist of a few hundred files, each broken down into modules/areas of functionality and organised like such on disk. For instance there's a document manager module, an application process module and a user admin module. When a new bug or dev project is worked on, we give it a reference number which is used to identify those particular code changes. Within PHPStorm we then manage each project by assigning it to its own subversion changelist identified by the same reference number. When that bit of work is finished we can then checkin the changelist to SVN.

Some bugs/dev projects affect files across multiple modules. So a given changelist may not be limited to just one module. What I want is for only the changed files listed in each changelist to be bundled into the artifacts folder when I trigger TeamCity. So each TeamCity build would relate directly to the corresponding changelist and would only contain changed files.

In my experience it is common practice to release incremental updates to projects, whereby only the altered/new files are released to an existing deployment, rather than updating the whole code base. But I cannot see a way to make TeamCity behave like this. The artifacts folder always contains the entire code base!

Any ideas?
-James

0
Comment actions Permalink

I'm not following...

What I want is for only the changed files listed in each changelist to be bundled into the artifacts folder when I trigger TeamCity.


What does the changelist contain? I thought changelist is a list of source code that's been modified, yet you're saying that they are bundled into artifacts.
Are you suggesting that you're publishing the modified souce files as artifacts?
0
Comment actions Permalink

Hi, yes that is exactly what I'm suggesting. My understanding is that the artifacts are the results of builds and are therefore deployable files. See this page:

http://www.jetbrains.com/teamcity/features/build_management.html

And this specific comment:

"Artifacts are files and folders, such as installers, WAR files, log files, etc., produced by a build.

You can download artifacts from multiple places in TeamCity's UI: the Projects page, the                 Build Configuration page or the Artifacts tab of the Build Results page.

You can download all build artifacts in a single .zip archive."

I am using PHP which is not a compiled language, so my deployable files will be the same .php files as those in my change list. Obviously with Java or .NET you get bytecode/DLLs or whatever as an end result but with PHP you do not.

Does that make my question any clearer? I realise that many people using TeamCity will be working with Java etc. but I would hope that it caters for the PHP community too.

I've never used continuous integration software before so if I am making incorrect assumptions or not understanding something basic, please explain and I'll happy to learn!

0
Comment actions Permalink

Ah, now I understand. In PHP, source = product!

TeamCity as of now doesn't provide any way to distinguish artifacts by its timestamps. If you wanted any intelligence on which files should be published, that should be scripted as a post-build process.

For instance, you can have a script that copies the files in changelist into a new directory, then have TeamCity pick up artifacts from that location. That script can be run at the end of each build.

0
Comment actions Permalink

Ah, I see! But am a little disappointed. I was hoping that TeamCity could talk to subversion for me and work all that out :-) No such luck! I think I'm going to give myself a crash course in SVNAnt or some other tool and see if I can do what you suggest.
Thanks for your help. I'll mark this question as answered.
-James

0
Comment actions Permalink

Give it a couple more days before marking it as answered.
Maybe a developer from JetBrains has a better idea.

0
Comment actions Permalink

Oh, too late. Hopefully they might read it anyway.

0
Comment actions Permalink

Hi James

Technically, it could be scripted - a list of changed files can be obtained by parsing svn log output, and artifacts can be declared dynamically (see Publishing Artifacts while the Build is Still in Progress page).
But the question how are you going to deploy them to the web server? How to ensure copies are equal?
Usually it's automated with tools like rsync, or by making your web server to check out sources right from version control.

Here is also a good discussion on StackOverflow:  http://stackoverflow.com/questions/425692/what-is-your-preferred-php-deployment-strategy

Michael

0

Please sign in to leave a comment.