iOS 只有 Jenkins 的代码签名失败

iOS Code Signing Fails Only For Jenkins

我正在尝试从 Jenkins 构建构建 Xamarin Touch 项目,它在代码签名阶段失败。

我的证书和密钥在系统钥匙串中,因此 Jenkins 应该可以访问。我在构建项目时没有代码签名问题:

唯一一次看到代码签名问题是在 Jenkins 构建自身时。

错误是 "User interaction is not allowed",当我 运行 来自shell.

您可以尝试在 Jenkins 凭据区域导入您的凭据。

来自 here:

Allowing Jenkins to stage developer profile This plugin builds on top of Credentials Plugin to allow you to store your Apple Developer Profile (*.developerprofile) file. This file contains a code signing private key, corresponding developer/distribution certificates, and mobile provisioning profiles. You can create this file from your XCode.

To upload the developer profile into Jenkins, go to "Manage Credentials" in the system configuration page, and select "Apple Developer Profile" from the "Add" button. See Credentials Plugin for further details.

To use this profile for signing, add "Import developer profile" as a build step before you run xcode, and select the developer profile to import into the build machine. This build step will install the developer profile into the slave's keychain.

原来我的问题是我的代码签名密钥仍然在登录钥匙串和系统钥匙串中。

我猜这意味着构建首先看到了登录钥匙串中的钥匙,但后来失败了,因为它没有解锁。

一旦我将它们从登录钥匙串中删除,它们就只存在于系统钥匙串中,它就开始工作了。

我仍然不确定为什么这只是 Jenkins 内部的问题,因为使用 shell 以 Jenkins 身份登录时一切正常。