Artifact dependency - Is "Latest successful build" latest revision or latest date?

The setup

We have a list of completed builds on Build Configuration A:

  • #014 - [Release branch 1] built on 10 jun
  • #013 - [Release branch 2] built on 9 jun
  • #012 - etc
  • #011 - etc

However, build #013 is on a later revision than build #014. This is the git revision (simplified, but commit 1 is reachable from commit 4):

  • <Commit 4> #013 [Release branch 2]
  • <Commit 3> #012
  • <Commit 2> #011
  • <Commit 1> #014 [Release branch 1]

As can be seen, build Commit 1 on which build #014 is based comes earlier than Commit 4 / build #013 in the revision history.

The problem

We have another build config B (used to run auto tests) which gets triggered whenever a build on config A finishes. Config B also fetches artifacts from Config A via artifact dependency. It is set to any branch, and "Latest successful build".

The build on B gets triggered for build #014, but fetches artifacts from build #013. It seems to be fetching the latest revision, not latest in build finish time. Is this as designed?

 

1 comment
Comment actions Permalink

Hello,

In theory it should first find latest successful builds in all the branches matched by the filter, and then select the one which was executed on the most recent commit. When it comes to comparing whether one build is on a more recent commit than another TeamCity unfortunately does not yet take commits graph into account. It relies on an internal id of a commit. The bigger it is, then the more recent the commit. 

Please have a look for a value of modificationId parameter in the link to the commits #1 and #4, which one is bigger? Also builds can have more than one VCS root. So ids of all commits should be taken into account.

But, I'd also reconsider your setup. To me it looks too fragile. For instance, there is no guarantee that when B is triggered it will take artifacts from A which caused this triggering. Build B could sit in the queue for a while and another A could finish during this time.

If you want consistency, you should add a snapshot dependency from B to A. And also change the rule in artifact dependency to "build from the same chain". Then the finish build trigger will take this into account and ensures that B will use exactly the artifacts of A which caused the triggering.

 

0

Please sign in to leave a comment.