Solvedvirtual environments xcodebuild archive hangs regularly on MacOS runners

Hello virtual-environments team 👋

Enterprise Support has a customer reporting an issue with xcodebuild archive, while it regularly runs fine locally, it intermittently hangs when running on macOS-latest. Debug Logging does does not provide much additional information, and we only see a time stamp for when the script which runs the archive command is launched and then nothing until the action is cancelled manually by the user. Given the code-signing requirements, reproducing in a public repo is not ideal. Please reach out to me directly with any questions.

Thanks!

18 Answers

✔️Accepted Answer

Hello @arielelkin !
We’ve finally figured out why xcodebuild archive command hangs. If a keychain is in the ~/Library/Keychains directory, a modal window to access keychain will appear. It is expected behavior and I can reproduce it on my machine too.

As a solution you should use any other folder to create a new keychain. For example:

KEYCHAIN_PATH=$RUNNER_TEMP/<keychain name>
security create-keychain -p <keychain password> $KEYCHAIN_PATH

Could you please verify if it works for you?

I've also listed all commands required to install Apple Provisioning Profile and Certificate below:

# To encode Apple Provisioning Profile and Certificate you can use base64 system
# For example: base64 certificate.p12 > encodedCertificate.txt
echo -n "<your secret that includes encoded certificate>" | base64 --decode --output <certificate name>.p12
echo -n "<your secret that includes encoded provision profile>" | base64 --decode --output <profile name>.mobileprovision

KEYCHAIN_PATH=$RUNNER_TEMP/<keychain name>

security create-keychain -p <keychain password> $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p <keychain password> $KEYCHAIN_PATH
security import <certificate name>.p12 -P <p12 password> -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH

mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp <profile name>.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles

Other Answers:

Hey,

Finally, guide on how to install certificates to the image is ready, check it out https://docs.github.com/en/actions/guides/installing-an-apple-certificate-on-macos-runners-for-xcode-development

Thank you for your patience!

Related Issues:

175
virtual environments puppeteer can't launch chromium, missing shared library libgbm.so
Both builds run on the same image version Describe the bug My build actions involve running puppetee...
11
virtual environments Ubuntu images are running out of disk space
Hello @jneira it is expected behavior Based on official documentation hosted agents provide at least...
8
virtual environments xcodebuild archive hangs regularly on MacOS runners
Hello @arielelkin ! We’ve finally figured out why xcodebuild archive command hangs If a keychain is ...