Setting up a Pipeline from Build to Deployment

I am setting up a simple deployment pipeline (additional stages will be added in the future).  It includes three stages:

  1. Commit - Version Solution, Compile Solution, Run Code Analysis, Run Unit Tests
  2. Integration - Run Integration Tests
  3. Deploy to Test - Deploy to Test Environment


At the moment they are setup as three build configurations.  The chain is as follows:

  1. Commit - triggered on check-in, no dependencies
  2. Integration - triggered on successful Commit build, snapshot dependency on Commit build
  3. Deploy to Test - triggered on successful Integration build, artifact dependency on Commit build (deployment package folder)


When I visualize the build chain it calls it "Integration".  Furthermore the Deploy to Test build never shows up in the chain.  I want to make sure I'm configured correctly based on the intent of the features.  I tried to set the Deploy to Test artifact dependency to use "Build from the same chain" but it wanted me to setup a snapshot dependency as well.  In that final stage I'm only interested in the artifacts - not the entire snapshot.

Is this the correct approach for building a pipeline in TC7?  Is there any way to get the build chain tab to show right through to the end?

8 comments
Comment actions Permalink

Build chain in TeamCity consists of build configurations or builds which have snapshot dependency on each other. So snapshot dependency is required to construct the chain. I am not quite sure what do you mean by "In that final stage I'm only interested in the artifacts - not the entire snapshot"? Could you please elaborate on that?

0
Comment actions Permalink

The final build step deploys the artifacts created by the initial build once all of the first and intermediary builds complete successfully.  That final build therefore requires only the artifacts, nto the entire snapshot of the build state to work.  Is that not what artifact dependencies are for?

0
Comment actions Permalink

You mean you do not want to checkout source code in your deploy build? This is not a problem, you may not have VCS roots in deploy build configuration while still have snapshot dependency. Snapshot dependency in this case is required for TeamCity to understand what forms your build chain.

0
Comment actions Permalink

On the deployment build the only thing I need is the artifacts from the first build.  Perhaps I'm missing the point of an artifact dependency - can you give me an example of when that type of dependency is used?

0
Comment actions Permalink

But you also need to visualize build chain in TeamCity, right? For this, you need to have snapshot dependency from Deployment on Commit build.

Snapshot dependency also provides results consistency.

Consider the following case:
- the Commit build with build number #1 has just finished
- new Deployment build is added to the queue by finish build trigger, Deployment build has artifact dependency on the last finished Commit build

The question is, when Deployment build starts will it take artifacts from Commit build #1? The answer - not always. If there is another Commit build in the queue and it so happens that this build starts before Deployment build (which is possible if queue was re-ordered, or Commit build has higher priority, or there is no agent for Deployment build right now, but there is constant flow of changes in Commit configuration), the Deployment build may take new Commit build artifacts. In many cases this is not desirable behavior. With snapshot dependency you won't see this problem. Deployment build will  use artifacts from the build from the same chain, it won't use artifacts of other Commit builds.

0
Comment actions Permalink

Ok, so you've convinced me that snapshot dependencies are key to making this work as I would expect.  Do I even need to specify an artifact dependency then?  In what scenarios would the artifact dependency be useful?

0
Comment actions Permalink

Artifact dependency allows one build to use results produced by other (binaries, jar, war files and so on). Snapshot dependencies provide results consistancy and visualization.
If you do not need consistency, you can use artifact dependency only. If you need other build results and consistency - you need to use both. Sometimes results are not needed but consistency is required, for example, if you want to split one build onto several parts and run them in parallel. Then all you need is snapshot dependency.

0
Comment actions Permalink

Artifact dependencies can be used to adhere to the "Build your binaries only once" principle of Continuous Delivery
=> this ensures that what you deploy is 100% bit-wise identical to what you test during unit or integration tests.

0

Please sign in to leave a comment.