fastlane / fastlane

🚀 The easiest way to automate building and releasing your iOS and Android apps
https://fastlane.tools
MIT License
38.87k stars 5.64k forks source link

"There are no local code signing identities found" #21373

Open wabahaba opened 1 year ago

wabahaba commented 1 year ago

New Issue Checklist

Issue Description

The ReactNative project which builds successfully with automatic signing when run locally on a Mac computer, when run in Circle CI/CD environment, the automatic signing doesn't work resulting in a There are no local code signing identities found error. Following the Circle CI recipe:

$ bundle exec fastlane match init
$ bundle exec fastlane match adhoc
$ bundle exec fastlane match development

with storing profiles in the repo or in the Google Cloud storage bucket (the error is the same for both).

Could this be an issue with the particular Fastlane version (2.213.0) and/or mismatch with Xcode used in Circle CI (version 14.2)? Or is this an issue with configuration of Fastlane or match itself, could you spot a culprit then, please? Or is it possible to keep automatic signing in CI/CD environment? Thanks in advance!

Checked some issues: #21145, #20967, #20626 (related but unfortunately not helping).

Command executed
bundle exec fastlane build_and_deploy

(Part of Circle CI job.)

Environment

The error:

image

Log further:

image

gym manifest:

image

gym error:

image

Appfile

$ cat fastlane/Appfile
app_identifier("com.blueprintnyc.bluebirdapp")
apple_id("<redacted>")
itc_team_id("<redacted>")

Matchfile

$ cat fastlane/Matchfile
git_url("https://github.com/BlueprintNYC/ECA-ReactNativeApp")
storage_mode("git")
type("adhoc")

Fastfile

fastlane_require "git"

default_platform(:ios)

key_id = "<redacted>"
issuer_id = "<redacted>"
team_id = "26A7FQK7NS"

api_key = app_store_connect_api_key(
  issuer_id: issuer_id,
  key_id: key_id,
  key_content: File.read("key.p8").chomp,
  duration: 1200,
  in_house: false
)

platform :ios do
  before_all do
    setup_circle_ci
  end

  desc "Build and Deploy"
  lane :build_and_deploy do
    version_number = "1.9.0"
    url = "https://example.com"
    increment_version_number(
      version_number: version_number
    )

    match(type: "adhoc")
    gym(scheme: "NativeProject",
        clean: true,
        workspace: "NativeProject.xcworkspace",
        skip_package_pkg: true,
        export_method: "ad-hoc",
        export_xcargs: "-allowProvisioningUpdates",
        export_options: {
            signingStyle: "manual",
        },
    )
    pilot(
        app_version: version_number,
        api_key: api_key,
        skip_submission: false,
        skip_waiting_for_build_processing: false
    )
  end
end

Circle CI config:

jobs:
  deploy:
    macos:
      xcode: 14.2.0
    working_directory: /Users/distiller/project
    environment:
      TERM: xterm-256color
    steps:
      - checkout
      - run:
          name: Setup
          command: |
            rm -rf ~/Library/Developer/Xcode/DerivedData
            rm -rf lib
            rm -rf node_modules
            npm install
            pushd ios
            bundle install
            gem install cocoapods
            pod install
            bundle exec fastlane build_and_deploy

fastlane env:

[16:16:53]: Generating fastlane environment output, this might take a few seconds...
swift-driver version: 1.62.15 <details><summary>✅ fastlane environment ✅</summary>

### Stack

| Key                         | Value                                            |
| --------------------------- | ------------------------------------------------ |
| OS                          | 12.6                                             |
| Ruby                        | 3.0.5                                            |
| Bundler?                    | true                                             |
| Git                         | git version 2.38.1                               |
| Installation Source         | ~/.rbenv/versions/3.0.5/bin/fastlane             |
| Host                        | macOS 12.6 (21G115)                              |
| Ruby Lib Dir                | ~/.rbenv/versions/3.0.5/lib                      |
| OpenSSL Version             | OpenSSL 1.1.1s  1 Nov 2022                       |
| Is contained                | false                                            |
| Is homebrew                 | false                                            |
| Is installed via Fabric.app | false                                            |
| Xcode Path                  | /Applications/Xcode-14.2.app/Contents/Developer/ |
| Xcode Version               | 14.2                                             |
| Swift Version               | 5.7.2        

