Build chain design question: Chain with multiple deploys, joining a single test build and promoting to next environment
I'm trying to build a deployment pipeline in TeamCity that has the following properties:
- Multiple git repos, one per artifact
- Multiple environments: Dev, QA, etc...
- Ability to deploy single artifacts independently to Dev
- Ability to manually trigger promotion of a known set of artifacts from Dev to QA
- Only redeploy an artifact in QA if it is a new version
- After each deployment of any single artifact to Dev, whole system sanity tests run
- After each promotion of a set of artifacts to QA, whole system tests run
Now all of this I thought I'd be able to achieve through snapshot dependencies and ensuring build reuse. But I can't quite get it to work.
I have the following jobs:
- Build1 - package artifact1
- Build2 - package artifact2
- Deploy1 - Dev - snapshot dependency on Build1, deploys artifact1
- Deploy2 - Dev - snapshot dependency on Build2, deploys artifact2
- Test - Dev - run tests against Dev system. Has source code trigger for snapshot dependencies
- Deploy1 - QA - deploys artifact1 to QA
- Deploy2 - QA - deploys artifact2 to QA
- Deploy - QA - used as the trigger to trigger snapshot dependencies Deploy1/2 - QA
The second part of this around the QA deploys if the problem. It has had to end up a bit backward as ideally I'd just promote a build after it passes the "Test - Dev" run to the "Deploy - QA" bit which would then trigger the Deploy1 and Deploy2 for QA. However, if I have only deployed a new version of Build1 to Dev since the last QA release, I don't want to redeploy Build2 to QA. So I don't want to just trigger "Deploy2 - QA". In theory by triggering "Deploy - QA" by hand, it should look back at the dependencies and re-use the last "Deploy2 - QA" as it hasn't changed and only trigger "Deploy1 - QA". However, I'm getting both the QA deploy jobs triggering every time. Shown in screenshots below:

As can be seen above, the Test - Dev has triggered on a VCS change and correctly reused the Build2 and the "Deploy2 - Dev" builds.

However, upon hitting the Deploy button on the "Deploy - QA", it really did trigger build "Deploy2 - QA" which has a previous build of the exact same commit and build numbers passed to it. I'd like that build not to trigger. I just can't figure out why it is doing it.
If someone could solve this that would be great. But ideally what I want some input on is a better pattern for this as all I really want is a conditional build where if the parameters were the same as last time, don't run! Must be an easier way?
Please sign in to leave a comment.