Jenkins: where is the login.keychain file in /Users/*name*/Library/Keychains folder?

Chipmuck picture Chipmuck · Jan 16, 2017 · Viewed 9.5k times · Source

I am trying to packaging an iOS ipa with Jenkins. So I get Keychains and Provisioning Profiles Management plugin and try to upload keychain which it needs. My Mac operating system is sierra(10.12.2), I enter the folder at /Users/admin/Library/Keychains. But there is only a file called login.keychain-db and it's doesn't work when I have uploaded this file on Jenkins. The error says that uploaded file "login.keychain-db" is no keychain or provisioning profile file. So how can I solve it or where can I find login.keychain file? Thanks in advance.

Answer

Tanguy G. picture Tanguy G. · Feb 21, 2017

You can simply unlock your keychain through shell. In your Jenkins project configuration, add an 'execute a script shell' step :

security unlock-keychain -p PASSWORD ${HOME}/Library/Keychains/login.keychain

security set-keychain-settings -t 3600 -l ${HOME}/Library/Keychains/login.keychain

Note. The 'set-keychain-settings' leaves the keychain unlocked for a while (3600s), so your build process (xcodebuild in your case) still have access to the keychain when it's signing the IPA.

Note 2. The keychain extension changed with Sierra, it's now .keychain-db indeed. Using directly the security command won't affect you.