fastlane: Ad Hoc provisioning profiles mismatched from certs

New Issue Checklist

Issue Description

When running match and gym on our CI, builds are failing because the Ad Hoc provisioning profile name doesn’t match what’s set in our certificate. As per my comment in PR 13945, we’ve already upgraded to 2.112.0 and tried re-running match, but code signing still fails.

The profile that’s downloaded for our app ID looks like match AdHoc com.foo.app-name 1545256864 but the cert is expecting match AdHoc com.foo.app-name.

This seems precisely similar to https://github.com/fastlane/fastlane/issues/13936, except we’re still seeing the problem after our update to Fastlane 2.112.0.

@samodom has recommended running fastlane match nuke distribution and recreating the provisioning profiles. This is not the greatest solution for us, since it will invalidate in-use Ad Hoc builds.

Complete output when running fastlane, including the stack trace and command used

This is the trace on a failing job on CircleCI, scrubbed of proprietary information and the iOS compilation process.

#!/bin/bash --login -eo pipefail
cd ~/project/Foo/
export TERM=${TERM:-dumb} && make dist-qa-ios;
^D^Dcd ios/ && bundle exec fastlane ios qa use_temporary_keychain:true refresh_certificates:false
[⠋] 🚀 [⠙] 🚀 [⠹] 🚀 [⠸] 🚀 [⠼] 🚀 [⠴] 🚀 [⠦] 🚀 [✔] 🚀 
+------------------------+---------+--------+
|               Used plugins                |
+------------------------+---------+--------+
| Plugin                 | Version | Action |
+------------------------+---------+--------+
| fastlane-plugin-aws_s3 | 1.5.0   | aws_s3 |
+------------------------+---------+--------+

[13:55:02]: Sending anonymous analytics information [13:55:02]: Learn more at https://docs.fastlane.tools/#metrics [13:55:02]: No personal or sensitive data is sent. [13:55:03]: You can disable this by adding opt_out_usage at the top of your Fastfile [13:55:03]: ------------------------------ [13:55:03]: — Step: default_platform — [13:55:03]: ------------------------------ [13:55:03]: Driving the lane ‘ios qa’ 🚀 [13:55:03]: ----------------------------- [13:55:03]: — Step: setup_circle_ci — [13:55:03]: ----------------------------- [13:55:03]: Creating temporary keychain: “fastlane_tmp_keychain”. [13:55:03]: Enabling match readonly mode. [13:55:03]: Skipping Log Path setup as FL_OUTPUT_DIR is unset [13:55:03]: ------------------------------------ [13:55:03]: — Step: increment_build_number — [13:55:03]: ------------------------------------ Current version of project Foo is: 70

/Users/distiller/project/Foo/ios [13:55:04]: $ cd /Users/distiller/project/Foo/ios && agvtool new-version -all 56233 && cd - [13:55:05]: ▸ Setting version of project Foo to: [13:55:05]: ▸ 56233. [13:55:05]: ▸ Also setting CFBundleVersion key (assuming it exists) [13:55:05]: ▸ Updating CFBundleVersion in Info.plist(s)… [13:55:05]: ▸ Cannot find “Foo.xcodeproj/…/Foo-tvOS/Info.plist” [13:55:05]: ▸ Cannot find “Foo.xcodeproj/…/Foo-tvOSTests/Info.plist” [13:55:05]: ▸ Updated CFBundleVersion in “Foo.xcodeproj/…/Foo/Info.plist” to 56233 [13:55:05]: ▸ Updated CFBundleVersion in “Foo.xcodeproj/…/FooTests/Info.plist” to 56233 [13:55:05]: ▸ /Users/distiller/project/Foo/ios [13:55:06]: --------------------------------------------- [13:55:06]: — Step: Switch to ios certificates lane — [13:55:06]: --------------------------------------------- [13:55:06]: Cruising over to lane ‘ios certificates’ 🚖 [13:55:06]: ---------------------------------------------------------- [13:55:06]: — Step: Switch to ios create_temporary_keychain lane — [13:55:06]: ---------------------------------------------------------- [13:55:06]: Cruising over to lane ‘ios create_temporary_keychain’ 🚖 [13:55:06]: ----------------------------- [13:55:06]: — Step: create_keychain — [13:55:06]: ----------------------------- [13:55:06]: $ security list-keychains -d user [13:55:06]: ▸ “/Users/distiller/Library/Keychains/temporary_keychain-db” [13:55:06]: Cruising back to lane ‘ios certificates’ 🚘 [13:55:06]: ------------------------------ [13:55:06]: — Step: register_devices — [13:55:06]: ------------------------------ [13:55:08]: Fetching list of currently registered devices… [13:55:08]: Successfully registered new devices. [13:55:08]: ------------------- [13:55:08]: — Step: match — [13:55:08]: ------------------- [13:55:09]: Successfully loaded ‘/Users/distiller/project/Foo/ios/fastlane/Matchfile’ 📄

±--------±--------------------------------------------------+ | Detected Values from ‘./fastlane/Matchfile’ | ±--------±--------------------------------------------------+ | git_url | git@github.com:foo/certificates.git | ±--------±--------------------------------------------------+

±----------------------±--------------------------------------------------+ | Summary for match 2.112.0 | ±----------------------±--------------------------------------------------+ | git_branch | foobar | | app_identifier | [“com.foo.project-name”] | | type | adhoc | | team_id | XXXXXXXXXX | | readonly | true | | force_for_new_devices | false | | force | false | | git_url | git@github.com:foo/certificates.git | | storage_mode | git | | username | foo@bar.com | | keychain_name | temporary_keychain | | keychain_password | ******** | | verbose | false | | skip_confirmation | false | | shallow_clone | false | | clone_branch_directly | false | | skip_docs | false | | platform | ios | ±----------------------±--------------------------------------------------+

[13:55:09]: Cloning remote git repo… [13:55:09]: If cloning the repo takes too long, you can use the clone_branch_directly option in match. [13:55:12]: Checking out branch foobar… [13:55:12]: 🔓 Successfully decrypted certificates repo [13:55:12]: Installing certificate… security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain. [13:55:12]: There are no local code signing identities found. You can run security find-identity -v -p codesigning temporary_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.)

±------------------±-------------------------------------------+ | Installed Certificate | ±------------------±-------------------------------------------+ | User ID | XXXXXXXXXX | | Common Name | iPhone Distribution: FOO BAR (XXXXXXXXXX) | | Organisation Unit | XXXXXXXXXX | | Organisation | FOO BAR | | Country | US | | Start Datetime | 2018-02-27 03:26:49 UTC | | End Datetime | 2019-02-27 03:26:49 UTC | ±------------------±-------------------------------------------+

[13:55:13]: Installing provisioning profile…

±--------------------±------------------------------------------------------±-----------------------------------------------------------------------------------------------------------------+ | Installed Provisioning Profile | ±--------------------±------------------------------------------------------±-----------------------------------------------------------------------------------------------------------------+ | Parameter | Environment Variable | Value | ±--------------------±------------------------------------------------------±-----------------------------------------------------------------------------------------------------------------+ | App Identifier | | com.foo.project-name | | Type | | adhoc | | Platform | | ios | | Profile UUID | sigh_com.foo.project-name_adhoc | 87af5e97-6060-4ccb-9d67-31ed643e319c | | Profile Name | sigh_com.foo.project-name_adhoc_profile-name | match AdHoc com.foo.project-name 1545255953 | | Profile Path | sigh_com.foo.project-name_adhoc_profile-path | /Users/distiller/Library/MobileDevice/Provisioning Profiles/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.mobileprovision | | Development Team ID | sigh_com.foo.project-name_adhoc_team-id | XXXXXXXXXX | ±--------------------±------------------------------------------------------±-----------------------------------------------------------------------------------------------------------------+

[13:55:13]: All required keys, certificates and provisioning profiles are installed 🙌 [13:55:13]: Setting Provisioning Profile type to ‘ad-hoc’ [13:55:13]: -------------------------------------------------------------------- [13:55:13]: Step: security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k temporary_keychain temporary_keychain [13:55:13]: -------------------------------------------------------------------- [13:55:13]: $ security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k temporary_keychain temporary_keychain [13:55:13]: ▸ keychain: “/Users/distiller/Library/Keychains/temporary_keychain-db” [13:55:13]: ▸ version: 512

