Snapshot dependency alters the builds behavior in the following way:
- when a build is queued, also queued are the builds from all the Build Configurations it snapshot-depends on;
- build does not start until all it's snapshot dependencies are ready;
- when a first build in the the build chain is ready to start, changes are checked for the entire build chain. If some of the build configurations already have a finished build with matching changes and the snapshot dependency has option "Do not run new build if there is a suitable one" ON, the queued matching builds are not run and are dropped.
- all builds linked via snapshot dependencies are started by TeamCity with explicit specification of the sources revision. The revision is calculated so that it corresponds to the same moment in time (for the same VCS root it is the same revision number). For a queued build chain (all builds linked with snapshot dependency), the revision to use is determined upon the start of the first build in the chain. At this time all the VCS roots of the chain are checked for changes and the current revision is fixed in the builds.
- if there is a snapshot dependency and artifact dependency on the Build from the same chain pointing to the same build configuration, TeamCity ensures that artifacts are downloaded form the same-sources build.
Let's consider an example to illustrate how snapshot dependencies work.
Artifacts may not be cleaned if they were downloaded by other builds and these builds are not yet cleaned up. For a build configuration with configured artifact dependencies you can specify whether artifacts downloaded by this configuration from other builds can be cleaned or not. This setting is available on the cleanup policies page.