Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"ipa build" passes from the command line but fails on Jenkins (Shenzhen Xcode iOS app)

I am building a MyApp.ipa from MyApp.xcodeproj via commad line and the build is successfull. I am using the Shenzhen ruby gem to build the app from command line. However the build is failing in Jenkins with the following errors:

*** error: Couldn't codesign /Users/administrator/Library/Developer/Xcode/DerivedData///////MyApp.app/Frameworks/libswiftCore.dylib: codesign failed with exit code 1
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-stdlib-tool failed with exit code 1

** ARCHIVE FAILED **

The following build commands failed:

CopySwiftLibs /Users/administrator/Library/Developer/Xcode/DerivedData///////MyApp.app

I suspect the error is related to the project signing. Currently I am signing it via command line with XSigning and it builds successfully from the command line on the local MacOS machine. However when I am running the exact same commands via Jenkins it fails.

Please help.

like image 483
danR Avatar asked May 26 '15 13:05

danR


2 Answers

Assuming that your Jenkins build runs on the same machine that you tested through command line:

codesign requires the Provisioning Profiles to sign the IPA. By default, these are located here ~/Library/MobileDevice/Provisioning Profiles.

As you can see, the ~ is the user's home directory, i.e /Users/user_name_here/. The default permissions on that directory usually only allow access to that user only.

Jenkins runs by default as jenkins user. You need to make sure that your jenkins user has access to the directory where the provisioning profiles are. Or else, move the provisioning profiles to another location that jenkins user has access to, and modify your build tool to look for them there.

If your Jenkins master/slave node is not on the same Mac machine as you tested with command line, then you will have to manually copy the provisioning files to that machine too

like image 121
Slav Avatar answered Sep 29 '22 14:09

Slav


The best way to solve this: Move the certs/keys you're trying to sign with from "login" to "System" in Keychain Access. You won't need to keep unlocking the keychain.

like image 29
kmiles Avatar answered Sep 29 '22 14:09

kmiles