…REDACTED…

[13:55:13]: Cruising back to lane ‘ios qa’ 🚘 [13:55:13]: -------------------------------- [13:55:13]: — Step: clear_derived_data — [13:55:13]: -------------------------------- [13:55:13]: Derived Data path located at: /Users/distiller/Library/Developer/Xcode/DerivedData [13:55:13]: Successfully cleared Derived Data ♻️ [13:55:13]: ----------------- [13:55:13]: — Step: gym — [13:55:13]: ----------------- [13:55:13]: $ xcodebuild -showBuildSettings -scheme QA -project ./Foo.xcodeproj -configuration Release [13:55:16]: Command timed out after 3 seconds on try 1 of 4, trying again with a 6 second timeout… [13:55:22]: Command timed out after 6 seconds on try 2 of 4, trying again with a 12 second timeout… [13:55:33]: Detected provisioning profile mapping: {:“com.foo.project-name”=>“match AdHoc com.foo.project-name 1545255953”, :“com.foo.project-name-dev”=>“match AdHoc com.foo.project-name-dev”}

±------------------------------------------------------------------±------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Summary for gym 2.112.0 | ±------------------------------------------------------------------±------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | scheme | QA | | xcargs | BUNDLE_ID_SUFFIX=‘.qa’ PRODUCT_BUNDLE_IDENTIFIER=‘com.foo.project-name’ DEVELOPMENT_TEAM=‘XXXXXXXXXX’ PROVISIONING_PROFILE_SPECIFIER=‘match AdHoc com.foo.project-name’ | | export_method | ad-hoc | | configuration | Release | | clean | true | | export_options.provisioningProfiles.com.foo.project-name | match AdHoc com.foo.project-name 1545255953 | | export_options.provisioningProfiles.com.foo.project-name-dev | match AdHoc com.foo.project-name-dev | | project | ./Foo.xcodeproj | | destination | generic/platform=iOS | | output_name | Foo | | build_path | /Users/distiller/Library/Developer/Xcode/Archives/2018-12-20 | | output_directory | . | | silent | false | | skip_package_ipa | false | | result_bundle | false | | buildlog_path | ~/Library/Logs/gym | | skip_profile_detection | false | | xcode_path | /Applications/Xcode-9.4.1.app | ±------------------------------------------------------------------±------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

[13:55:33]: $ set -o pipefail && xcodebuild -scheme QA -project ./Foo.xcodeproj -configuration Release -destination ‘generic/platform=iOS’ -archivePath /Users/distiller/Library/Developer/Xcode/Archives/2018-12-20/Foo\ 2018-12-20\ 13.55.33.xcarchive BUNDLE_ID_SUFFIX=‘.qa’ PRODUCT_BUNDLE_IDENTIFIER=‘com.foo.project-name’ DEVELOPMENT_TEAM=‘XXXXXXXXXX’ PROVISIONING_PROFILE_SPECIFIER=‘match AdHoc com.foo.project-name’ clean archive | tee /Users/distiller/Library/Logs/gym/Foo-QA.log | xcpretty

… REDACTED: React-Native app compilation…

▸ Building Foo/Foo [Release] ▸ Check Dependencies ** ARCHIVE FAILED **

The following build commands failed: Check dependencies (1 failure) [14:06:10]: Exit status: 65 [14:06:10]: [14:06:10]: Maybe the error shown is caused by using the wrong version of Xcode [14:06:10]: Found multiple versions of Xcode in ‘/Applications/’ [14:06:10]: Make sure you selected the right version for your project [14:06:10]: This build process was executed using ‘/Applications/Xcode-9.4.1.app’ [14:06:10]: If you want to update your Xcode path, either [14:06:10]: [14:06:10]: - Specify the Xcode version in your Fastfile [14:06:10]: ▸ xcversion(version: “8.1”) # Selects Xcode 8.1.0 [14:06:10]: [14:06:10]: - Specify an absolute path to your Xcode installation in your Fastfile [14:06:10]: ▸ xcode_select “/Applications/Xcode8.app” [14:06:10]: [14:06:10]: - Manually update the path using [14:06:10]: ▸ sudo xcode-select -s /Applications/Xcode.app [14:06:10]:

