TeamCity 4.0 Help

Dependent Build

In TeamCity one build configuration can depend on one or more configurations. Two types of dependencies can be specified:

Snapshot Dependency

A dependency of a build configuration on a different one which enforces that both builds use the same sources snapshot (used sources revisions correspond to the same moment). If a build is queued and there is no dependent build for the same sources snapshot, the necessary dependent build is automatically added into the build queue.

Let's consider an example to illustrate how snapshot dependencies work.

Let's assume that we have two build configuration, A and B, and configuration A has snapshot dependency on configuration B.

  1. When a build of configuration A is triggered, it automatically triggers a build of configuration B, and both builds will be placed into the Build Queue. Build B should start first and build A will wait in the queue till the B is finished (5.Dependencies)

  2. When the build B starts to run on the agent, TeamCity fixes the sources to include in the build A at this exact moment. All builds will be run with sources taken on the moment the build B started to run on a build agent.

  3. When the build B has finished and if it finished successfully, then TeamCity will start to run build A.

The above example shows the core basics of the snapshot dependencies, straight forward process, without additional options. For snapshot dependency options refer to the 5.Dependencies.

If a build has snapshot dependencies on several builds, the snapshot will be taken at the moment the first build of the whole set (chain) starts to run on a build agent. Depending on the dependencies topology builds could be subsequent or can be started in parallel.

Two or more builds connected by snapshot dependencies form the Build Chain. By default, TeamCity preserves builds that are a part of a chain from clean-up, but a user can switch off the option. Refer to the Clean-up description for more details.

Artifact Dependency

Artifact Dependencies provide you with a convenient means to use output (artifacts) of one build in another build. When an artifact dependency is configured, the necessary artifacts are downloaded to the agent before the build starts. You can then review what artifacts were used in a build or what build used artifacts of the current build on a Dependencies tab of build results.

To create and configure an artifact dependency use the 5.Dependencies page. If for some reason you need to store artifact dependency information together with your codebase and not in TeamCity, you can configure Configuring Dependencies to get the artifacts in your build script.

Last modified: 20 April 2023