Fastlane: execute via ssh fails (cannot sign app)

40 views Asked by At

I want to build a XCode project via ssh on a remote mac machine.

I'm using fastlane to build, sign and upload the app to the iOS app store. Everything works fine, when I'm logged into the computer via VNC and execute the script there in the zsh terminal.

However, I want to trigger the whole build pipeline from a remote machine using ssh. It seems like the ssh-login shell fails when trying to "sign" the code. Here an error from fastlane:

[12:57:56]: ▸ ** ARCHIVE FAILED **
[12:57:56]: ▸ The following build commands failed:
[12:57:56]: ▸   CodeSign /Users/myUser/Library/Developer/Xcode/DerivedData/Unity-iPhone-ecjjvskuasdfepgkej/Build/Intermediates.noindex/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/MyDemoApplication.app/Frameworks/Sentry.framework (in target 'Unity-iPhone' from project 'Unity-iPhone')
[12:57:56]: ▸ (1 failure)
1

There are 1 answers

0
mcExchange On BEST ANSWER

Turns out, I had to unlock the keychain from within the script using the following command

security unlock-keychain -p "$PASSWORD" /Users/myUser/Library/Keychains/login.keychain

Now everything is working.

Caveat: Before I also once granted access to signing certificates to openSSH using GUI and the MacOS settings menu. I don't remember exactly how I did it, as it was some time ago and it also didn't fix the problem. But it might be part of the solution so I leave it here as additional information.