±--------------±------------------------------+ | Build environment | ±--------------±------------------------------+ | xcode_path | /Applications/Xcode-9.4.1.app | | gym_version | 2.112.0 | | export_method | ad-hoc | | sdk | iPhoneOS11.4.sdk | ±--------------±------------------------------+

[14:06:10]: ▸ Code Signing Error: No profile for team ‘XXXXXXXXXX’ matching ‘match AdHoc com.foo.project-name’ found: Xcode couldn’t find any provisioning profiles matching ‘XXXXXXXXXX/match AdHoc com.foo.project-name’. Install the profile (by dragging and dropping it onto Xcode’s dock item) or select a different one in the General tab of the target editor. [14:06:10]: ▸ Code Signing Error: Code signing is required for product type ‘Application’ in SDK ‘iOS 11.4’ [14:06:10]: ▸ Code Signing Error: Code signing is required for product type ‘Application’ in SDK ‘iOS 11.4’ [14:06:10]: ▸ Code Signing Error: Code signing is required for product type ‘Application’ in SDK ‘iOS 11.4’ [14:06:10]: ▸ Code Signing Error: Code signing is required for product type ‘Application’ in SDK ‘iOS 11.4’ [14:06:10]: [14:06:10]: ⬆️ Check out the few lines of raw xcodebuild output above for potential hints on how to solve this error [14:06:10]: 📋 For the complete and more detailed error log, check the full log at: [14:06:10]: 📋 /Users/distiller/Library/Logs/gym/Foo-QA.log [14:06:10]: [14:06:10]: Looks like fastlane ran into a build/archive error with your project [14:06:10]: It’s hard to tell what’s causing the error, so we wrote some guides on how [14:06:10]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/ [14:06:10]: Before submitting an issue on GitHub, please follow the guide above and make [14:06:10]: sure your project is set up correctly. [14:06:10]: fastlane uses xcodebuild commands to generate your binary, you can see the [14:06:10]: the full commands printed out in yellow in the above log. [14:06:10]: Make sure to inspect the output above, as usually you’ll find more error information there [14:06:10]: ±-----------------------------------±------------------------------------------------------------------------------------------+ | Lane Context | ±-----------------------------------±------------------------------------------------------------------------------------------+ | DEFAULT_PLATFORM | ios | | PLATFORM_NAME | ios | | LANE_NAME | ios qa | | ORIGINAL_DEFAULT_KEYCHAIN | “/Users/distiller/Library/Keychains/fastlane_tmp_keychain-db” | | BUILD_NUMBER | 56233 | | SIGH_PROFILE_TYPE | ad-hoc | | MATCH_PROVISIONING_PROFILE_MAPPING | {“com.foo.project-name”=>“match AdHoc com.foo.project-name 1545255953”} | ±-----------------------------------±------------------------------------------------------------------------------------------+ [14:06:10]: Error building the application - see the log above

±-----±--------------------------------------------------------------±------------+ | fastlane summary | ±-----±--------------------------------------------------------------±------------+ | Step | Action | Time (in s) | ±-----±--------------------------------------------------------------±------------+ | 1 | default_platform | 0 | | 2 | setup_circle_ci | 0 | | 3 | git log --pretty=format:‘* %s <%an>%n’ --first-parent --abbre | 0 | | 4 | increment_build_number | 2 | | 5 | Switch to ios certificates lane | 0 | | 6 | Switch to ios create_temporary_keychain lane | 0 | | 7 | create_keychain | 0 | | 8 | register_devices | 2 | | 9 | match | 4 | | 10 | security set-key-partition-list -S apple-tool:,apple:,codesig | 0 | | 11 | clear_derived_data | 0 | | 💥 | gym | 656 | ±-----±--------------------------------------------------------------±------------+

[14:06:10]: fastlane finished with errors

[!] Error building the application - see the log above make: *** [dist-qa-ios] Error 1 Exited with cod

Environment

Redacted the fastlane files sections, because it’s chock full of proprietary information. Let me know if further details are needed.

bash-3.2$ fastlane env
[✔] 🚀 
[09:39:09]: fastlane detected a Gemfile in the current directory
[09:39:09]: however it seems like you don't use `bundle exec`
[09:39:09]: to launch fastlane faster, please use
[09:39:09]: 
[09:39:09]: $ bundle exec fastlane env
[09:39:09]: 
[09:39:09]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
[09:39:12]: Sending anonymous analytics information
[09:39:12]: Learn more at https://docs.fastlane.tools/#metrics
[09:39:12]: No personal or sensitive data is sent.
[09:39:12]: You can disable this by adding `opt_out_usage` at the top of your Fastfile
[09:39:12]: Generating fastlane environment output, this might take a few seconds...
✅ fastlane environment ✅

Stack

Key Value
OS 10.13.3
Ruby 2.4.4
Bundler? false
Git git version 2.17.1
Installation Source ~/.gem/ruby/2.4.4/bin/fastlane
Host Mac OS X 10.13.3 (17D102)
Ruby Lib Dir ~/.rubies/ruby-2.4.4/lib
OpenSSL Version OpenSSL 1.0.2o 27 Mar 2018
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode-9.4.1.app/Contents/Developer/
Xcode Version 9.4.1

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL en_US.UTF-8
LANGUAGE

fastlane files:

…REDACTED…

fastlane gems

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

Loaded fastlane plugins:

Plugin Version Update-Status
fastlane-plugin-aws_s3 1.5.0 ✅ Up-To-Date
Loaded gems
Gem Version
did_you_mean 1.1.0
slack-notifier 2.3.2
atomos 0.1.3
CFPropertyList 3.0.0
claide 1.0.2
colored2 3.1.2
nanaimo 0.2.6
xcodeproj 1.7.0
rouge 2.0.7
xcpretty 0.3.0
terminal-notifier 1.8.0
unicode-display_width 1.4.0
terminal-table 1.8.0
plist 3.4.0
public_suffix 2.0.5
addressable 2.5.2
multipart-post 2.0.0
word_wrap 1.0.0
babosa 1.0.2
colored 1.2
highline 1.7.10
commander-fastlane 4.4.6
excon 0.62.0
unf_ext 0.0.7.5
unf 0.1.4
domain_name 0.5.20180417
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
gh_inspector 1.1.3
mini_magick 4.5.1
multi_json 1.13.1
multi_xml 0.6.0
rubyzip 1.2.2
security 0.1.3
xcpretty-travis-formatter 1.0.0
bundler 1.16.2
faraday_middleware 0.12.2
google-cloud-env 1.0.5
google-cloud-core 1.2.7
uber 0.1.0
declarative 0.0.10
declarative-option 0.1.0
representable 3.0.4
retriable 3.1.2
jwt 2.1.0
signet 0.11.0
httpclient 2.8.3
google-api-client 0.23.9
digest-crc 0.4.1
google-cloud-storage 1.15.0
emoji_regex 0.1.1
tty-cursor 0.6.0
tty-spinner 0.9.0
tty-screen 0.6.5
faraday 0.15.4
openssl 2.0.7
json 2.1.0
io-console 0.4.6
memoist 0.16.0
googleauth 0.6.7
fastimage 2.1.5
dotenv 2.5.0
mime-types 3.2.2
mime-types-data 3.2018.0812
os 1.0.0
psych 2.2.2
apktools 0.7.2
fastlane-plugin-aws_s3 1.5.0

generated on: 2018-12-21

[09:39:13]: Take notice that this output may contain sensitive information, or simply information that you don't want to make public. [09:39:13]: Open https://github.com/fastlane/fastlane/issues/new to submit a new issue ✅

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Hi @benjarwar can you please try this:

  • Go to developer portal and remove the AdHoc provisioning profile of com.foo.app-name (the one without numbers, that is expected for signing). This will invalidate downloaded ones and let match regenerate it.

@crilofer we’ve upgraded to 2.112.0 specifically to solve these Ad Hoc issues as per https://github.com/fastlane/fastlane/issues/13936#issuecomment-449166674.

Thanks @rkrim, that worked for us!

@rkrim Thanks for your suggestion. It works for me 😃