We have a nightly TeamCity build which releases the latest code to our test website, restores the database to match production, then applies any schema and data changes we have in TFS. If this nightly build fails, the website is down until we manually fix the code and/or the database scripts and restart the build.
What I'd like is to automatically rollback to the last successful build so the website is available despite of any build break.
After spending a bit of time investigating, here's my proposed solution:
What I don't know is how to have the rollback build get the version based off a label.
Any help for this, or another solution, would be appreciated.
Cheers.
A judicious use of the TeamCity REST API might work here. I'm cribbing a bit from this question, which covers some of this same territory. You might could do something like this (and I'm just spitballing here):
VerifyBuild
configuration as per your Step 2.RollbackBuild
configuration that can deploy from a given label, the build number of which is parameterized as %rollback.buildnumber%
In VerifyBuild
:
%rollback.buildnumber%
of the RollbackBuild
to the last successful build number.RollbackBuild
.I'm proposing this method because I don't know how you would dynamically fetch the correct label for RollbackBuild
prior to the checkout, so I'm using VerifyBuild
to pre-populate it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With