How to avoid triggering a build if only a snapshot dependency changed?

I have a situation where a dependency to a shared piece of code exists, but I only want a rebuild to happen if the consuming code also changed. Is there a way to express this in TeamCity?
--
cg

4 comments
Comment actions Permalink

Would the solution be to just have an artifact dependency and not have a snapshot dependency?

0
Comment actions Permalink

Hi Christian

Actually, snapshot dependency from Application configuration to Library configuration does not launch builds down the chain.
When you start new Application build somehow (manually, or by automatic trigger), the snapshot dependency starts new Library build, but not vice versa.

This logic can be changed by Trigger on changes in snapshot dependencies option of VCS trigger. Maybe this is the reason of the behavior you see.

You can find more details and examples in articles Build Dependencies Setup and TeamCity Build Dependencies.

Michael

0
Comment actions Permalink

I think I understand what's written in the doc you linked, except for the definition of "suitable build".

So in my case, I have:

Library -> Executable -> Pack/Deploy

There is both a snapshot dependency and an artifact dependency between those builds.

I want to trigger Pack/Deploy regularly, and I want to configure the snapshot dependency to not rebuild if a suitable build exists.

My question is what happens in the following case:

Source code for Library is updated. Since Library has a VCS trigger, Library is rebuilt.

Source code for Executable is not updated. The build that exists was based on the old version of Library.

Pack/Deploy is triggered. QUESTION: Will this cause Executable to be rebuilt, or will it simply use the existing build of Executable?

For reasons I won't go into here, I actually want to use the old build of Executable and not trigger a rebuild, even though the Library is newer. I only want Executable to be rebuilding (and using the newer version of Library pulled in via artifact dependency) if code in the Executable source tree is changed. The idea is to defer resolving incompatibilies until you are actually updating Executable...

0
Comment actions Permalink

Christian,

> Pack/Deploy is triggered. QUESTION: Will this cause Executable to be  rebuilt, or will it simply use the existing build of Executable?

Yes, this should cause Executable to be rebuilt as snapshot dependency ensures all the builds in the chain (linked) use "same sources snapshot".

> I  only want Executable to be rebuilding (and using the newer version of  Library pulled in via artifact dependency) if code in the Executable  source tree is changed. The idea is to defer resolving incompatibilies  until you are actually updating Executable...

Looks like artifact dependency is the way to go. But this way triggering Pack/Deploywill never re-trigger Executable and will just use the last one according to configured artifact dependency.

0

Please sign in to leave a comment.