I have a Java project that's managed using Mercurial, and built with Jenkins. Is there a way to prevent developers from checking in code that breaks the build? I know I can do it with Ant and Mercurial hooks, but is there a way to do it with Jenkins?
Make your developers pull from a repo (let's name it "master") and push to another one (let's name it "staging"). (Easy with a simple default-push
location in the .hgrc
)
Jenkins pulls from the staging one and push to the master if the build succeeded, else revert the Jenkin's repository copy.
Only Jenkins should be able to push to the master.