Question

I have a TeamCity job that builds my project and runs all the unit tests, and another one that deploys the build to the production server.

Can I disable the "deploy" job so that it's impossible to deploy code if there's currently a failing test in the build project?

Was it helpful?

Solution

Shouldn't the deploy job already be dependent on the build one? Through Artifacts Dependency? You can set up the build trigger for the deploy job to be a successful build trigger on the build job so that the deploy happens when there is a successful build. Also, if a deploy job is triggered, it will take the last successful build. So if unit tests in the build job are failing, that build is not considered.

I wouldn't recommend snapshot dependency though, because it means when you deploy you try to trigger a new build, that is not the logical flow. Of course in the snapshot dependency you can say trigger only if a suitable build is not available ( or something like that ) but still snapshot dependency is not the way to go for this case.

OTHER TIPS

Set up a Snapshot Dependency for Deploy on the most recetly finished Build and make sure the properties to say reject if failed [and make sure Build fails if tests fail in the General settings]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top