Running two builds against the exact same version of source

I have two build configurations (the second dependent on the first) that I want to run against the same checkout. Specifically, I'd like to ensure that they are both run against the exact same versions of source files. It think that most of the time the second build will naturally have the same sources as the first, but I don't want to leave this to chance. I don't see an obvious way to do this in TeamCity, but I have two ideas on how it could work.

1. The builds could share a checkout directory. The second build runs (after the first completes successfully) on the same directory structure that the first used exactly as it stood when it was finished.

2. The first build tags the source with a tag that contains its build number. The second build could check out this tag, if there was a way for it to know the build number of the first build's last successful run.

Are either of these solutions possible? If not, does anyone have a solution that is? Is anyone else in this situation?

It would be possible for us to augment the artifacts produced by the first build and modify the second to run off of those artifacts rather than src, but that path would be much more work than either of the above solutions.

Thanks.

Matthew Jaskula

1 comment

Matthew,

Sorry for the delay in replying.

For the time being, the feature is not directly supported by TeamCity. I will comment on the workarounds you mentioned.

1. The builds could share a checkout directory.


This way you will need to ensure the configurations run on the same agent (currently, this is possible only by making only a single agent compatible with both) and that no other build is run in between (no way to ensure that, but it will usually be the case, provided no other build with the same checkout directory is triggered in between on the same agent).

2. The first build tags the source with a tag that contains its
build number.


Not all VCS in TeamCity support building across a tag. Moreover, TeamCity currently does not support moving a tag.

The second build could check out this tag, if there
was a way for it to know the build number of the first build's last successful run.


That is possible to workaround by storing the build number in the build artifacts and then artifact-depending on that file in the last successful build.

It would be possible for us to augment the artifacts produced by
the first build and modify the second to run off of those artifacts
rather than src, but that path would be much more work than either of the above solutions.


For the time being this seems the most viable and guaranteed solution.

The good news is that right now we are working on the feature to allow dependent builds to use the same sources revision. One of the next EAP releases of 4.0 branch will have the feature and we would appreciate if you can try the release then and let us know how it suits your needs.


--
Best regards,

Yegor Yarko
Project Manager
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0

Please sign in to leave a comment.