Are you able to roll back to the current version?
Yes. Here’s how it works.
- When we write code, it’s on our laptops, on a copy of the main codebase called a branch. Imagine a tree: the trunk of the tree is the official codebase (called
master), and our branch of code is an offshoot, which we can edit without sullying the official version.
- Before we share that code with anyone else, we write automated tests to make sure that the code does what we expect it to do and that it’s formatted according to our style guide. We run these on our computer. Green dots mean the test has passed, red means it’s failed, and we can find out what the problem is. We can run tests just for the bit of code we’ve edited, to save time, as the whole test run takes about half an hour.
- We then share that code with colleagues on a code storage service called Bitbucket, using something called a
pull request. We invite comment and sign-off. It’s called that because we request that our new code is pulled into the
masterversion of the Consonance codebase.
- When the code has been buffed to perfection, it’s approved by colleagues and merged into the master branch. It’s now ready to be deployed to the real website.
- If the code has been in development for a long time, there will be many tens, even hundreds, of cycles of pull requests.
- Depending on the scale and nature of the change, we will either send that code to the Consonance website, or to a test or demo website for review.
- Before the code is allowed onto the live website, it runs through a
continuous integrationservice called Codeship which runs the whole suite of our tests again. So if our change has broken something inadvertently in a far flung corner of the application, this process will catch the problem before the code is released.
- If the code is a proposed structural change, we will often configure it so that users can flip between the old and the new version, until we have solicited feedback.
- If, despite all these measures, something goes wrong, we are able to immediately roll back to a previous version of the code. (We have not had cause to do this.)