简体   繁体   中英

“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.

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, ie /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

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.

I'm suspecting that there is some problem with your $path or another environment variable (which is a common problem, looking like yours).

Jenkins executes its jobs in a "clean" environment (whithout any environment variable).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM