how to fail a root project when a dependency fails?

Please consider the following project setup called 'Compile Test Deploy' CTD for short. 

Compile project job is to listen to the VCS (stash in this case) for branch changes, compile the project and create an artifact. It is wired to update PRs on stash that the build is successful. Currently this works. We have a CommitStatusPublisher setup and it reports back to Stash , compile is fine. Good to go. 

'Test' project has a dependency on Compile project. When an artifact is created, it uses that artifact to run its unit tests. 

'Deploy' project has a dependency on both 'Compile' and 'Test' to be successful and uses the 'Compile' artifact to deploy our project out. 

This all works. 

What is not working however is the ability to block a PR from merging to master if the 'Test' project has a failing unit test for example. I need a mechanism to fail the 'Compile' project elegantly that the 'builds' are failing. I don't want to add VCS to the 'Test' project for obvious reasons. I should be testing my artifact.. not my branch. 

Any idea how I can solve this issue? 


I need a way to fail a build chain completely when one of the builds fails and in turn have my VCS watcher block my PR until the build chain is 100% green. 

Please sign in to leave a comment.