openbakery / gradle-xcodePlugin

gradle plugin for building Xcode Projects for iOS, watchOS, macOS or tvOS
Apache License 2.0
459 stars 128 forks source link

2x system keychain fails in gradle but manual add and find works manually #447

Open rosscdh opened 3 years ago

rosscdh commented 3 years ago

Hi there,

encountering a strange bug

When running codesigning and trying to add a keychain we get a double listing of the system keychain

The build then fails as it was not able to find signers, however the process works when completing the steps manually (via ssh)

2021-03-04T12:07:19.915+0000 [DEBUG] [org.openbakery.codesign.Security] FINISHED IMPORTING CERTIFICATE:
import "/Users/ec2-user/builds/bnm-B_7n/0/xxx/mobile-apps/xxx-ios/build/codesign/xxxEnterpriseCertificate.p12" "-k" "/Users/ec2-user/builds/bnm-B_7n/0/xxx/mobile-apps/xxx-ios/build/codesign/gradle-1614859468741.keychain" "-P" "[MASKED]" "-T" "/usr/bin/codesign"
1 identity imported.
2021-03-04T12:07:19.916+0000 [DEBUG] [org.openbakery.CommandRunner] Run command: 'security list-keychains'
2021-03-04T12:07:19.916+0000 [DEBUG] [org.openbakery.CommandRunner] with working directory: . (/Users/ec2-user/builds/bnm-B_7n/0/xxx/mobile-apps/xxx-ios/.gradle/daemon/6.8/.)
2021-03-04T12:07:19.934+0000 [DEBUG] [org.openbakery.CommandRunner] Run command: 'security list-keychains -s /Users/ec2-user/builds/bnm-B_7n/0/xxx/mobile-apps/xxx-ios/build/codesign/gradle-1614859468741.keychain'
2021-03-04T12:07:19.934+0000 [DEBUG] [org.openbakery.CommandRunner] with working directory: . (/Users/ec2-user/builds/bnm-B_7n/0/xxx/mobile-apps/xxx-ios/.gradle/daemon/6.8/.)

2021-03-04T12:07:19.953+0000 [DEBUG] [org.openbakery.codesign.Security] FINISHED SETTING KEYCHAIN:
2021-03-04T12:07:19.953+0000 [DEBUG] [org.openbakery.CommandRunner] Run command: 'security list-keychains'
2021-03-04T12:07:19.954+0000 [DEBUG] [org.openbakery.CommandRunner] with working directory: . (/Users/ec2-user/builds/bnm-B_7n/0/xxx/mobile-apps/xxx-ios/.gradle/daemon/6.8/.)

2021-03-04T12:07:19.974+0000 [DEBUG] [org.openbakery.codesign.Security] KEYCHAIN LIST IS NOW:
    "/Library/Keychains/System.keychain"
    "/Library/Keychains/System.keychain"

... snip ...

2021-03-04T12:07:23.796+0000 [INFO] [org.openbakery.codesign.Codesign] performCodesign /Users/ec2-user/builds/bnm-B_7n/0/xxx/mobile-apps/xxx-ios/build/package/Payload/xxx.app/PlugIns/LatestRecipeWidgetExtension.appex
2021-03-04T12:07:23.797+0000 [DEBUG] [org.openbakery.CommandRunner] Run command: '/usr/bin/codesign --force --entitlements /var/folders/_6/l9d3rd7n1hx3qnkhhl36r_2c0000gn/T/entitlements_gradle-68195d36-99b5-4e1f-a207-eebfebe343dc.plist --sign xxxxxxxxxxxxx --verbose /Users/ec2-user/builds/bnm-B_7n/0/xxx/mobile-apps/xxx-ios/build/package/Payload/xxx.app/PlugIns/XXXXXXXWidgetExtension.appex --keychain /Users/ec2-user/builds/bnm-B_7n/0/xxx/mobile-apps/xxx-ios/build/codesign/gradle-1614859468741.keychain'
2021-03-04T12:07:23.797+0000 [DEBUG] [org.openbakery.CommandRunner] with working directory: . (/Users/ec2-user/builds/bnm-B_7n/0/xxx/mobile-apps/xxx-ios/.gradle/daemon/6.8/.)
2021-03-04T12:07:23.797+0000 [DEBUG] [org.openbakery.CommandRunner] with additional environment variables: {DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer/}
2021-03-04T12:07:23.823+0000 [DEBUG] [org.openbakery.CommandRunner] Exit Code: 1

Thanks in advance