The goal: is to automate the macOS app notarization using Amazon EC2 with the Jenkins pipeline.
Problem statement:
The EC2 macOS AMIs only has the Xcode command-line tool preinstalled in those AMIs, I can't install the Xcode.app via ssh/command line onto the EC2 machine. To install the Xcode, it has to be via the Apple App Store, using the GUI to log in first. The Xcode.app is required for the notarization.
Attempts / Experimented
I have tried the mas cli which is no longer to support sign in from the command line. https://www.funkyspacemonkey.com/use-the-mac-app-store-from-the-command-line
In macOS High Sierra (10.13) Apple removed the -[ISAccountService signInWithContext:replyBlock:] method from the StoreFoundation private Apple framework which this app relies on to authenticate users through the signin command. I have done a lot of digging and debugging but have not found another API that works to authenticate a user with the Mac App Store.
Users running older macOS versions (10.9-10.12) are unaffected.
You need to have xcode.app for not notarization https://developer.apple.com/forums/thread/126350 The documentation seems clear enough:
"Prepare Your Software for Notarization Notarization requires Xcode 10 or later. Building a new app for notarization requires macOS 10.13.6 or later. Stapling an app requires macOS 10.12 or later."
It seems the 'altool' is used for the notarization for xcode12. I tried to copy the altool from my dev machine to the Jenkins machine /Library/Developer/CommandLineTools/usr/bin and got this error when running it.
dyld: Library not loaded: @rpath/ITunesConnectFoundation.framework/Versions/A/ITunesConnectFoundation
Referenced from: /Library/Developer/CommandLineTools/usr/bin/altool
Reason: image not found
zsh: abort xcrun altool
Even the otool -L doesn't show the altool has any linkage with the xcode.
/Library/Developer/CommandLineTools/usr/bin/altool:
@rpath/ITunesConnectFoundation.framework/Versions/A/ITunesConnectFoundation (compatibility version 1.0.0, current version 1.0.0)
@rpath/AppStoreService.framework/Versions/A/AppStoreService (compatibility version 0.0.0, current version 1.0.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1122.24.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1775.109.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1775.109.0)
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 59754.100.88)