Skip to content
CodeOnAir
Docs menu

Releases, rollouts & rollbacks explained

What happens on users' phones when you release, roll out, make mandatory, disable or roll back a CodePush update — explained with examples.

The CLI commands are short, but each one changes what thousands of phones do on their next launch. This page explains the ideas behind them in plain words, so you can pick the right one with confidence — especially on a bad day.

What a release is#

A release is one version of your JavaScript bundle (plus its images) that you've uploaded to a deployment. When you run release-react, the CLI builds the same bundle your app would ship in the store, zips it, and uploads it. The server gives it the next label — v1, v2, v3 — and from that moment, phones that check for updates can receive it.

Nothing is pushed to phones. Each phone asks when your app starts (that's what CodePush.sync() does): “I'm running app version 1.0 with bundle v4 — is there anything newer for me?” The server answers with the newest enabled release that fits that phone, or “no update”.

Releases are never edited into something else. If v7 has a bug, you don't change v7 — you release v8 (a fix) or roll back (which also creates a new label). This keeps the history honest: the dashboard always shows exactly what each phone could have received.

Target binary version: who can get it#

Your JavaScript only works with the native code it was built against. If version 1.1 of your app added a native camera module, a bundle that uses it would crash on a phone still running 1.0. So every release says which app versions (the store version — versionName on Android, CFBundleShortVersionString on iOS) it's for.

An example

Half your users are on 1.0 and half have updated to 1.1 from the store. You fix a typo that exists in both. You release twice:

CommandWho gets it
release-react shop-android -t 1.0Only phones on app version 1.0.
release-react shop-android -t 1.1Only phones on 1.1.
release-react shop-android -t 1.xAny 1.something — fine only if the bundle works on all of them.
release-react shop-android -t *Every version. Rarely safe once your native code changes.

Once released, a release's target is fixed. Phones on other versions may already have been told “no update”, and changing the target later would surprise them. To reach another version, release again with a new -t.

Tip
When you ship a new store version, its users start fresh on the bundle inside that build. Older CodePush releases don't follow them.

Optional and mandatory#

Every release is either optional (the default) or mandatory. The difference is only when the phone switches to it, which you choose in CodePush.sync():

Optional releaseMandatory release
Usual settinginstallMode: ON_NEXT_RESTARTmandatoryInstallMode: IMMEDIATE
What the user seesNothing now. The next time they open the app, it's new.The app reloads within seconds of opening, on the new bundle.
Use it forCopy, layout, small fixes.Crashes, broken payments, security fixes.

A phone that missed a mandatory release (it was offline, say) and later receives a newer optional one treats that one as mandatory too — so it can't skip past an urgent fix.

Rollout: releasing to some phones first#

A rollout is the share of phones allowed to receive a release. With --rollout 20, about one in five phones gets v8; the rest are told there's no update and stay on v7. Each phone has a random install id, and the same phone always lands on the same side — so raising 20% to 50% adds new phones without flipping anyone back and forth.

  1. Release with --rollout 20.
  2. Watch the build's page in the dashboard for a few hours: downloads, installs and — most important — rollbacks.
  3. All good? patch shop-android --rollout 100. Something wrong? Disable it or roll back (below) before most users ever see it.
Note
A rollout can only grow. Phones that already installed the update keep it, so lowering the number wouldn't take it back from them.

Disable: pausing a release#

Disabling a release stops it being offered. Phones that haven't downloaded it yet get the previous enabled release instead. Phones that already run it keep running it — disabling isn't an undo. Use it to pause while you look into a problem, or to upload a release early (--disabled) and switch it on later.

Rollback: going back for everyone#

A rollback brings back an earlier bundle for every phone, including the ones already running the bad one. It doesn't delete anything: it creates a new release (say v9) that contains the bundle of v7. On their next check, phones on v8 see “v9 is newer” and download it — which is really v7's code. Phones that never left v7 see they already have that bundle and do nothing.

Phone was onAfter rollback of v8 (creates v9 = v7's bundle)
v8 (the bad one)Downloads v9 on the next check and moves back to v7's code.
v7Already has that bundle — nothing to download.
The store bundle (never updated)Gets v9 like any new release, if it's in the rollout.

Automatic rollback when an update crashes#

You don't have to catch every crash yourself. When a phone starts a new update for the first time, CodePush marks it “unconfirmed”. As soon as your app calls CodePush.sync() (or notifyAppReady()), the update is confirmed. If the app crashes or is killed before that — on the very first run — the next launch:

  1. goes back to the bundle it ran before the update,
  2. remembers that update as failed on this phone, so it's never offered to it again,
  3. reports the failure to the dashboard — the build's page shows it under rollbacks.

That's why sync() must run early, on every launch, from your root component: a sync buried in a screen the user might not open would leave a good update unconfirmed and roll it back by mistake.

The life of an update on one phone#

Step 1
Check
App starts → sync() asks: anything newer for app version 1.0?
Step 2
Download
v8 is downloaded, its SHA-256 checked, unpacked. It's now pending.
Step 3
Switch
Next start (or right away if mandatory) the app runs v8 — unconfirmed.
Step 4
Confirm
sync() runs → v8 is confirmed and reported as installed.

A week with CodePush#

Monday. You ship app version 2.0 to the stores. Users who update start on the bundle inside 2.0. Nothing to release yet.

Tuesday. A product name is misspelled. release-react shop-android -t 2.0 -d "Fix product name" → v1, optional. Over the day, people open the app, download v1 in the background and see the fix the next time they open it.

Wednesday. Checkout crashes for some users. You fix it and release with --mandatory --rollout 20 → v2. One in five phones reloads into the fix within seconds of opening the app. The build page shows installs climbing and zero rollbacks.

Wednesday, an hour later. patch shop-android --rollout 100. Everyone gets v2.

Thursday. v3, a redesign of the home screen, goes out to everyone — and the dashboard shows rollbacks from older Android phones. You run rollback shop-android → v4, which carries v2's bundle. Phones on v3 move back on their next launch; phones that crashed already went back on their own and won't be offered v3 again.

Friday. You fix the home screen and release v5. Phones that failed v3 still get v5 — it's a different update.

Stuck? Write to support@codeonair.com with your App ID and what you tried — we reply within a working day.