[不是下面解释的类似问题的重复]
从 Jenkins 中运行 XCodeBuild 时出现代码签名错误,但它可以从命令行或 Xcode 中构建。
过去有几个人遇到过这个问题,他们的共同主题是 Jenkins 在启动时作为守护程序用户运行,因此尝试访问系统钥匙串(keychain)。
人们应用的解决方案是将凭据复制到系统钥匙串(keychain)或运行命令来设置要使用的钥匙串(keychain)。
但是在我的情况下,如果我在事件管理器中查看launchd,则用户显示为我登录到机器的用户,因此Jenkins应该以该用户而不是守护程序用户身份运行。
我尝试通过在运行 XCodeBuild 之前将此命令添加到 Jenkins 脚本来设置要使用的钥匙串(keychain)
security list-keychains -s /Users/[user]/Library/Keychains/login.keychain
但这并没有解决问题。
我得到的错误是:
Code Sign error: The identity 'iPhone Developer: NNNNN (9TYX5WAM63)' doesn't match any valid, non-expired certificate/private key pair in your keychains"
因此,我尝试将凭据移至系统钥匙串(keychain),但现在在 Jenkins 中出现此错误,但从命令行仍然可以:
Code Sign error: Provisioning profile 'F152C66E-B99A-47F6-B262-376CE4403D71' can't be found
此外,当我将凭据移动到系统钥匙串(keychain)时,我不再能够从 XCOde 中构建 - 我收到与上面最上面的错误消息相同的错误。
我还尝试编辑 org.jenkins-ci.plist 文件以将用户设置为我登录到机器的用户,按照这个,但这也没有效果。
Missing certificates and keys in the keychain while using Jenkins/Hudson as Continuous Integration for iOS and Mac development
有什么想法我可以尝试下一步吗?
最佳答案
按照 Xcode Plugin home page 上的说明进行操作:
If this prompt is not showing on the build machine, you can force it to appear by running the codesign command that failed from a terminal on the build machine: /usr/bin/codesign --force --sign "iPhone Distribution: .....
以 Jenkins 用户身份从终端执行失败的签名命令并选择“始终允许”
关于xcode - 在 Jenkins 中运行 XCodeBuild 的代码签名错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13614657/