Xcode,来自 Jenkins/SSH 的代码设计错误 - “不允许用户交互"
我正在尝试在 Jenkins 上运行自动 xcodebuild,但我遇到了错误
I am trying to run an automated xcodebuild on Jenkins, but I am running into the error
不允许用户交互.命令/usr/bin/codesign 失败,退出代码为 1
我已经参考了不允许用户交互"尝试使用 codesign 和其他类似线程对 OSX 应用进行签名,但似乎没有任何解决方案能够正确纠正错误.
I have already referenced "User interaction is not allowed" trying to sign an OSX app using codesign and other similar threads, but none of the solutions seem to properly remedy the error.
这是我已经尝试过的:
我已允许所有项目访问钥匙串,并且我已将代码特别添加到始终允许"列表中(如此处https://stackoverflow.com/a/22637896)
我已经通过钥匙串访问的设置和命令将钥匙串设置为不自动锁定超时
I have set the keychain to not automatically lock with a timeout, both through Keychain Access's settings, and through the command
security set-keychain-settings -t 3600 -l <KEYCHAIN>
我试过打电话
I have tried calling
codesign --sign <CODE SIGN IDENTITY> --force ...
在项目编译之前(更具体地说,这个解决方案https://stackoverflow.com/a/20208104),尽管这成功地构建了项目,但我不认为编译前的协同设计是正确或可靠的.(从 jenkins 运行时这也失败了)
before the project compiles (more specifically, this solution https://stackoverflow.com/a/20208104), and although this successfully builds the project I don't think that codesigning before compiling is correct or reliable. (edit: this also failed when run from jenkins)
这是我正在执行的命令:
security unlock-keychain -p <PASSWORD> <KEYCHAIN>
xcodebuild -scheme <SCHEME> -workspace <WORKSPACE> -derivedDataPath <BUILD DIRECTORY> -configuration <CONFIGURATION> "CONFIGURATION_BUILD_DIR=<BUILD DIRECTORY>" "CODE_SIGN_IDENTITY=<CODE SIGN ID>" "PROVISIONING_PROFILE=<PROVISIONING PROFILE>" clean build
值得注意的是,在机器上构建项目可以使用上述命令,但尝试通过 ssh(和 jenkins)运行完全相同的命令会导致错误.
Something interesting to note is that building the project on the machine works with the commands above, but trying to run the exact same commands over ssh (and jenkins) causes the error.
提前感谢您的帮助!
以防万一有人错过了.链接问题中的答案解决了该问题.基本上你需要运行 security -v unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN"
.我在构建和协同设计成功之前运行它.
Just in case anyone missed it. The answer in the linked question resolves the issue. Basically you need to run security -v unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN"
. I run this before the build and the codesign succeeds.