7 ms·
> The scenario we want to avoid is that a faulty commit makes it to the main branch. Close. The scenario we want to minimize is faulty code on the main branch.
by hinkley 7y ago
> The scenario we want to avoid is that a faulty commit makes it to the main branch.
Close. The scenario we want to minimize is faulty code on the main branch. As your team grows, as the number of commits go up, it becomes a game of chance. Sooner or later something will get through. The more new teammates you have, the more often that will happens.
This is an inescapable cost of growth. The cost of promoting people to management. The cost of starting new projects. Occasionally you can avoid it as a cost of turnover, but you will have turnover at some point.
What matters most is how long the code is "broken" (including false positives) before it is identified, mitigated, and fully corrected. The amount of work you can do to keep these number relatively stable in the face of change is profound.
If you insist on no errors on master ever you will kill throughput. You will create situations where the only failures are big, which is neck deep in the philosophy that CI rejects: that problems are to be avoided instead of embraced and conquered.
- jdlshore 7y agoIt's possible (and not that hard) to define an integration process that prevents faulty commits from being integrated to the main branch. > If you insist on no errors on master ever you will kill throughout. Not sure why you believe this. It hasn't been my experience; just the opposite, in fact. By using CI in conjunction with a process that prevents errors on master, everything goes more smoothly, because people don't get stalled by the broken master.
- richardlblair 7y agoYou're both right. The healthy mentality is to realize mistakes will happen. This creates a healthier culture when things do break. However, you should take every step to ensure it doesn't happen. You should act as though you want to prevent all faults from hitting you master branch.
- Ididntdothis 7y ago"It's possible (and not that hard) to define an integration process that prevents faulty commits from being integrated to the main branch. " You should strive to do that but you shouldn't be surprised that despite all effort mistakes still happen from time to time.
- jdlshore 7y agoSure, mistakes happen, which is why the process is typically automated. You have to go out of your way to merge faulty code. It's rare. Not saying mistakes can't happen, but the person I was replying to didn't seem to be aware of this tooling.
- brown9-2 7y agoIt depends on what you means by “errors on master”. Tests won’t catch all possible bugs in production.
- dantiberian 7y ago> If you insist on no errors on master ever you will kill throughput. There are a large number of automated tools which will help you prevent merging code that could break master: https://github.com/chdsbd/kodiak#prior-art--alternatives https://github.com/chdsbd/kodiak#prior-art--alternatives. The basic approach is to make a new branch from master, apply one or more commits on top of that branch, run the tests, and if tests pass, merge those commits (with fast-forward) back onto master. This makes it very difficult to get broken commits on master, as they have to pass the tests before. It is possible if you have a flaky test suite, but in my experience it happens very rarely, and is usually very easy to fix if something creeps in. In my experience, they speed up throughput, not slow it down, especially when you account for the disruption that merging broken code to master can be. https://graydon2.dreamwidth.org/1597.html https://graydon2.dreamwidth.org/1597.html has a good discussion of this: The Not Rocket Science Rule Of Software Engineering: automatically maintain a repository of code that always passes all the tests
- sytse 7y agoThe problem with a popular repository can be that running the tests can take longer than the time you have between merges. In GitLab we made merge trains https://docs.gitlab.com/ee/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/ https://docs.gitlab.com/ee/ci/merge_request_pipelines/pipeli... to solve this problem automatically. With merge trains the merge requests with a passing feature branch is placed in a queue and tests are run against the combination of that branch and all the branches before it merged in. Since tests will pass 95%+ of the time the feature branches passes this can speed up the amount of merges you can get into master by 10x or more.
- dionian 7y agoautomated tests don't necessarily catch all errors
- deleted 7y ago[deleted]
- jpdel 7y agoAgree. Some faulty commits may go through. But then you strengthen your test suite to prevent similar issues to happen again, and so on.
- gregdoesit 7y ago> If you insist on no errors on master ever you will kill throughput. Unless you solve this engineering problem with tooling. At Uber, the full-blown CI mobile test suite takes over 30 minutes to run on a development machine (linting, unit test, UI tests - most of this time being the long-running UI tests, specific to native mobile). So we only do incremental runs locally, and have a submit queue, which parallelises this work and merges only changes that don’t break, into master. And we have one repository that hundreds of engineers work on. It’s not an easy problem and the solution is also rather complex, but it keeps master at green - with the trade-off of having needed to build and maintain this system. See it discussed on HN a while ago: https://news.ycombinator.com/item?id=19692820 https://news.ycombinator.com/item?id=19692820
- pojzon 7y agoHow do you handle situations like that: multiple dvelopers added merge requests to queue, the changes they made are mutually exclusive (automatic rebase wont work). What happens when the first branch gets merged to master and next 10 are still in the queue ? How do you mitigate that to decrease development cycle ? Lets just say in my company it also takes 30m to run tests and 4h to run them on merge pipeline with FATs and CORE tests.. Its way too long and highly cripples productivity.
- baq 7y agodon't work at uber but have similar problems at my job and i'm quite convinced the problems you ask about are part of the 'not easy' in the OP comment. maybe they can queue whole branches instead of single checkins?
- brown9-2 7y agoThe robot won’t merge a change in the queue if it can’t be merged or tests fail. The changeset would be left open and the developer notified to fix it. The whole process assumes that multiple changes in the queue don’t depend on each other, if they did, it should all be in the same changeset.
- 7y ago