I lost days to this, but finally found a solution.
https://stackoverflow.com/questions/47582989/launchd-not-able-to-access-mac-os-keychains
Add this to your plist
<key>SessionCreate</key>
<true/>
Our LaunchDaemon can run xcode builds, and finds a valid identity to sign with now.
Also had to add the Apple Worlwide Developer Relation cert to the system keychain
if [ ! -f ./AppleWWDRCAG3.cer ]; then
echo "Downloadind Apple Worlwide Developer Relation GA3 certificate"
curl -s -o ./AppleWWDRCAG3.cer https://www.apple.com/certificateauthority/AppleWWDRCAG3.cer
fi
echo "Installing Apple Worlwide Developer Relation GA3 certificate into System keychain"
SYSTEM_KEYCHAIN=/Library/Keychains/System.keychain
sudo security import ./AppleWWDRCAG3.cer -t cert -k "${SYSTEM_KEYCHAIN}"
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: