Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match picks the first code sign identity in case of multiple ones #21447

Open
4 tasks done
philonor opened this issue Aug 8, 2023 · 0 comments
Open
4 tasks done

Match picks the first code sign identity in case of multiple ones #21447

philonor opened this issue Aug 8, 2023 · 0 comments

Comments

@philonor
Copy link

philonor commented Aug 8, 2023

New Issue Checklist

Issue Description

When multiple matching code sign identities exist in apple developer, match just picks the first one.
1__bundle_exec_fastlane_env

This results in xcode showing the error "Provisioning profile 'match AppStore appID' doesn't include signing certificate 'Apple Distribution: XXX (someID)'.
Runner_—_Runner_xcodeproj

To work around this, we need to manually change the provisioning profile <> certificate mapping in apple developer.
Certificates__Identifiers___Profiles_-_Apple_Developer

Related issues & content

Expected/Suggested behaviour

  • As the purpose of match is to handle the management of all the signing assets, requiring manual remapping should not be necessary.
  • Picking the first certificate doesn't seem like a good behaviour. As the command only warns about multiple certificates, how should the developer know that there is an explicit configuration by him necessary to ensure match works well?
  • Match should manage it.
  • If match is not able to manage it, fail the command and enforce that the developer specifies the correct certificate in Matchfile. Manually remapping it in apple developer is not verbose & transparent.
  • If match just picks an arbitrary certificate, then the one with the latest issue date or the latest expiration date seems more reasonable.
Command executed

bundle exec fastlane prep_signing

Fastfile

# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:ios)

platform :ios do
  lane :prep_signing do
    # Locally, fetch codesign repo using SSH, online with HTTPS, PAT-authorized.
    if is_ci
      git_url = "xxx"
    else
      git_url = "xxx"
    end
    match(
      git_url: git_url,
      git_basic_authorization: ENV["MATCH_GIT_BASIC_AUTHORIZATION"],
      type: "appstore",
      readonly: false,
      app_identifier: "xxx",
      force: true,
      force_for_new_devices: true,
      force_for_new_certificates: true,
      include_all_certificates: true
    )
  end

  desc "Push a new beta build to TestFlight"
  lane :beta do
    prep_signing
    # clear_derived_data
    build_app(workspace: "xxx.xcworkspace", scheme: "prod")
    if is_ci
      upload
    end
  end

  desc "Uploads binary to TestFlight"
  lane :upload do
    app_store_connect_api_key(
      key_id: "xxx",
      # Get from here: https://appstoreconnect.apple.com/access/api
      issuer_id: "xxx",
      # Ensure key is available, e.g., by export FASTLANE_ITUNES_CONNECT_API_KEY_BASE64=".."
      key_content: ENV["FASTLANE_ITUNES_CONNECT_API_KEY_BASE64"],
      is_key_content_base64: true,
      duration: 500
    )
    pilot
  end 
end
Complete output when running fastlane, including the stack trace and command used
[14:35:38]: Successfully logged in
[14:35:38]: Fetching profiles...
[14:35:39]: Found 1 matching profile(s)
[14:35:39]: Recreating the profile
[14:35:40]: Creating new provisioning profile for 'xxx' with name 'match AppStore xxx' for 'ios' platform
[14:35:41]: Found more than one code signing identity. Choosing the first one. Check out `fastlane sigh --help` to see all available options.
[14:35:41]: Available Code Signing Identities for current filters:
[14:35:41]: 	- Name: xxx - ID: xxx - Expires 2024-02-17
[14:35:41]: 	- Name: xxx - ID: xxx - Expires 2024-06-22
[14:35:41]: Downloading provisioning profile...
[14:35:41]: Successfully downloaded provisioning profile...
[14:35:41]: Installing provisioning profile...
/var/folders/xxx
[14:35:41]: Installing provisioning profile...
[14:35:42]: 🔒  Successfully encrypted certificates repo
[14:35:42]: Pushing changes to remote git repo...
[14:35:44]: Finished uploading files to Git Repo [ssh://git@github.com/xxx]

+---------------------+------------------------------------------------------------+------------------------------------------------------------+
| Installed Provisioning Profile |
+---------------------+------------------------------------------------------------+------------------------------------------------------------+
| Parameter | Environment Variable | Value |
+---------------------+------------------------------------------------------------+------------------------------------------------------------+
| App Identifier | | xxx |
| Type | | appstore |
| Platform | | ios |
| Profile UUID | xxx | xxx |
| Profile Name | sigh_xxx_appstore_profile-name | match AppStore xxx |
| Profile Path | sigh_xxx_appstore_profile-path | /xxx |
| | | Profiles/xxx |
| | | sion |
| Development Team ID | sigh_com.xxx_appstore_team-id | xxx |
| Certificate Name | sigh_com.xxx_appstore_certificate-nam | Apple Distribution: xxx (xxx) |
| | e | |
+---------------------+------------------------------------------------------------+------------------------------------------------------------+

[14:35:44]: All required keys, certificates and provisioning profiles are installed 🙌
[14:35:44]: Setting Provisioning Profile type to 'app-store'

+------+------------------+-------------+
| fastlane summary |
+------+------------------+-------------+
| Step | Action | Time (in s) |
+------+------------------+-------------+
| 1 | default_platform | 0 |
| 2 | is_ci | 0 |
| 3 | match | 20 |
+------+------------------+-------------+

[14:35:44]: fastlane.tools finished successfully 🎉

Environment

| Key                         | Value                                       |
| --------------------------- | ------------------------------------------- |
| OS                          | 13.5                                        |
| Ruby                        | 3.1.2                                       |
| Bundler?                    | true                                        |
| Git                         | git version 2.37.3                          |
| Installation Source         | ~/.gem/ruby/3.1.2/bin/fastlane              |
| Host                        | macOS 13.5 (22G74)                          |
| Ruby Lib Dir                | ~/.rubies/ruby-3.1.2/lib                    |
| OpenSSL Version             | OpenSSL 1.1.1q  5 Jul 2022                  |
| Is contained                | false                                       |
| Is homebrew                 | false                                       |
| Is installed via Fabric.app | false                                       |
| Xcode Path                  | /Applications/Xcode.app/Contents/Developer/ |
| Xcode Version               | 14.3.1                                      |
| Swift Version               | 5.8.1                                       |

System Locale

Error
No Locale with UTF8 found 🚫

fastlane gems

Gem Version Update-Status
fastlane 2.214.0 ✅ Up-To-Date

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
error_highlight 0.3.0
did_you_mean 1.6.1
bundler 2.4.10
pathname 0.2.0
rake 13.0.6
rexml 3.2.6
CFPropertyList 3.0.6
public_suffix 5.0.3
addressable 2.8.5
artifactory 3.0.15
atomos 0.1.3
aws-eventstream 1.2.0
aws-partitions 1.799.0
aws-sigv4 1.6.0
jmespath 1.6.2
aws-sdk-core 3.180.2
aws-sdk-kms 1.71.0
aws-sdk-s3 1.132.0
babosa 1.0.4
claide 1.1.0
colored 1.2
colored2 3.1.2
highline 2.0.3
commander 4.6.0
declarative 0.0.20
digest-crc 0.6.5
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
gh_inspector 1.1.3
jwt 2.7.1
memoist 0.16.2
multi_json 1.15.0
os 1.1.4
signet 0.17.0
googleauth 1.7.0
httpclient 2.8.3
mini_mime 1.1.5
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.1
google-apis-androidpublisher_v3 0.47.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
nanaimo 0.3.0
xcodeproj 1.22.0
rouge 2.0.7
xcpretty 0.3.0
xcpretty-travis-formatter 1.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant