xcode Provisioning File not found with Jenkins

别来无恙 提交于 2019-12-11 02:22:18

问题


I have my xcodebuild running successfully through ant. If I ssh into the system and run the build, it works fine. However, when the same ant target is called via Jenkins (running as a slave on the mac), it fails with the classic

Code Sign error: a valid provisioning profile matching the application's Identifier 'xxx.xxx.xxx' could not be found" 

In trying to get it to work, I tried running it via a 'sudo ant' call, and of course, this causes the same error. The local user and root both echo the same $PATH, so that's not the issue. I don't see a way to change the environment or change the user Jenkins invokes ant is. There must be someone else that has solved this - any help would be appreciated.


回答1:


I ran into something like this - don't know if it's the same thing. But when you start Jenkins are you running it as a user or running as root? The first time I started out with Jenkins I was kicking it off by running sudo java -jar jenkins.war and I was getting the same Code Sign error. When I ran it without 'sudo' it worked fine. Not 100% sure why, though. Maybe it has something to do with the certificate only being associated with the user?




回答2:


I had something similar, but perhaps a little different. I could run xcodebuild from the command line and it would sign the app properly. However, in Jenkins I would get a error like:

[BEROR]Code Sign error: The identity 'iPhone Distribution' doesn't match any valid certificate/private key pair in the default keychain

It had worked fine, but something changed (I'm not sure what) and it stopped working. I tried a billion things, but ultimately fixed by copying the cert/key pair in Keychain Access into the 'System' keychain (it was previously just in the login keychain).

I'm running Xcode 4.2, which may be or may not be significant.

EDIT:

Found a solution for my problem: add the following to the top of your jenkins script:

security list-keychains -s /Users/[user]/Library/Keychains/login.keychain

The "-s" selects the keychain you want to use for this shell. Confusing that the argument to the security command is "list-keychains", but that's what it does...




回答3:


As a workaround, you could import the cert on the command line before you run xcode:

security import Cert.p12 -P password -k ~/Library/Keychains/login.keychain -A -T /usr/bin/codesign


来源:https://stackoverflow.com/questions/7243882/xcode-provisioning-file-not-found-with-jenkins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!