Jenkins: Command /usr/bin/codesign failed with exi

2019-05-23 12:16发布

I am able to archive ios project using below commands

cordova build ios --device --debug

and

cordova build ios --device --release

But when i try to do same from jenkins i am getting below error.

11:08:01 SecKey API returned: -25308, (null)/Users/Jenkins/Library/Developer/Xcode/DerivedData/GRC_Pulse-ebufuetkmalmfxbiegclmzuryhrm/Build/Intermediates/ArchiveIntermediates/GRC Pulse/InstallationBuildProductsLocation/Applications/GRC Pulse.app: unknown error -1=ffffffffffffffff
11:08:01 Command /usr/bin/codesign failed with exit code 1
11:08:01 
11:08:01 ** ARCHIVE FAILED **
11:08:01 
11:08:01 
11:08:01 The following build commands failed:
11:08:01    CodeSign /Users/Jenkins/Library/Developer/Xcode/DerivedData/GRC_Pulse-ebufuetkmalmfxbiegclmzuryhrm/Build/Intermediates/ArchiveIntermediates/GRC\ Pulse/InstallationBuildProductsLocation/Applications/GRC\ Pulse.app
11:08:01 (1 failure)
11:08:01 Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/Jenkins/projects/grc-pulse-hybrid-custom/platforms/ios/cordova/build-debug.xcconfig,-workspace,GRC Pulse.xcworkspace,-scheme,GRC Pulse,-configuration,Debug,-destination,generic/platform=iOS,-archivePath,GRC Pulse.xcarchive,archive,CONFIGURATION_BUILD_DIR=/Users/Jenkins/projects/grc-pulse-hybrid-custom/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/Jenkins/projects/grc-pulse-hybrid-custom/platforms/ios/build/sharedpch

3条回答
闹够了就滚
2楼-- · 2019-05-23 13:11

I am going to chip in as well as I had to try a few more things than the ones mentioned here: the problem (for me) was that keychain doesn't like SSH sessions. I had to execute these in my session to fix it:

security unlock-keychain -p MY_PASS ~/Library/Keychains/login.keychain
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k MY_PASS ~/Library/Keychains/login.keychain
security set-keychain-settings ~/Library/Keychains/login.keychain

I've also removed my current certificates system/account certificates by removing my account from XCode (I use fastlane to do building) but I suspect that this shouldn't have impacted it.

This is now my third post about this or so but I sure hope it is going to help to save 8h of work for somebody...

查看更多
▲ chillily
3楼-- · 2019-05-23 13:16

You should unlock your keychain before running the command when using ssh (connection from the master to a slave)

security unlock-keychain -p "" ${keychain}

Take a look on this link for more details

查看更多
▲ chillily
4楼-- · 2019-05-23 13:16

I had this error with Xcode 8.3:

unknown error -1=ffffffffffffffff
Command /usr/bin/codesign failed with exit code 1

** ARCHIVE FAILED **

And

security unlock-keychain -p "mypass" ${mykeychain}

solved it, too.

查看更多
登录 后发表回答