ios - Jenkins - Xcode build works codesign fails -
below build script (not using xcodebuild plugin).
- build step works
- have created separate keychain required certs , private keys, , visible in keychain access
- keychain commands don't fail in script
- security list-keychains shows these valid keychains
it's acting unlock command doesn't succeed. when try run codesign command line via
codesign -f -s "iphone developer: mycert" -v sample.app/ --keychain /users/shared/jenkins/library/keychains/jenkinsci.keychain
i
cssm_signdata returned: 000186ad sample.app/: unknown error -2070=fffffffffffff7ea
although i'm not sure i'm emulating command line since can @ best
sudo -u jenkins bash xcodebuild only_active_arch="no" code_sign_identity="" code_signing_required="no" -scheme "myschemename" configuration_build_dir="`pwd`" security list-keychains -s /users/shared/jenkins/library/keychains/jenkinsci.keychain + security default-keychain -d user -s /users/shared/jenkins/library/keychains/jenkinsci.keychain + security unlock-keychain -p jenkins /users/shared/jenkins/library/keychains/jenkinsci.keychain + security list-keychains "/users/shared/jenkins/library/keychains/jenkinsci.keychain" "/library/keychains/system.keychain" + security default-keychain "/users/shared/jenkins/library/keychains/jenkinsci.keychain" + codesign -f -s '$identity_goes_here.' -v sample.app/ sample.app/: user interaction not allowed.
any appreciated.
we don't use jenkins i've seen in our build automation before. here's how solved it:
1) create build keychain. contain private key/certificate used codesigning:
security create-keychain -p [keychain_password] mykeychain.keychain
the keychain_password you. you'll use later unlock keychain during build.
2) import private key (*.p12) codesign identity:
security import myprivatekey.p12 -t agg -k mykeychain.keychain -p [p12_password] -a
the key here "-a" flag. allow access keychain without warning. why you're seeing "user interaction not allowed" error. if attempting build via xcode ui, point prompt "allow access" keychain.
3) you're saving keychain (e.g.: checking in source control), make sure it's writeable , executable build user.
when you're ready build, add following prior running xcodebuild:
# switch keychain security list-keychains -s "/path/to/mykeyhain.keychain" security default-keychain -s "/path/to/mykeychain.keychain" security unlock-keychain -p "[keychain_password]" "/path/to/mykeychain.keychain"
if you're running locally, may want add @ end of build script switches login keychain (~/library/keychains/login.keychain), e.g.:
# switch login keychain security list-keychains -s "~/library/keychains/login.keychain" security default-keychain -s "~/library/keychains/login.keychain"
give try. create separate keychain each identity use (our own plus builds on behalf of customers). in our company's case, have both appstore , enterprise account. can result in naming conflicts while codesigning (e.g.: both accounts resolve "iphone distribution: acme corporation"). keeping these identities in separate keychains avoid conflict.
Comments
Post a Comment