GitHub development team's development environment moved to Codespaces, setup time reduced from 45 minutes to 10 seconds



GitHub announced on August 11, 2021 that it will make available a browser-accessible integrated development environment,

Codespaces, for Team and Enterprise Cloud plans. On top of that, GitHub revealed that most of its github.com development has moved from macOS-based to Codespaces.

GitHub's Engineering Team has moved to Codespaces | The GitHub Blog
https://github.blog/2021-08-11-githubs-engineering-team-moved-codespaces/


After nearly 14 years of development, the github.com core repository has over 1 million commits, most of which come from developers building and testing on macOS.

The github.com repository is close to 13GB on disk, and cloning alone takes about 20 minutes. Furthermore, when combined with the dependency settings, it will take more than 45 minutes to launch the development environment of github.com on Codespaces. Also, creating a branch from a commit object often required nearly an hour of bootstrap each time.



So GitHub decided to move its 14-year macOS-centric github.com development environment to Codespaces.

First of all, when cloning github / github with Codespaces, do a shallow clone to get only the latest version, not a full clone that duplicates the entire repository locally, and the repository in the background after Codespace is launched with the latest commit. It is said that it has switched to a mechanism to unshallow the history of. This has reduced the cloning time from 20 minutes to just 90 seconds.

The next thing to do was cache the network of software and services that support github.com. These software and services include not only traditional Gemfile- based dependencies, but also those written in custom builds of C, Go, and Ruby. So, GitHub uses ' GitHub Action ' to automate the flow of 'clone the repository, bootstrap the dependencies, build and push the resulting Docker image', and this Docker image is github / github. Made it used by devcontainer as a base image tuned for the Codespaces development environment. As a result, more than 95% of the Codespaces development environment on github.com is created with bootstrap.

By further optimizing apps and services, the launch of the Codespaces development environment on github.com was shortened from 45 minutes to 5 minutes. However, GitHub said, 'The time of 5 minutes is too long to start immediately. In one study, it takes only 10 seconds for people to concentrate and move to the flow state. It has made great strides. But it was still in the middle of the road. '

Attempts to significantly reduce the time it takes to clone by shallow cloning helped to get Codespace up and running quickly, but I had to do a full clone somewhere. Therefore, by creating a pre-build with clones and bootstraps completed in advance, the developer's Codespaces environment is ready in 10 seconds.



Regarding switching development environments, GitHub engineers said, 'I used to be skeptical about Codespaces, but now I'm not.' 'I'm solemnly swearing that the CPU will never have to compile Ruby from source.' He said that he accepted it immediately.

“We welcome more services and more engineers to GitHub every day, and in the process we discover new stories about the value Codespaces creates, but at the heart of each story. , There is a consistent theme that touches the hearts of all engineers. Better tools have been discovered and become more productive, so it's irreversible. '

in Software,   Web Service, Posted by log1i_yk