End to End CI/CD pipeline Setup with Azure DevOps for Mobile App: IOS — Part1.

Sandeep Rajbhar
6 min readDec 10, 2021

Why I am writing this article?

For one of the clients, I wanted to set up a CI/CD pipeline automation for a Mobile app for both IOS and Android for react native app. I faced some of the issues between setting up the pipeline. So I thought to write the article for all of you to not only set up the Pipeline but also get inside and understand common errors and logs. So there is a total of 5 parts in this series and we will go one by one.

Once you will finish all these steps you will be a MASTER of CICD azure DevOps setup for Mobile apps. Thanks, me later :D.

Please follow these steps to create CI/CD pipeline for react native iOS app on Azure DevOps. This will help to auto-create an IPA and deploy the app on TestFlight.

Prerequisite

  • The developer has basic knowledge of deploying an app to the app store manually.
  • Organization and project already created a user have the access to the project.
  • The app is already created on the app store with all the configurations needed to upload the build.
  • The first version of the app has been already uploaded to the app store and the tester can test it via test flight.
  • The P12 file and provision profile are already available as per bundle ID.
  • Apple account credential and access as Admin.
  1. Go to project -> Select pipeline -> New pipeline -> Select “Use the classical editor”

2. Select Azure repo git -> Repo -> Branch -> Continue.

3. Search for XCode and select

4. Above step will create a default Pipeline with some jobs. We need only a few jobs out of that as per our requirement and delete the other job. Also, add one more job as “Apple app store release” we will use this to deploy the app to TestFlight.

5. Select the “Get Sources” and do the setup as mentioned in the below screenshot. A select branch from where you want to create a build.

6. Create Agent and give some names. Select the macOS as we will create an IPA file and build the code on the agent machine.

7. Install an apple certificate. We are assuming the developer already has a p12 certificate and provisioning profile.

a) Select the “Install apple certificate”.

b) Go to Library -> Secure file -> Add p12 and provisioning file in the secure file tab. We need to add a different PP for different app/bundle ID to have multiple apps.

c) Select the added p12 file.

d) Go to Variables tab in Pipeline -> Select Pipeline variables-> add “P12password” variable and assign value of password of file -> Mention name of p12 file password as “$(P12password)” in ‘Certificate (P12) password’. -> Enable control option.

8. Install an Apple provisioning profile -> Select PP added in the previous step inside files. -> Enable control option.

9. XCode Build -> Select all the options as mentioned below screenshot. Few options are already provided by the job. This will create an IPA file.

a)

  • $(Configuration) is a dynamic variable we need to add value in a variable tab like “Release” or “UAT_QualityGateTest.Release” which should have exact same name of configuration created in XCode.( As of now for POC we have created two configurations with scheme names “QualityGateTest” relate to the master branch and “UAT_QualityGateTest” relate to UAT).
  • Change the scheme name as per the associated configuration name.
  • Add SDK variable in variable tab with value “iphoneos”. Which will be part of the folder structure when IPA will create.

b)

10. Copy Files to: $(build.artifactstagingdirectory) -> Most are default option keep as it is.

11. Publish Artifact: drop -> Select all the options as mentioned in the below screenshot. Most are default options keep as it is.

12. Publish to the App Store TestFlight track (Directly from the Pipeline by adding Job)

a. Select the Username and password as the authentication method and provide detail -> Must select the Two-Factor authentication.

b. Create app specific password -> Go to https://appleid.apple.com/account/manage -> Login with apple ID -> Create app specific password. -> Store that into Pipeline variable (like step 7.d) by name of “FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD”

c. Create Fastlane Session for Two-step Verification -> Go to terminal -> run cmd “fastlane spaceauth -u [email]” and input the required detail.-> Copy the session -> link to the option “Create Fastlane Session for Two-step”.

d. Select the rest of the options as per the below screenshot.

13. Final configuration of the pipeline.

14. Change the version number or build number in the XCode project and commit to the branch. Run the pipeline.

15. The final successful pipeline should look like this.

16. Final successful Appstore upload of IPA will look like this.

NOTE:

  • This Part1 is for learning and understanding the basic configuration on the Azure pipeline for the IOS app. Further, we will use the YAML file to create a build as per branch trigger and release pipeline to handle dynamic builds. This we will cover in the build strategy article in further parts.
  • We can autorun the pipeline by setting an option in the trigger tab of Pipeline but as of now, this is for manual CI/CD with a single branch. For multiple branches and auto-trigger, we will cover that in-branch strategy article.

Wait for the next article on “End to End CI/CD pipeline Setup with Azure DevOps for Mobile App: Android— Part2”

Thanks so much, guys!!!!

--

--