A build chain is a sequence of builds interconnected by snapshot dependencies. Thus, all the builds in a chain use the same snapshot of the sources.
The most common use case for specifying a build chain is running the same test suite of your project on different platforms. For example, before a release build you want to make sure the tests are run correctly under different platforms and environments. For this purpose, you can instruct TeamCity to run tests, then an integration build first and a release build after that.
Let's see how the build chain mechanism works in details. On triggering a dependent build of the Release build configuration, TeamCity does the following:
- Resolves a chain of all build configurations that the Release build configuration snapshot depends on.
- Checks for changes for all dependent build configurations and synchronizes them when the first build in the build chain enters a build queue.
- Adds all the builds that need building with specific revisions to the build queue.
Configuring Build Chains
To specify dependencies in your build configuration:
- On the Build Configuration Settings page, select Dependencies
- On the Dependencies page, click the Add new snapshot dependency link.
Stopping/Removing From Queue Builds from Build Chain
If a build being stopped or removed from the build queue is a part of Build Chain, there is a message below the comment field:
This build is a part of a build chain.
If there are other running or queued parts of the build chain (i.e. other running builds or queued builds, which are connected with the build under the action), these builds will be listed below under the label: Stop other parts:.
If a user has access rights to stop a build in the list, there is a checkbox near it. The checkbox is selected by default if stopping the current build will definitely cause the build in the list to fail (for instance, if the listed build depends on the original build being stopped).
If user has no access right to stop a build from the list, the checkbox is not visible.
Selecting the checkbox marks the selected build for a stop/removal from queue.
If a user has no access right to view a build which is a part of the build chain, this build is not visible to the user at all. If there is at least one such build, there is a warning displayed: You don't have access rights to all its parts. The stripe is shown right under the message "This build is a part of a build chain".
In case when all other parts of the build chain cannot be viewed by the current user, we show a yellow stripe with warning: You don't have access rights to see its other parts.
If there are no running or queued builds for the build chain (i.e. all other parts of the build chain have finished), no additional information is shown.
Build Chains Visual Representation
Basically, each build chain is a directed acyclic graph, i.e. it cannot have cycles. You can review build chains on both project and build configuration pages: each of those pages has a Build Chains tab (if snapshot dependencies are configured). The tab displays the list of build chains that contain builds of this project or this build configuration. Note, that build chains are sorted so that the build chain with the last finished build appears at the top of the list.
When expanded, a build chain looks like this:
Here you can see:
- all builds this build chain is comprised of.
- status of these builds: not triggered, in queue, running or finished and its details
- the chain displays builds in order of actual execution, i.e. builds that start first are on the left.
Click a build in a chain to highlight this build and all its direct dependencies (both upstream and downstream). Since there can be several build chains in a single project, there is an ability to filter them.
From this page you can also:
- Continue a chain, if there are yet "not triggered" builds. Click the Run button and a new build will be started on the chain revisions and associated with builds from this chain.
- Click to open the custom build dialog with build chain revisions preselected. This action can be used if you want to rerun some build in the chain.