Occasionally a bug is found in a live release that requires a quick mitigation. For these cases we can deploy a build outside our normal release cadence with only the critical bug fix added.
There are 2 methods of deploying hot fixes depending on the issue:
-
Codepush Releases: If the issue only affects javascript code we can deploy a hotfix with Codepush and users will get the update automatically on the next run of the app.
-
Native Releases: If the issue affects native code we must deploy new build and send through the app review process as normal. Note this build will still need to go through the review process and user's will need to update so this is only a mitigation not an immediate fix. If a faster release is necessary you can request an expedited review for the app store but this should be done sparingly and is not guaranteed to be approved. Google Play does not offer expedited reviews but their review process is typically faster.
The first time you deploy a hotfix you will need to install the app-center cli:
yarn global add appcenter-cli
Run:
yarn setup:releases
All our live release versions should have a corresponding tag in git that will end in -submission
.
You can find the latest release tags using the script:
./scripts/deploys/latest-submissions
This will output the latest submission tags:
Latest iOS submission: ios-8.34.0-2024.03.07.11-submission
Latest Android submission: android-8.34.0-1674645623-submission
If it was a typical release they should be equivalent code and you should be safe to choose one, but if you have doubts you can confirm in the compare view in github.
For our example let's say our last released build is 7.2.0 (2022.2.3.14)
We will want to checkout the tag ios-7.2.0-2022.02.03.14-submission
:
git checkout ios-7.2.0-2022.02.03.14-submission
git branch 7.2.0-hotfix
git checkout 7.2.0-hotfix
Get the commit hash for the bug fix you want to release in the hotfix. If it was merged into main you want the hash of the merge commit.
You can find it in the github ui or by checking out main after the merge and running git log --oneline
.
Run the script ./scripts/codepush/apply-fix.sh <commit-hash>
Passing the commit hash of the fix, if there are multiple you can run multiple times.
If you see output like: Warning: native code changed you cannot use codepush for this hotfix, please follow the native beta deployment steps.
The changes affected native code and cannot be deployed through codepush, please follow the Native release hotfix process
section of this document.
Otherwise follow the steps in Codepush release hotfix process
.
Codepush release hotfix process
Ask #practice-mobile if anything has been deployed as a hot fix previously targeting this app version. If so you will want to pull the commits in from this hot fix to your branch to make sure all fixes are present.
Since the branch you are on is older than main it is likely some node deps are out of date locally. You will need to update your local deps otherwise the deployment to codepush will fail.
yarn setup:artsy
yarn install:all
[!IMPORTANT] If the install results in changes to Podfile.lock you must do a Native Release Hotfix, please refer to that section of the docs.
Let #practice-mobile
know you will be deploying a hotfix and to hold off deploying to codepush or betas.
Run the script to deploy the hotfix to the canary deployment:
./scripts/codepush/deploy-to-codepush.sh 'Canary' 'hotfix description'
Download the latest app from the app store or play store Enable the dev menu and download the codepush bundle from the staging deployment. Test that the fix is working as intended and do some basic QA to make sure the app is functioning correctly.
If QA goes well run the script to promote the bundle to production. Make sure to monitor the app as it rolls out to users.
./scripts/codepush/promote-to-prod.sh <rollout_percentage>
For example if you wanted to rollout to 50% of users you would pass 50
for rollout_percentage. If it is critical to get the fix out fast
you can pass 100
otherwise it is suggested you pass 50
and monitor before updating to 100%.
If all looks good with the fix you can update the rollout to all users:
./scripts/codepush/update_rollout.sh 100
Native release hotfix process
Since the hotfix branch is a past release the app version will need to be updated to submit to Apple and Google Play. The next release version can be found in app store connect and is generally the previous release's version number incremented by 1. In this example it is 7.2.1
./scripts/deploys/next
What is the new human-readable release version? 7.2.1
Commit the version changes.
git add -A
git commit -m "Update version for hotfix"
Communicate with other devs that a hotfix will be deployed and they should hold off on deploying betas until a build is submitted for review.
./scripts/deploys/deploy-beta-both
(or ./scripts/deploys/deploy-beta-ios
or ./scripts/deploys/deploy-beta-android
for individual releases)
Follow the instructions for deploying to app store and deploying to play store.
Make sure to QA the bug fix changes and run through the QA script before releasing to users.
Codepush was deployed but I am still not seeing my app update. What's going on?
Updates aren't instant in mobile, even with codepush, but users on the latest should get updated over a few days automatically with a codepush rollout. If you want to try to force the update you can make sure you are on the latest version of the app in the app store and then kill and restart your app.
I want to deploy to codepush and target multiple versions to get more users updated. How do I do that?
You probably should not, codepush will prioritize the latest mandatory update so releasing multiple will affect roll outs of the others and slow down how fast fixes get to users. Most users will update fairly quickly once a release is rolled out completely so it is best to target the latest and wait in most cases. If something is critical we can talk about options in the #practice-mobile channel. Most things are not critical and remember we do releases every 2 weeks.
The latest version of the app is still rolling out so many users won't get updated if we target the latest with codepush. What do I do?
You have a couple options, check metrics for latest release:
Option 1 - if things look stable:
- Update the rollout in play store and app store to release the app to all users
- Send out your codepush update targeting the latest release as usual and users should get updated over the next few days
Option 2 - if things look unstable:
- Halt the rollout of the latest release
- Do a native hotfix release fixing instability and the issue being addressed