Cloud
Cloud

Reputation: 13

Xcode codesign exit code 1 in Jenkins build

My environment is:

OSX 10.11 El Capitan
Unity3D 5.3.4f1
Xcode 7.3
Jenkins 1.642.4

The Xcode project file generated by Unity3D build process.

I import Developer & Team certificate to jenkins user's login.keychain

/Users/Share/Jenkins/Library/Keychains/login.keychain

Also copy all Provisioning Profiles to

/Users/Share/Jenkins/Library/MobileDevice/Provisioning Profiles

Build is running fine. And then run

/usr/bin/codesign return exit code 1

I tried many way to fix this.
But is not work yet.

I logged in as jenkins user.
And try to build xcode project
The codesign is build success.

I have no idea to figure out this problem.
Could anyone help me to solve this?

Thanks

Update 1:

sudo su - jenkins

xcodebuild is also failed on codesign.

Update 2:

Screenshot
Build as sudo su - jenkins
Change user to jenkins to build

Logged in as jenkins to build

Jenkins web console output
Only 2 links allow, so here is the address https://i.sstatic.net/dYFOW.png

Update 3:

Maybe the codesign issue could like execute codesign via ssh remote build.
Does any idea to solve this?

Update 4:

I tried ssh.
after security unlock keychain.
It's passed.

Update 5:

Directly run /usr/bin/codesign --force --sign ... pass
But execute xcodebuild still failed on codesign...

Update 6:

security set-keychain-settings -t 3600 -l ~/Library/Keychains/login.keychain

I added this to build step. It was passed built on jenkins.
So the problem maybe is TIMEOUT

God... It's stuck me TWO DAYS...
Thanks everyone.
Have good day

Upvotes: 1

Views: 2698

Answers (1)

Programmer
Programmer

Reputation: 125245

1. Got to Xcode -> Preferences -> Accounts -> Choose your account, and then View Details -> refresh the Provisioning Profile. If the refresh button is missing then click on Download All button then restart XCode.

EDIT:

After looking at the picture you posted, I noticed an error before the error you posted. It says "“User interaction is not allowed". So try the following below.

2. KeyChain may be locked: Keychain Access -> Keychain First Aid -> Repair

OR do it by code: https://stackoverflow.com/a/21327591/3785314

3. It could be a timeout issue when building. Try

security set-keychain-settings -t 3600 -l ~/Library/Keychains/login.keychain

4. Login your build user via the GUI and open Keychain Access. Select your signing private key, right-click, choose Get Info, change to the Access Control tab and select the "Allow all applications to access this item". enter image description here

"User interaction is not allowed" trying to sign an OSX app using codesign

Upvotes: 1

Related Questions