xcode - 在 Jenkins 中运行 XCodeBuild 的代码签名错误

标签 xcode jenkins xcodebuild

[不是下面解释的类似问题的重复]

从 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/

相关文章:

ios - iOS Storyboard中按钮的大小相同

docker - 如何将 jenkins 管道作业链接到 docker 从属容器上的标签

iphone - 如何在 Xcode 中暂时禁用运行脚本阶段

c - "Programming Pearls": conflicting types for qsort

xcode - 如何在 Mac OS X 上获取内存泄漏的行号堆栈跟踪?

groovy - 当节点离线时 Jenkins 快速失败

groovy - Jenkins矩阵项目组合过滤器——如何配置groovy表达式?

ios - 无法为 Cordova iOS App 生成发布版本

ios - 将 CommmonCrypto 库导入 Swift 项目

ios - UILocalNotification 声音不在设备上播放