-
Notifications
You must be signed in to change notification settings - Fork 12
Hotfix Deployment Process
An efficient and well-defined process for deploying hotfixes is essential to delivering critical updates on time while maintaining system stability and long-term maintainability. Under the current process, deploying hotfixes is a challenge especially when working with a single stage environment where only certain commits may need to be extracted and deployed to production. The hotfix workflow management outlined below offers a structured approach for identifying, implementing, testing, and deploying hotfixes, ensuring minimal disruption and upholding both code quality and operational efficiency.
-
Cleaner Commit History
- No redundant revert commits in
stage - No merge commits from hotfix integration into
stage, keeping history simple and linear
- No redundant revert commits in
-
Isolated Hotfix Development
- Hotfixes are developed on a dedicated branch based off
main, reducing the risk of conflicting changes fromstage - No need for cherry-picking from
stagetomainor vice versa, eliminating the hassle of partial commits
- Hotfixes are developed on a dedicated branch based off
-
Easier Syncing Between Branches
- Simplifies syncing: Once hotfix is merged into
main, it will naturally propagate tostagewhen rebased
- Simplifies syncing: Once hotfix is merged into
-
Clearer Testing & Reverts
- Hotfixes can be safely tested on
stagewithout worrying about unnecessary commits being merged back intomain
- Hotfixes can be safely tested on
-
Better Control Over Hotfix Merges
- Avoids complicated merge scenarios since the hotfix comes from
main
- Avoids complicated merge scenarios since the hotfix comes from
-
No Impact on Other Engineers
- While the hotfix is being developed, other engineers can continue working on
stageas long as their changes don't conflict with the hotfix files - Ensures minimal disruption to other team members working on unrelated tasks
- While the hotfix is being developed, other engineers can continue working on
-
Reduced Risk of Errors
- Dropping the revert hotfix commit(s) prevents any accidental duplication or conflicts when syncing
stageandmain - Ensures fewer chances of merging unnecessary or broken code from the hotfix branch
- Dropping the revert hotfix commit(s) prevents any accidental duplication or conflicts when syncing
1 - Create a Hotfix Branch Based on main
This ensures the hotfix is independent of
stagecommitsAdd all necessary commit fixes into this hotfix branch
git checkout main
git pull origin main
git checkout -b hotfix/<prev-release-version> (e.g. hotfix/v2.9.0)
2 - Test Hotfix in its Own Hotfix Branch using ?unitylibs=<hotfix-branch> in the URL
This is necessary for initial validations and ensures some functional verification before merging into
stage
3 - Merge Hotfix into stage Temporarily for Signed-in User Testing (when applicable)
This allows QE to test signed-in scenarios without bringing in unrelated
stagecommitsCreate a separate feature branch off of
stageand cherry-pick the hotfix commits into itRaise a PR of the feature branch to
stageand the Release Manager will squash and merge the PR once approved
git checkout stage
git pull origin stage
git checkout -b <hotfix-feature-branch>
git cherry-pick <hotfix-commit-hash>
git fetch origin stage
git rebase -i stage
git push -u origin stage
4 - Revert the Hotfix from stage After Testing
Once QE has completed testing, revert the hotfix to restore
stageCreate a revert PR while resolving any conflicts if any and the Release Manager will squash and merge into
stageonce approved
5 - Create and Merge a PR for the Hotfix into main
Open a PR from
hotfix/<prev-release-version>tomainOnce approved, the Release Manager will merge the PR into
mainAt this point,
maincontains the hotfix andstagehas reverted it
6 - Sync stage with main Without Losing Other Commits
In the interactive rebase editor, drop all the hotfix commits and their associated revert commits (since it's already in
main)Resolve any conflicts and then force push the rebased
stagebranchNow
stageandmainare in sync, while keeping any unreleasedstagecommits intact
git checkout stage
git rebase -i main
git rebase --continue (if needed after resolving conflicts)
git push origin -f
- Hotfix is developed and tested separately before merging
- Signed-in user testing happens on
stagewithout disrupting history - No unnecessary commits from
stagego intomain -
stageandmainbranches remain clean and synchronized
Should other engineers halt merging to stage during a hotfix?
No strict halt is required, but careful coordination is necessary.
If feature commits don't affect the hotfix:
- Other engineers can still merge to
stagesince their changes won't interfere - Would need to ensure that these commit changes are independent of the hotfix files
If feature commits touch the same files as the hotfix:
- Pause merging these changes to
stageuntil the hotfix is resolved - Otherwise, we risk conflicts when rebasing or reverting the hotfix from
stage
For urgent business-critical hotfixes, we will:
- Enforce a temporary freeze on
stageto prevent unexpected issues - Communicate to engineers that
stageis temporarily locked - Have a dedicated hotfix QE reviewer to expedite testing