通过Jenkins 远程在Mac机器上重签名的时候,提示以下错误:

/usr/bin/codesign --force --sign 09E4B7713C237A7B047C8BD112B75802F8F925D5 --resource-rules=/Users/solomo/workspace/workspace/xx.app/ResourceRules.plist --entitlements /Users/solomo/Library/Developer/Xcode/DerivedData/LeFeng-hetkaoqrwbtfuofgjrqfxscgajma/Build/Intermediates/LeFeng.build/Release-iphoneos/LeFeng.build/LeFeng.app.xcent /Users/solomo/workspace/workspace/xx.app Warning: --resource-rules has been deprecated in Mac OS X >= 10.10! CSSM_SignData returned: 8001094A /Users/solomo/workspace/workspace/xx.app: errSecInternalComponent Command /usr/bin/codesign failed with exit code 1

BUILD FAILED

The following build commands failed: CodeSign /Users/solomo/workspace/workspace/xxx.app (1 failure) Build step 'Xcode' marked build as failure Finished: FAILURE

出现这个问题的主要原因是是Jenkins,以ssh方式到slave机上,默认是没有账户的,但是访问钥匙串要求必须有用户身份,

解决办法

添加一步输入密码解锁钥匙串,可以给Jenkins一个用户身份。 build步骤前添加一步解锁钥匙串。

security unlock-keychain -p "login pwd" ~/Library/Keychains/login.keychain