Azure Pipelines hates when Expo dates Firebase

Azure Pipelines hates when Expo dates Firebase

The Problem

I am not even sure how to start on this article, but I would say that Azure hates when Expo start dating Firebase. What do I mean by this. Few days ago i have written an article about implementing Firebase Push Notifications in Expo app, and that all went fine, until I have tried building the app with the Azure Pipelines, and 55 builds later, and 3 days with no sleep, here I am writing this article so you won't have to go to the same hell as me.

The thing is that once you install react-native-firebase/app or react-native-firebase/messaging and try to build the app on azure, it will start giving you the error code:65, which basically means, there is some issue with signing the app, and no matter what you try, nothing will work, at least I didn't find a way to make the xCode@5 task work, manual signing, no sign, auto, export, every possible combination with the parameters, it just throws the error code:65 in less then 60 seconds after the task has started, but with the same configuration locally everything works fine (talking about iOS, Android is fine)

I went that far that I have literally replicated the entire Azure machine on my local machine, installed the same version of macOS, xCode, cocoapods, node, removed all the certificates from keychain and just install the p12 I am providing to Azure via the Secret Files, even publishing the entire repo after the task fails, and trying to build it locally, still nothing.

The Solution

After 3 days of trouble, and not entire understanding of the problem, I got the pipelines work again. The problem as I understood, because of how the xCode@5 task works behind the hood, it causes come issue when you "try to sign the firebase part of the code", and to solve it, you have to build the app with the good old scripts, and use the "xcodebuild".

When you build the app, you need to build it with "CODE_SIGNING_ALLOWED=NO", and archive the build, which will produce an xcarchive file, and with another script you will export IPA from that file, and for the export of the IPA you will need to create ExportOptions.plist file in the root of your repo, where you will configure the signing of the app.

Lets first start with the ExportOptions.plist, and it should looks something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>method</key>
  <string>development</string>
  <key>provisioningProfiles</key>
  <dict>
    <key>BUNDLE_ID</key>
    <string>PROVISION_PROFILE_NAME</string>
  </dict>
  <key>signingStyle</key>
  <string>manual</string>
  <key>teamID</key>
  <string>TEAM_ID</string>
  <key>compileBitcode</key>
  <false/>
</dict>
</plist>        

where:

BUNDLE_ID - the bundle ID of your app (Ex. com.myapp.app)
PROVISION_PROFILE_NAME - the name of the Provision Profile, you can fine it on the Apple Developer website, open the Provision Profile, and there is Name field.
TEAM_ID - your Apple Developer Team ID, which you can also fine in the Membership Details inside the Apple Developer website.        

Next lest see the first new script about building the App:

- script: |
        xcodebuild -workspace ios/WORKSPACE_NAME \
          -scheme SCHEME_NAME \
          -sdk iphoneos \
          -configuration Release \
          -archivePath output/XCARCHIVE_FILE \
          CODE_SIGN_IDENTITY="iPhone Developer" \
          PROVISIONING_PROFILE_SPECIFIER="PROVISION_PROFILE_NAME" \
          CODE_SIGNING_ALLOWED=NO \
          clean archive
      displayName: "Build iOS App with Xcode"        

where:

WORKSPACE_NAME - is the workspace file inside the ios folder (ex. myApp.workspace)
SCHEME_NAME - the name of the schema of the ios project
XCARCHIVE_FILE - the name of the xcarchive file that this script will output (ex. myApp.xcarchive)
PROVISION_PROFILE_NAME - the name of the Provision Profile, you can fine it on the Apple Developer website, open the Provision Profile, and there is Name field.        

The next one is Exporting the IPA:

- script: |
        ARCHIVE_PATH=output/XCARCHIVE_FILE
        EXPORT_PATH=output
        EXPORT_OPTIONS_PLIST=EXPORT_OPTIONS_PLIST

        # Export IPA from .xcarchive
        xcodebuild -exportArchive \
          -archivePath $ARCHIVE_PATH \
          -exportPath $EXPORT_PATH \
          -exportOptionsPlist $EXPORT_OPTIONS_PLIST
      displayName: "Export IPA from Archive"        

Where:

XCARCHIVE_FILE - the name of the xcarchive file that this script will output (ex. myApp.xcarchive)
EXPORT_OPTIONS_PLIST - the name of the export options plist we have created (ex. ExportOptions.plist)        

to play it safe, before i run the first script, i am cleaning and reinstalling the cocoa pods, I am not sure if this is needed, but from all the things i have tried, this was one of them, it didn't help to get rid of the error code:65, but it didn't cause any harm, so I have forgot to remove it, and not when i have everything working, i don't want to wait 1 more hours for another build to see if removing this will break the pipelines, so here it is (it takes 60 seconds to run, so its not a big deal for me):

- script: |
        pod deintegrate
        pod clean
        pod install
      workingDirectory: 'ios'
      displayName: 'Clean and Reinstall Pods'        
JUST BE AWARE, AFTER FIXING THE BUILD, THE PUSH NOTIFICATIONS WONT WORK, AND TO MAKE THEM WORK YOU NEED TO BUILD THE APP LOCALLY, SO THIS IS JUST TO BE STILL ABLE TO USE AZURE PIPELINES.
Jay Patel

Student at Dalia institute

4 个月

Hello , I am laravel developer and I have 3 years of experience . Have any vacancy in php - laravel developer? My contacts/ whatsapp is 9879185478.

要查看或添加评论,请登录

Nikola Gorgiev的更多文章

  • Предновогодишен Подарок

    Предновогодишен Подарок

    Полека се ближи кра?от на оваа 2024та година, ко?а за разлика од тие што беа за време на Корона пандеми?а помина многу…

  • DevHelper 2 is here

    DevHelper 2 is here

    Four years ago, I have shared my work on the first version of the DevHelper here on Linked in, and back-then I was so…

  • Expo + Firebase Push Notifications

    Expo + Firebase Push Notifications

    Here we are with another text, this time related to Push Notifications, and integrating the Firebase Push Notifications…

    1 条评论
  • React Native/Expo Azure Pipelines

    React Native/Expo Azure Pipelines

    Some time ago, while I was working on another project with React Native (CLI not Expo), I have written few articles…

  • Како да опстанете во ИТ на долг рок?

    Како да опстанете во ИТ на долг рок?

    После краток период решив повторно да пишувам на една тема, ко?а мислам ?е е доста интересна за чита?е, и претставува…

  • Искуство од првите 10 години во ИТ

    Искуство од првите 10 години во ИТ

    SmileyTech. Пред 10 години и месец дена, офици?ално ?а започнав сво?ата ИТ кариера.

    6 条评论
  • Како до прва работа во ИТ

    Како до прва работа во ИТ

    Во ово? текст ?е пробам со моето искуство да споделам некои совети за оние ко? за прв пат ги креваат едрата во ИТ…

  • Како да успеете во ИТ?

    Како да успеете во ИТ?

    #sharingknowledge #sharingiscaring Вовед Пред да започнам да го пишувам ово? текст, некое време размислував каков да…

    3 条评论
  • Plans for 2024 and 2023 Recap

    Plans for 2024 and 2023 Recap

    Plans for 2024 Полека ?а испративме 2023та и ?а дочекавме новата 2024та. Ко и секо?а година и за оваа решив да направам…

    1 条评论
  • React Native for React Developers [Part 10: Push Notifications: Android]

    React Native for React Developers [Part 10: Push Notifications: Android]

    #reactnative #pushnotifications #sharingiscaring #KinCarta #WorkingBetter #ForEveryone Android Setup For the Android…

社区洞察

其他会员也浏览了