Build Chain
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. Sometimes the build chain is called a "pipeline".
Common Use Case
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.
See also Build Dependencies Setup for details and an example.
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.
Build Chains are visible in various places in the TeamCity Web UI:
Dependencies page of build configuration settings
Since TeamCity 2017.1, if a build configuration is a part of a build chain, the corresponding information is displayed in the Build Configuration settings > Dependencies page | Snapshot dependencies. Clicking the build chain link opens the preview of the build chain and its configuration in a separate window. The preview shows builds of the chain; the builds with automatic triggering configured are marked with the icon:
Build Chains tab of project home and build configuration home page
You can review build chains on both project and build configuration pages: each of those pages has a Build Chains tab appearing when snapshot dependencies are configured.
The tab displays the list of build chains that contain builds of this project or this build configuration with the ability to filter them. Note that build chains are sorted so that the build chain with the last finished build appears at the top of the list.
The pie-chart icon displays the ratio of the statuses for builds that are parts of the chains. On hovering over the pie chart, the details are displayed:
When a chain is expanded, the following information is also available:
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.
Clicking a build in a chain highlights the selected build and all its direct dependencies.
Since TeamCity 2017.1, the page
provides a more compact representation of chains: If several top builds triggered the same chain of dependent builds, TeamCity displays one build chain with several «top builds».
has additional display options: «Group by projects» and «Hide details».
transitively highlights all the downstream/upstream builds when a build is selected in a build chain.
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 re-run some build in the chain.
Dependencies tab of build results page
If dependencies are configured, you can view their details build results page, the Dependencies tab. This tab also displays indirect dependencies, e.g. if a build A depends on a build B which depends on builds C and D, then these builds C and D are indirect dependencies for build A. The tab also displays artifacts downloaded and delivered by the builds of the chain.
Since TeamCity 2017.1, the Dependencies tabs allow grouping/ungrouping builds and highlighting the builds reused from previous chains (Snapshot Dependencies).