Deploying branches to GitHub.com

At GitHub, we use a variant of the Flow pattern to deploy changes: new code is always deployed from a pull request branch, and merged only once it has been…

Aman Gupta
10 min readadvanced
--
View Original

Overview

This article details GitHub's deployment process, emphasizing the use of pull request branches and the importance of continuous integration. It outlines the deployment workflow, including the use of Hubot for chat-based deployment commands and the mechanisms in place to ensure code quality and visibility across teams.

What You'll Learn

1

How to deploy code changes using Hubot commands

2

Why using deployment queues prevents confusion during peak hours

3

How to implement deployment guards to ensure code quality

Key Questions Answered

What is the deployment workflow used by GitHub?
GitHub employs a deployment workflow where changes are deployed from pull request branches and merged only after being confirmed in production. The stable release branch is 'master', which contains production-ready code. If issues arise, the latest 'master' can be redeployed to roll back changes.
How does Hubot facilitate deployments at GitHub?
Hubot allows GitHub engineers to deploy changes through chat commands, providing visibility to all team members. Commands like '/deploy' enable engineers to deploy specific branches while ensuring that everyone is aware of the changes being pushed to production.
What are deploy guards and how do they work?
Deploy guards in GitHub's workflow prevent deployments until continuous integration tests have completed successfully. This ensures that code is not deployed while tests are still running, thereby maintaining the integrity of the production environment.
What are deploy locks and their purpose?
Deploy locks are mechanisms that prevent multiple branches from being deployed to the same environment simultaneously. Once a branch is deployed, the environment is locked to avoid conflicts, allowing developers to test their changes without interference.

Key Statistics & Figures

Number of deployments per week
Several hundred times
This statistic highlights the frequency of code changes being deployed to GitHub's website.

Technologies & Tools

Chatbot
Hubot
Used for facilitating deployment commands and enhancing team visibility during the deployment process.

Key Actionable Insights

1
Implement a chat-based deployment system using Hubot to enhance visibility and collaboration among team members.
This approach allows all team members to see deployment activities in real-time, fostering a culture of transparency and accountability.
2
Utilize deployment queues to manage multiple developers' changes during peak hours.
By implementing a queue system, developers can avoid conflicts and ensure that everyone has a fair chance to deploy their changes without confusion.
3
Establish deploy guards to enforce code quality before any deployment.
This practice helps prevent bad code from reaching production, ensuring that only thoroughly tested and verified code is deployed.

Common Pitfalls

1
Deploying code without ensuring that continuous integration tests have passed.
This can lead to bad code being pushed to production, which can cause significant issues. Implementing deploy guards can help mitigate this risk.

Related Concepts

Continuous Integration
Chatops
Deployment Strategies