### System locale
| Variable | Value       |   |
| -------- | ----------- | - |
| LANG     | en_US.UTF-8 | ✅ |
| LC_ALL   | en_US.UTF-8 | ✅ |
| LANGUAGE |             |   |

### fastlane gems

| Gem      | Version | Update-Status |
| -------- | ------- | ------------- |
| fastlane | 2.213.0 | ✅ Up-To-Date  |

### Loaded fastlane plugins:

**No plugins Loaded**

<details><summary><b>Loaded gems</b></summary>

| Gem                             | Version      |
| ------------------------------- | ------------ |
| did_you_mean                    | 1.5.0        |
| bundler                         | 2.3.26       |
| pathname                        | 0.1.0        |
| rake                            | 13.0.6       |
| rexml                           | 3.2.5        |
| CFPropertyList                  | 3.0.6        |
| concurrent-ruby                 | 1.2.2        |
| i18n                            | 0.9.5        |
| minitest                        | 5.18.0       |
| thread_safe                     | 0.3.6        |
| tzinfo                          | 1.2.11       |
| activesupport                   | 4.2.11.3     |
| public_suffix                   | 5.0.1        |
| addressable                     | 2.8.4        |
| artifactory                     | 3.0.15       |
| atomos                          | 0.1.3        |
| aws-eventstream                 | 1.2.0        |
| aws-partitions                  | 1.777.0      |
| aws-sigv4                       | 1.5.2        |
| jmespath                        | 1.6.2        |
| aws-sdk-core                    | 3.174.0      |
| aws-sdk-kms                     | 1.66.0       |
| aws-sdk-s3                      | 1.123.1      |
| babosa                          | 1.0.4        |
| claide                          | 1.1.0        |
| fuzzy_match                     | 2.0.4        |
| nap                             | 1.1.0        |
| cocoapods-core                  | 1.3.0        |
| cocoapods-deintegrate           | 1.0.5        |
| cocoapods-downloader            | 1.6.3        |
| cocoapods-plugins               | 1.0.0        |
| cocoapods-search                | 1.0.1        |
| cocoapods-stats                 | 1.1.0        |
| netrc                           | 0.11.0       |
| cocoapods-trunk                 | 1.6.0        |
| cocoapods-try                   | 1.2.0        |
| colored2                        | 3.1.2        |
| escape                          | 0.0.4        |
| fourflusher                     | 2.0.1        |
| gh_inspector                    | 1.1.3        |
| molinillo                       | 0.5.7        |
| ruby-macho                      | 1.4.0        |
| nanaimo                         | 0.3.0        |
| xcodeproj                       | 1.22.0       |
| cocoapods                       | 1.3.0        |
| colored                         | 1.2          |
| highline                        | 2.0.3        |
| commander                       | 4.6.0        |
| declarative                     | 0.0.20       |
| digest-crc                      | 0.6.4        |
| unf_ext                         | 0.0.8.2      |
| unf                             | 0.1.4        |
| domain_name                     | 0.5.20190701 |
| dotenv                          | 2.8.1        |
| emoji_regex                     | 3.2.3        |
| excon                           | 0.100.0      |
| faraday-em_http                 | 1.0.0        |
| faraday-em_synchrony            | 1.0.0        |
| faraday-excon                   | 1.1.0        |
| faraday-httpclient              | 1.0.1        |
| multipart-post                  | 2.3.0        |
| faraday-multipart               | 1.0.4        |
| faraday-net_http                | 1.0.1        |
| faraday-net_http_persistent     | 1.2.0        |
| faraday-patron                  | 1.0.0        |
| faraday-rack                    | 1.0.0        |
| faraday-retry                   | 1.0.3        |
| ruby2_keywords                  | 0.0.5        |
| faraday                         | 1.10.3       |
| http-cookie                     | 1.0.5        |
| faraday-cookie_jar              | 0.0.7        |
| faraday_middleware              | 1.2.0        |
| fastimage                       | 2.2.7        |
| jwt                             | 2.7.1        |
| memoist                         | 0.16.2       |
| multi_json                      | 1.15.0       |
| os                              | 1.1.4        |
| signet                          | 0.17.0       |
| googleauth                      | 1.5.2        |
| httpclient                      | 2.8.3        |
| mini_mime                       | 1.1.2        |
| trailblazer-option              | 0.1.2        |
| uber                            | 0.1.0        |
| representable                   | 3.2.0        |
| retriable                       | 3.1.2        |
| webrick                         | 1.8.1        |
| google-apis-core                | 0.11.0       |
| google-apis-androidpublisher_v3 | 0.43.0       |
| google-apis-playcustomapp_v1    | 0.13.0       |
| google-apis-iamcredentials_v1   | 0.17.0       |
| google-apis-storage_v1          | 0.19.0       |
| google-cloud-env                | 1.6.0        |
| google-cloud-errors             | 1.3.1        |
| google-cloud-core               | 1.6.0        |
| google-cloud-storage            | 1.44.0       |
| json                            | 2.6.3        |
| mini_magick                     | 4.12.0       |
| naturally                       | 2.2.1        |
| optparse                        | 0.1.1        |
| plist                           | 3.7.0        |
| rubyzip                         | 2.3.2        |
| security                        | 0.1.3        |
| simctl                          | 1.6.10       |
| terminal-notifier               | 2.0.0        |
| unicode-display_width           | 1.8.0        |
| terminal-table                  | 1.8.0        |
| tty-screen                      | 0.8.1        |
| tty-cursor                      | 0.7.1        |
| tty-spinner                     | 0.9.3        |
| word_wrap                       | 1.0.0        |
| rouge                           | 2.0.7        |
| xcpretty                        | 0.3.0        |
| xcpretty-travis-formatter       | 1.0.1        |
| rchardet                        | 1.8.0        |
| git                             | 1.18.0       |
| graphql                         | 2.0.22       |
</details>

nekrich commented 11 months ago

@wabahaba , The errors are unrelated. Please double check provisioning profile names in your project. What I see you are trying to build AdHoc version, but somewhere in Build Settings you have a specified match Development... and not match AdHoc.

[16:18:051: • /Users/distiller/project/ios/NativeProject.xcodeproj: error: No profile for team 26A7FQK7NS' matching match Development com.blueprintnyc.bluebirdapp' found: Xcode couldn't find

wabahaba commented 11 months ago

@nekrich great catch! thank you for spotting this, I'll double check!

mosesoak commented 8 months ago

I'm getting the same error output during create_keychain when the keychain doesn't exist, yet all lanes complete successfully so it's not really an error but an incorrect warning printed in red. (Someone called this a "red herring warning" https://discuss.circleci.com/t/debugging-common-ios-code-signing-issues/39282)

It seems to be an execution order problem. Our lane is written:

  1. create_keychain
  2. unlock_keychain
  3. match

The expectation being that it will run serially, e.g. create will complete before match begins. However, the logs show them happening at the same time:

Screenshot 2023-11-15 at 1 49 04 PM

Is it a faulty assumption that commands within a lane will execute one at a time?

mosesoak commented 8 months ago

BTW I tried adding a 10s delay after the call to create_keychain,sleep(10), but it didn't change the above. So it is running the commands serially, and is definitely something wrong in match.

(Note that in the image above, it has already successfully run the first half of match but then there seems to be a collision at Installing certificate... and [⠋] Setting key partition list... – might be a race condition or concurrency issue in the match code.)

MattFixesFaults commented 7 months ago

Hi everyone, I am running into the same problem. @wabahaba, did changing it to match AdHoc solve your issues?

pietv commented 7 months ago

@wabahaba, did changing it to match AdHoc solve your issues?

Yes, two things helped:

  1. Creating a new AppStore (not AdHoc) profile to be able to publish the app to TestFlight (fastlane match appstore --git_branch=main)
  2. Opening the project in Xcode and changing the Provisioning Profile in Signing & Capabilities to match AppStore <bundle_id> and thus saving it.
MattFixesFaults commented 7 months ago

Thanks for such a quick response! I feel I have tried these things but I will persist, cheers.

MattFixesFaults commented 7 months ago

The error is a "Red herring" as @mosesoak shared. I had recently installed OneSignal into my app and as part of the installation process you have to create a new target. Each target needs their own provisioning profile, it even says in the docs https://docs.fastlane.tools/codesigning/xcode-project/ 🤦‍♂️. Once I had correctly created my provisioning profiles for each target for both development and appstore my build succeeded. Hopefully this helps someone in future!

farshadmb commented 5 months ago

it seems the export_xcargs is missing in the BuildCommandGenerator for Xcode 15.0 and above.

+---------------------------------------------------------------------------------------------------------+
|                                         Summary for gym 2.219.0                                         |
+------------------------------------------+--------------------------------------------------------------+
| workspace                                | xxxxxxx.xcworkspace                                         |
| scheme                                   | xxxxxxx                                                     |
| configuration                            | Debug                                                        |
| clean                                    | true                                                         |
| export_method                            | ad-hoc                                                       |
| export_options.stripSwiftSymbols         | true                                                         |
| export_options.compileBitcode            | false                                                        |
| export_options.signingStyle              | automatic                                                    |
| export_options.method                    | ad-hoc                                                       |
| export_options.manifest.appURL           | %APP_IPA_DOWNLOAD_URL%                                       |
| export_options.manifest.displayImageURL  | %APP_DISPLAY_IMAGE%                                          |
| export_options.manifest.fullSizeImageURL | %APP_DISPLAY_IMAGE%                                          |
| export_options.thinning                  | <none>                                                       |
| export_xcargs                            | -allowProvisioningUpdates                                    |
| output_name                              | xxxxxxxx-v0.0.2-0.0.2                                        |
| output_directory                         | ./build/ipa/debug/xxxxxxxx-v0.0.2-0.0.2/                     |
| include_symbols                          | false                                                        |
| include_bitcode                          | false                                                        |
| buildlog_path                            | ./build/log/                                                 |
| silent                                   | false                                                        |
| skip_package_ipa                         | false                                                        |
| skip_package_pkg                         | false                                                        |
| build_path                               | Library/Developer/Xcode/Archives/2024-01-30 |
| result_bundle                            | false                                                        |
| destination                              | generic/platform=iOS                                         |
| xcodebuild_formatter                     | xcpretty                                                     |
| build_timing_summary                     | false                                                        |
| skip_profile_detection                   | false                                                        |
| xcodebuild_command                       | xcodebuild                                                   |
| skip_package_dependencies_resolution     | false                                                        |
| disable_package_automatic_updates        | false                                                        |
| use_system_scm                           | false                                                        |
| xcode_path                               | /Applications/Xcode-15.2.app                                 |
+------------------------------------------+--------------------------------------------------------------+

+-------------------------------------------------------------------------------------------------------------+
|                                           Generated Build Command                                           |
+--------------------------------------------------------------------------------------+----------------------+
| Option                                                                               | Value                |
+--------------------------------------------------------------------------------------+----------------------+
| set -o pipefail &&                                                                   |                      |
| xcodebuild                                                                           |                      |
| -workspace xxxxxxxx.xcworkspace                                                      |                      |
| -scheme xxxxxxxx                                                                     |                      |
| -configuration Debug                                                                 |                      |
| -destination                                                                         | generic/platform=iOS |
| -archivePath                                                                         |                      |
| /Developer/Xcode/Archives/2024-01-30/xxxxxxxx-v0.0.2-0.0.2\  |                      |
| 2024-01-30\ 19.02.23.xcarchive                                                       |                      |
| clean                                                                                |                      |
| archive                                                                              |                      |
| | tee                                                                                |                      |
| /build/log/xxxxxxxx-xxxxxxxx.l  |                      |
| og                                                                                   |                      |
| | xcpretty                                                                           |                      |
+--------------------------------------------------------------------------------------+----------------------+
INFO [2024-01-30 19:02:23.69]: $ set -o pipefail && xcodebuild -workspace xxxxxxxx.xcworkspace -scheme xxxxxxxx -configuration Debug -destination 'generic/platform=iOS' -archivePath /Archives/2024-01-30/xxxxxxxx-v0.0.2-0.0.2\ 2024-01-30\ 19.02.23.xcarchive clean archive |
 tee /build/log/xxxxxxxx-xxxxxxxx.log | xcpretty

I used xcargs the problem is gone.

LayMui commented 3 months ago

@farshadmb could you share how you use xargs? i have similar issue with github actions. it was ok in Nov 2023 and build suddenly broke with this error

[00:52:28]: Installing certificate... [00:52:29]: There are no local code signing identities found. You can run security find-identity -v -p codesigning fastlane_tmp_keychain to get this output. This Stack Overflow thread has more information: https://stackoverflow.com/q/35390072/774. (Check in Keychain Access for an expired WWDR certificate: https://stackoverflow.com/a/35409835/774 has more info.) [00:52:29]: Setting key partition list... (this can take a minute if there are a lot of keys installed) [00:52:29]: security: SecItemCopyMatching: The specified item could not be found in the keychain.