yukiarrr / ios-build-action

Build iOS project (.xcodeproj, .xcworkspace), and export ipa
MIT License
283 stars 139 forks source link

ios-build keychain not deleted #72

Closed CinGiu closed 2 years ago

CinGiu commented 2 years ago

Hi, i runned the action on a self-hosted machine. At the end it fails because of a provisioning profile problem with the private key. I probably pass the wrong private key in the secret.

After the fails in my local Keychain Access, the ios-build keychain is persisted, and i can't remove it since the pass is randomly generated. image

after that all my next builds on that machine fails:

[19:04:57]: Found keychain '~/Library/Keychains/ios-build.keychain', creation skipped
[19:04:57]: If creating a new Keychain DB is required please set the `require_create` option true to cause the action to fail
+---------------------------+---------------------------------------------------------+
|                                    Lane Context                                     |
+---------------------------+---------------------------------------------------------+
| DEFAULT_PLATFORM          | ios                                                     |
| PLATFORM_NAME             | ios                                                     |
| LANE_NAME                 | ios export_ipa                                          |
| KEYCHAIN_PATH             | ~/Library/Keychains/ios-build.keychain                  |
| ORIGINAL_DEFAULT_KEYCHAIN | "/Users/giulio/Library/Keychains/ios-build.keychain-db" |
+---------------------------+---------------------------------------------------------+
[19:04:57]: Shell command exited with exit status 51 instead of 0.

+------+------------------+-------------+
|           fastlane summary            |
+------+------------------+-------------+
| Step | Action           | Time (in s) |
+------+------------------+-------------+
| 1    | default_platform | 0           |
| 💥   | create_keychain  | 0           |
+------+------------------+-------------+

i think the delete_keychain(name: 'ios-build.keychain')method should be called even if the build fails.

Any ideas how to remove the ios-build.keychain?

cblack3 commented 2 years ago

Hey @CinGiu I was able to delete the keychain by deleting the keychain file instead, then creating a new keychain with the same name, then deleting the new keychain in Access.

CinGiu commented 2 years ago

yes, somehow i managed to remove it by wiping out the entire keychain. ios-build.keychain was locked and the password was randomly generated. i think it is a matter of time, if it fails and no activity in a while, it locks forever..

cinder92 commented 2 years ago

hi @CinGiu how can i delete the keychain on github actions ? im using self hosted server and getting exact same issue

CinGiu commented 2 years ago
image

on the building machine, I opened the "Keychain Access" -> Preferences -> reset default keychain

It will completely restore all the certificates and pass, so be prepared with an eventual backup

starikcetin commented 2 years ago

I also think the keychain should be deleted even if the build fails. I don't want to wipe the entire keychain just to get rid of it.

Also, it would be good if we could give it a set password value ourselves as an input or an environment variable, instead of it getting set to a randomized one. That way, we could manipulate the keychain ourselves if needed.

starikcetin commented 2 years ago

I found a way to delete the keychain instead of wiping everything:

security delete-keychain ios-build.keychain