Configuring Dependencies
Real-life CI/CD pipelines often combine multiple standalone configurations. For example, "Build", "Test", and "Deploy to Staging" configurations (or Jobs) can run independently or in sequence.
TeamCity offers multiple options to create relations between standalone configurations.
- Build Chain
A build chain is a collection of classic TeamCity configurations interconnected using snapshot dependencies.
Snapshot dependencies are right-to-left relations. For example, in the "A -> B" chain where configuration "B" has a dependency on configuration "A", "B" cannot run until "A" produces a suitable build first. The criteria for "suitable" builds depends on your setup, see the Suitable Builds section for more information. At the same time, "A" can run independently without triggering new "B" builds.
For mission-critical scenarios, you can set up dependent configurations to always force fresh upstream configuration builds, even if there were no recent changes to the project.
- Finish Build Triggers
Finish build triggers establish left-to-right relations. For example, you can create a similar "A -> B" sequence similar to a build chain, but with one key difference: "B" can run independently, while each new "A" build automatically triggers a new "B" build.
Finish build triggers offer a simple but inflexible way to trigger downstream builds and can often be replaced or complemented by snapshot dependencies.
- Artifact Dependencies
Artifact dependencies allow configurations to import files produced during other configurations' builds. For example, a "Delivery" configuration can deploy files (Docker images, NuGet packages, HTML documentation pages, and so on) produced by a "Build" configuration to a designated resource.
Artifact dependencies don’t create explicit links between configurations: both can run independently without triggering each other’s builds. If you use artifact dependencies without corresponding snapshot dependencies, a dependent build has no ability to ensure a suitable source of artifacts (an upstream configuration build) exists. For that reason, you may want to set up artifact dependencies to target pinned/tagged builds. This setup can exhibit more control on your building routine.
tip
A build (build configuration) has snapshot or artifact dependencies on another one is called a dependent build (configuration).
This section focuses on build chains and artifact dependencies. To learn more about finish build triggers, see this article instead: Configuring Finish Build Trigger.