Jenkins/Xcode plugin for iOS project delivery

Posted on December 18, 2018

Most of this blog is discuss the errors and how I resolve the errors when I try iOS project Continuous Delivery with Jenkins. The brief steps are:

  1. Install Jenkins

  2. Install Xcode plugin on Jenkins

  3. New a ‘Freestyle project’ on Jenkins

  4. Jenkins project configuration

    • ‘Source Code Management’ on Jenkins
    • ‘Build’ setting on Jenkins
  5. Jenkins Project -> ‘Build Now’

Errors:

  • CodeSign error: Code signing is required for product type ‘Application’ in SDK ‘iOS x.x’

    I have stuck on this error for days and got it resolved by checking following configuration:

    1. For XCode, Check if the account you logged on Xcode has been bound Certificate and Provisioning profiles on Apple Developer. The option ‘Automatically manage signing’ was enabled on my project and it doesn’t cause any issue (XCode version: 10.1)

    2. For Fastlane, if the account was verified as #1, there won’t be any issue.

    3. For Jenkins, I prefer to enable ‘Import developer profile’ option before run build with Xcode Plugin. Actually, the steps about how to upload the profile to Jenkins has been described in details on XCode Plugin page:

      This plugin builds on top of Credentials Plugin to allow you to store your Apple Developer Profile (*.developerprofile) file. This file contains a code signing private key, corresponding developer/distribution certificates, and mobile provisioning profiles. You can create this file from your XCode. To upload the developer profile into Jenkins, go to “Manage Credentials” in the system configuration page, and select “Apple Developer Profile” from the “Add” button. To use this profile for signing, add “Import developer profile” as a build step before you run Xcode, and select the developer profile to import into the build machine. This build step will install the developer profile into the slave’s keychain.

      Screenshots about Apple Developer Profile Export:

      XCode-Export Apple Developer Profile-1
      XCode-Export Apple Developer Profile-1
      XCode-Export Apple Developer Profile-2
      XCode-Export Apple Developer Profile-2
      XCode-Export Apple Developer Profile-3
      XCode-Export Apple Developer Profile-3

      Screenshot about Apple Developer Profile Import:

      XCode-Export Jenkins-Import Apple Developer Profile-1
      XCode-Export Jenkins-Import Apple Developer Profile-1
      XCode-Export Jenkins-Import Apple Developer Profile-2
      XCode-Export Jenkins-Import Apple Developer Profile-2
      XCode-Export Jenkins-Import Apple Developer Profile-3
      XCode-Export Jenkins-Import Apple Developer Profile-3
    4. For Jenkins/Xcode plugin, make sure the ‘Scheme’ or the ‘Target’ was defined properly.

      Two schedules were defined in my project: one for real devices and another for the simulator.

      Jenkins/Xcode plugin-Scheme
      Jenkins/Xcode plugin-Scheme

      Scheme names also can be found by the command: ‘xcodebuild -list’

      xcodebuild -list
      xcodebuild -list
  • Target ‘xxx’ (project ‘xxx’) has copy command from file_location1 to file_location2

Refer to the question on StackOverflow, the issue can be resolved by changing Build System to ‘Legacy Build System’

xcode build system
xcode build system
build option of xcode plugin
build option of xcode plugin

Note: I prefer “Jenkins Credential” than “Keychains and Provisioning Profiles Plugin” because the comment: ‘This plugin exposes the keychain passwords in the Compare Environment section.’ from Henry Yei.


Jenkins/Xcode plugin for iOS project delivery


donation

Scan the QR code using WeChat

comments powered by Disqus