How can I get Teamcity to Build Latest Successful Dependency like Jenkins

Answered

I have a build with a snapshot dependency set to "Do not run if there is a successful one." In jenkins I can set this up and if I build it will use the snapshot of the last successful build even if there are changes in source control.

I can find no way to get Teamcity to do this. It always forces the dependency to build, this dependency takes 3 hours and I just want it to build the latest successful version.

I have found no way to do this automatically or manually? What am I missing? 

0
6 comments

Hello Dan,

At the moment it's not possible to configure snapshot dependency without source synch. Please vote for the request: https://youtrack.jetbrains.com/issue/TW-35216.

Could you please provide more details to better understand your case?
Do build A produces artifacts what are to be used in the dependent build?

0

I voted it up.

The two build configurations do not share dependencies. Configuration A has a snapshot dependency on Config B.

I'd like to be able to build configuration B and have it use the source snapshot of the latest successful build of A without having to wait on build A to finish (build A can take several hours).

Right now if any changes are detected in build A it triggers a build of the whole build chain. While this is desirable sometimes, most of the times I just want to build it now using the last successful snapshot. 

Because of the long wait for the build this has many of our engineers wanting to stick with Jenkins.

0

Hi Dan,

Does build A actually depend on B? If not and you just want A and B to be part of the same chain you can configure aggregating build configuration C, remove dependency from A on B and add dependencies on A and B to config C. In this case A and B will run in parallel and will share the same revisions. 

If you do not need A and B to share the same revisions and, for instance, build A uses some artifacts of B you can add artifact dependency in config A on B and remove the snapshot one. In this case build triggered in A will take artifacts from the latest successful configuration in B (or whatever is the configured condition), include changes from VCS roots configured in A and ignore any pending changes in config B.

0

Hello Dan,

A small note: seems like you can already achieve something very close to what you request.

As one option, you can use TeamCity artifact dependency instead of snapshot dependency to depend on the latest successful build. This way the builds will not form the chain, but the dependency are still traceable from the build's Dependencies tab.

As another option with preserving snapshot dependencies what you can do is to tweak triggering:
If you trigger manually, you can select the latest A build in the dependencies or just go the the proper A build and select Promote in the Actions. For automatic triggering, consider setting up Schedule trigger (you can set it up to fire each 10 minutes if you like) and use "Trigger only if watched build changes" option.

0

Sorry for necroing an old thread, but this is exactly what I'm trying to do and, unless I missed something, it still seems not possible with TeamCity:

  • I want the sources to be synchronized between two builds A and B. For that, as I understand it, there has to be a snapshot dependency between the two builds.
  • I want build B to depend on A in such a way that B follows up on the last successful build of A, without re-triggering A, even if they are changes in source control since the last successful build of A. In other words, I want B to be synched with the sources as they were when A succeeded last, even if there are more recent failed builds for A.

At first, the option "Only use successful builds from suitable ones" seems to do exactly what I need, except that "If the latest finished suitable build fails, it will be rerun". I do not want to re-run A.

0

Hello,

Isn't it the same as to start build of B right after a successful build of A? Or do you want to run B many times with the same A?

 

0

Please sign in to leave a comment.