3

I'm trying to set Jenkins up for xcode, and I keep getting certification errors.

In my shell script I have this command:security unlock-keychain $KEYCHAIN

But since Jenkins is running as user 'jenkins' it seem to lack authority when unlocking the keychain and prints this error:

[workspace] $ /bin/sh -xe /var/folders/lD/lDiU3VbfHpm-KUHY26PrX++++Do/-Tmp-/hudson2556417005809365518.sh
+ sh build.sh
security: SecKeychainUnlock /Users/vb_admin/Library/Keychains/login.keychain: Could not write to the file. It may have been opened with insufficient access privileges.

Any ideas to fix this problem would be appreciated.

Thanks in advance!

Tinolover
  • 166
  • 1
  • 5
  • 19
  • Are you running Jenkins as a LaunchDaemon ? If so, you might find answers to [this question](http://stackoverflow.com/questions/6827874/missing-certificates-and-keys-in-the-keychain-while-using-jenkins-hudson-as-cont/9482707#9482707) very instructive, especially [this one](http://stackoverflow.com/questions/6827874/missing-certificates-and-keys-in-the-keychain-while-using-jenkins-hudson-as-cont/9482707#9482707), which solved a similar problem for me. – amadour Aug 22 '12 at 08:36

2 Answers2

1

Either give more privileges to user 'jenkins' or in your shell script grant appropriate privileges to the file. As far as the error show it is saying that 'write' privilages are not available.

0o'-Varun-'o0
  • 735
  • 1
  • 5
  • 22
0

The best way to give the jenkins user access to the certificate is to install the certificate into the jenkins user's keychain rather than mess with the file system security and potentially give anyone with access to the jenkins user access to the while of the vb_admin user's keychain.

security <CERT_FILE> import -k $HOME/Library/Keychains/login.keychain -Tcodesign

Jon Boydell
  • 834
  • 7
  • 8