我正在尝试使用Jenkins构建Xcode项目。 Unity Engine生成的Xcode项目。 我可以直接从Xcode GUI构建该项目,但是当尝试通过Jenkins构建项目时,在构建结束时出现以下错误:
Signing Identity: "iPhone Developer: MyName MySurname (XXXXXXXXXX)"
Provisioning Profile: "iOS Team Provisioning Profile: *"
(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX)
/usr/bin/codesign --force --sign 37DF6AF254E5A4856B1BA024D199DEE3CE596A58 --entitlements /Users/Shared/Jenkins/Home/workspace/Xcode_Input/build/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/myapplication.app.xcent --timestamp=none /Users/Shared/Jenkins/Home/workspace/Xcode_Input/build/Release-iphoneos/myapplication.app
/Users/Shared/Jenkins/Home/workspace/Xcode_Input/build/Release-iphoneos/myapplication.app: errSecInternalComponent
Command CodeSign failed with a nonzero exit code
** BUILD FAILED **
The following build commands failed:
CodeSign /Users/Shared/Jenkins/Home/workspace/Xcode_Input/build/Release-iphoneos/myapplication.app
(1 failure)
Build step 'Xcode' marked build as failure
Finished: FAILURE
我试图在终端中重现以下命令,并且它运行正常,没有任何错误:
/usr/bin/codesign --force --sign 37DF6AF254E5A4856B1BA024D199DEE3CE596A58 --entitlements /Users/Shared/Jenkins/Home/workspace/Xcode_Input/build/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/myapplication.app.xcent --timestamp=none /Users/Shared/Jenkins/Home/workspace/Xcode_Input/build/Release-iphoneos/myapplication.app
它要求我输入两次密码(和Xen的Jenkins作业设置中指定的密码相同),并且输入正确无误。
我用来签署项目的钥匙串已通过security unlock-keychain login.keychain
问题是-遵循行为的原因可能是什么?我该如何解决这个问题?
谢谢!
答案 0 :(得分:0)
Jenkins正在通过SSH进入包装盒,但未获得对您的钥匙串的访问权限。 Jenkins需要在执行构建之前解锁钥匙串。看来您已经了解如何通过密码提示解锁钥匙串。您需要让詹金斯(Jenkins)在没有提示的情况下执行解锁。
让Jenkins在生成命令之前运行以下命令:
makeActiveBinding()
如果您不想将密码存储在构建的明文脚本区域中,则Jenkins提供了多种存储秘密并将其作为变量检索的方法。这是一个不错的文章:https://support.cloudbees.com/hc/en-us/articles/203802500-Injecting-Secrets-into-Jenkins-Build-Jobs
或者:
security unlock-keychain -p <YourPassword> ~/Library/Keychains/login.keychain