I read about CI/CD, loved it, but I'm having trouble with the details as everything I read was high level.
Some authors seemed to suggest that there couldn't be any failing commits on the repository (or master branch?), so a programmer that is delivering bad code would be stopped and he wouldn't be able to create a big mess. He would be forced into fixing his code so that the tests pass.
Others mentioned that the trigger would be the pull requests, not the commits. I haven't used pull requests a lot to be honest, and besides aren't they something external to git? They aren't part of git AFAIK, but part of services like github, bitbucket, etc., so I wasn't sure if I should bind my workflow to something like that.
Any thoughts on this will help me greatly. Please also mention which tools you are using, eg: Jenkins, Buildbot, etc. None of the tools I have tried were very friendly IMO. The docs and examples were lacking or tied to certain technologies like java, or services like github. I even considered building my own, it shouldn't be too hard to get the basic functionality. Right?
Best Answer
The short answer is: Do what works for your team.
In a perfect continuous deployment scenario you might have this as a workflow:
Now, in the real world, rarely does it work that way. Every team has their own workflow. You might have a couple of phases for QA and staging, or you may deploy straight from a build machine to production. You might require a manual test phase, or you might require performance tests, etc.
There is no perfect answer, except whatever makes the most sense to you and your team. Trigger on every commit if you want, or only trigger on a push to a particular branch. Which is best for you depends on what is important to you and what sort of test coverage you have. It also depends on how long your tests take to run. You don't want to have to wait half an hour before committing a line of code.
All that being said, as a general rule you shouldn't move your code to where it affects others until it has been tested.