How to prevent TeamCity from redundantly rebuilding a project multiple times?

Scenario:

* Create a project, let's call it MyLib. As the name implies, it's a library.
* Create another project, let's call it MyApp. Assume that it uses MyLib.
* For obvious reasons, set MyLib to be a dependency of MyApp.
* Configure both projects so that they trigger when changes are checked into version control.
* Ensure the option "Do not run new build if there is a suitable one" is set for  all the projects.

Expected behaviour:

* Both projects rebuild once.

Actual behaviour:

* Both projects rebuild, but MyLib rebuilds twice. This is redundant because it is rebuilding exactly the same thing twice.

Comments:

This used to work correctly in version 5.0. Although the library projects were listed multiple times in the build queue, they were nonetheless actually rebuilt only once. But with version 5.1 RC2 (build 13340), we are seeing the above behaviour despite the fact that the option "Do not run new build if there is a suitable one" is still set.

I have to say I find it hard to think of a scenario in which anyone would actually want TeamCity to rebuild exactly the same thing multiple times.

Question:

Is there a way to prevent this behaviour, perhaps an option I overlooked?

3 comments

So MyApp depends on MyLib by snapshot dependency?
What version control systems are used?
Could you please attach screenshots of VCS roots used by all of the dependent builds?

0

First off, am I understanding it correctly that by design, on every check in to MyLib, both MyLib and MyApp ought to be built exactly once each?

> What version control systems are used?

Perforce

> So MyApp depends on MyLib by snapshot dependency?

Yes

> Could you please attach screenshots of VCS roots used by all of the dependent builds?

Both roots are set to Perforce, Client Mapping. Port/User/Password as appropriate. Ticket-based authentication is off; Charset is none; UTF-16 support is off. Checking interval is 60 seconds. Client mappings:

For MyApp:
//depot/main/MyApp/... //team-city-agent/main/MyApp/...
//depot/main/common/MyLib/... //team-city-agent/main/common/MyLib/...
//depot/main/common/Build/... //team-city-agent/main/common/Build/...

For MyLib:
//depot/main/common/Build/... //team-city-agent/main/common/Build/...
//depot/main/common/MyLib/... //team-city-agent/main/common/MyLib/...
//depot/main/common/thirdparty/NUnit-2.5.3/... //team-city-agent/main/common/thirdparty/NUnit-2.5.3/...
//depot/main/common/NUnitDirect/... //team-city-agent/main/common/NUnitDirect/...

0

If MyApp depends on MyLib, and a change is detected in MyApp, then both builds will be added to the queue. Then server will decide whether it can replace MyLib build with already started build. It can do so, if already started build contains same changes. In some cases we can't be sure whether build contains same changes or not, this is VCS specific. So, in general MyLib should only be built once.

In your case it would be helpful to see logs from your server with debug logging turned on (you can do it on Server Configuration -> Diagnostic tab). Could you please try to reproduce this issue with enabled debug, then send your logs to teamcity-feedback[at]jetbrains.com.

0

Please sign in to leave a comment.