At HiP, we’re in the process of open sourcing a number of the modules and parts of our toolchain.
However, as discussed here, we keep all our platform code in a single monorepo, which is working well for us. Seperating our code out into the private repos vs public open source offerings introduces friction that we’re trying to avoid.
So, we created Jailbreak – a very tiny tool for keeping subsets of your mono repo in sync with a public mirror.
Jailbreak is really just a gloried wrapper around git filter-branch
– it’s literally just a single, simple python script.
Despite this simplicity, it’s made the release cycle singificantly simpler for us, and meant that we’re confident that there are no errors pushing selected subsets of our code into the open.
In addition, git’s filter-branch
command retains our commit history, rather than squashing everything into a single ‘export’ commit. That’s especially useful when we push something public for the first time – as the full history is open sourced, along with the project.
Using Jailbreak
Each directory which contains a module we want to open source has a .jailbreak
file placed in the root, which contains the git address of the public mirror:
For example – here’s the .jailbreak
file for Jailbreak itself:
git@github.com:hip-property/jailbreak.git
The workflow goes a little something like this:
- Edit a feature within our private monorepo
- Push to a branch, and follow our standard pull-request process
- From the root of the monorepo, we run
jailbreak {nameOfProject}
- Jailbreak clones the repo to a temporary location, does the
git filter-branch
magic, tweaks the remotes, and pushes up to github (or whatever the location defined in.jailbreak
We’ll soon be integrating this into our CD pipelines, so that all changes are automatically pushed as we merge to master, ensuring everything is kept up to date, though for now, the manual process works well enough.
Jailbreak itself has been open sourced, and is available on HiP’s github repo, here