Case Study: Monolithic Repository at Google (2018) [pdf]
people.engr.ncsu.edu
people.engr.ncsu.edu
Older reading on monorepos that I'm aware of:
• Dan Luu, Advantages of monorepos (2015) http://danluu.com/monorepo/
• Why Google Stores Billions of Lines of Code in a Single Repository (2015): https://cacm.acm.org/magazines/2016/7/204032/fulltext (HTML) / https://cacm.acm.org/magazines/2016/7/204032-why-google-stor... (PDF) / https://www.youtube.com/watch?v=W71BTkUbdqE (video)
This paper is from the “Software Engineering in Practice” track of the ICSE 2018 conference:
• https://www.icse2018.org/track/icse-2018-Software-Engineerin...
• “I can search across our company's source code”
Interesting point: “Reduction of cognitive load” and “available developer tools” are cited as advantages of both monorepos and multi-repos.
>Like virtually all choices in computing, the choice of whether to use a monolithic or multi-repo model is a comparison of tradeoffs.
I have my opinions, but at the end of the day you need to choose what is right for your team and your project. You also should be open to new ideas and looking for ways to improve your current development processes and tooling. At the end of the day, version control is a means to an end and shouldn't be something that consumes a significant amount of your developers' time.
If the change is internal to the library, i.e. does not require the projects that depend on it to change the code, then the library owner simply tests that none of the affected tests break (globally), and updates their library.
If the change requires dependent projects to change their code, then some way is first figured out of having code that would work with both versions of the library, then updating all the callers individually (e.g. in a separate mostly-automated change for each project to review), then we're in the first situation above.
“Old APIs can be removed with confidence, because it can be proven that all callers have been migrated to new APIs.” (from the older article)
I'm using Jenkins. So right now I don't have a way to force build specific directory :(. It build entire thing :(. Anyone knows how to solve these problem? I have a Rails app, Go services, iOS, Android all in same repo..
It's interesting that we're moving into a microservice architecture but we try to consolidate the code base into one.
def databaseChanges = sh returnStdout: true, script:"git diff --name-only HEAD^ HEAD database"
def etlChanges = sh returnStdout: true, script:"git diff --name-only HEAD^ HEAD etl"
def apiChanges = sh returnStdout: true, script:"git diff --name-only HEAD^ HEAD api"
An example to illustrate this: You have a library X that depends on Library Y and application A that depends on X. Then when you make a change in Lib Y you want to make sure that the change doesn't break X or A. If A, X and Y live all in separate repositories with separate CI pipelines, then this is hard/cumbersome to solve. In a Mono-repo, if you use a build system like Bazel, it's very easy.
I believe when you say that your Jenkins setup is a mess, we experience a similar situation with GitLab CI. But I think it's important to realize that CI stands for "Continuous Integration". And running pipelines for every individual repository is not really testing integration, it's just testing an individual component. The solution is to use Bazel or similar. Then you will have proper CI.
And conditional deploying ( eg. Update external libraries only.
I'm production, it's not continuous, but in beta and alpha it is.
One telling question is whether there have been any efforts to unify these repos. Monorepos can come about passively, through uncontrolled growth. But if you truly believe in the monorepo, surely you'll knock down the barriers and unify the distinct repos. Has Google done that?
If they've actively chosen not to, why not? Is Android separate from google3 for hysterical raisins, or on sound principles, or some mix? Is there a cross platform repo for shared code?
You can add to your list a number of other codebases; kubernetes has it's source of truth at GitHub, for example.
These all add complexity, and not in a good way. With enough small repos you lose the ability to centrally monitor dependencies and make sweeping fixes. For example it becomes difficult to do things like safely patch your entire codebase all in one go to defend against the next embargoed vulnerability, where you have weeks or days to deploy a fix to all your products before it goes public.
Android and chrome are both on weird git systems, and that doesn't work well in Google3. There'd be a huge amount of work to merge them, and for what...exactly?