React Native DevOps Guide

The comprehensive guide to create build, test, and release flows for React Native, with Jenkins and Fastlane automation. JavaScript and Shell used as the ‘glue’ between Jenkins, Fastlane, and the Jenkins agent.

Tyler Pate
3 min readSep 17, 2018

Content

Part 1: Setting up a Jenkins agent
Part 2: Minimizing build failures
Part 3: Running iOS builds
Part 4: Running Android builds

Coming Soon:
Part 5:
Getting the most out of your Jenkins agent
Part 6: Running CodePush deployments
Part 7: Testing: Simulator, Device, Integration

Jenkins artwork by Ksenia Nenashevahttps://jenkins.io/

Introduction

Anyone who has released a React Native project knows that development is fast paced and fun, while devops is time consuming, error prone, and challenging to get right. React Native (RN) development is very young compared to native app development. Couple RN’s youth with 4 week release cycles, fluctuating infrastructure requirements, and 3rd party dependency management — there are a lot of places outside of JavaScript land where developers can introduce bugs.

I’ve spent the last two years of my life totally invested in React Native (RN) as the Lead Mobile Engineer at Earn.com. Through that time, I have run countless number of React Native builds, tests, and deployments. I’ve approached the devops problem in a number of ways, but the best and most consistent approach I have found is using Jenkins and Fastlane, with JS and Shell scripts to glue the system together.

This guide encompasses the majority of devops knowledge I obtained building and releasing the Earn.com mobile app.

What are we building?

Here’s the high level flow diagram for the entire system. Each part of the tutorial will address a portion of the system diagram below.

React Native DevOps System Diagram

What to expect

Each section is broken down into two parts — concepts and walkthrough.

  • Concepts break down the thought process and approach for design decisions that are seen in the walkthrough.
  • Walkthroughs have step-by-step instructions and companion code.

Prerequisites

The series assumes you have access to the following.

  • A RN app to work with
  • Familiarity with RN deployments
  • Jenkins master, permissions to add agents, change jobs
  • GitHub repository, permissions to add new users to the repo

If you do not have all of these in place, don’t worry! There are always alternate paths to achieving an objective. In these cases, the walkthrough section of each tutorial may not match your configuration. Concepts presented will hold true for many different configurations.

If you work for a smaller company or freelance, you may not have access to an Jenkins master. In this case, it is acceptable to use the dedicated agent hardware to run a Jenkins master instance.

Setting up a Jenkins master is outside the scope of this series, so refer to the Jenkins documentation to get started. Jenkins Best Practices includes a note on executing jobs on the master node.

On to Part 1: Setting up a Jenkins agent!

--

--

Tyler Pate

Former Lead Mobile Developer @ Earn.com, acquired by Coinbase. Stuff I love: React Native, DevOps, JS, 3D Printing, Skiing, Motorcycles, Music