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 + ionic results in provisioning profile error for some reason #56

Open
josh-m-sharpe opened this issue Aug 15, 2019 · 8 comments
Open

Comments

@josh-m-sharpe
Copy link

My release lane looks something like this, but it ultimately fails with a code signing error (see below). The app gets built though, and if I fiddle around in xcode and change Signing (Release) then I can get xcode to build my app for release. But, why doesn't the ionic build command finish successfully? It seems like I've matched my app store profile right before building with ionic - so it should work?

Thanks!

(I'm using git_branch and team_id with match because I work across multiple development teams)

lane :release do
  match(
	type: 'appstore',
	git_branch: 'branch_name',
	app_identifier: "my.app.identifier",
	readonly: false,
	username: '[email protected]',
	team_id: 'my_team_id'
  )

  ionic(
	platform: 'ios',
	prod: true,
	release: true
  )
end

Error:

Code Signing Error: Provisioning profile "match AppStore my.app.identifier" doesn't include signing certificate "iPhone Developer: My NAME (ABCDEF1234)".

@josh-m-sharpe
Copy link
Author

The error makes me think it's using the wrong cert because "match AppStore my.app.identifier" is the correct provisioning profile

@janpio
Copy link
Collaborator

janpio commented Aug 15, 2019

Can you post the complete output of running that lane?

@josh-m-sharpe
Copy link
Author

Thinking it was bad/old certs or profiles, I deleted a bunch of them up on the portal. Here's output from the last run where the profile was rebuilt. I still got the same error though.

	+---------+----------------------------------------------------------+
	|            Detected Values from './fastlane/Matchfile'             |
	+---------+----------------------------------------------------------+
	| git_url | [email protected]:YellowApps/fastlane_certificates.git      |
	+---------+----------------------------------------------------------+


	+-----------------------+----------------------------------------------------------+
	|                            Summary for match 2.129.0                             |
	+-----------------------+----------------------------------------------------------+
	| type                  | appstore                                                 |
	| git_branch            | yellow                                                   |
	| app_identifier        | ["com.yellowhq.district.www"]                            |
	| username              | [email protected]                                        |
	| team_id               | 9DF2XQJMD5                                               |
	| readonly              | false                                                    |
	| storage_mode          | git                                                      |
	| git_url               | [email protected]:YellowApps/fastlane_certificates.git      |
	| shallow_clone         | false                                                    |
	| clone_branch_directly | false                                                    |
	| keychain_name         | login.keychain                                           |
	| force                 | false                                                    |
	| force_for_new_devices | false                                                    |
	| skip_confirmation     | false                                                    |
	| skip_docs             | false                                                    |
	| platform              | ios                                                      |
	| verbose               | false                                                    |
	+-----------------------+----------------------------------------------------------+

	[09:48:11]: Cloning remote git repo...
	[09:48:11]: If cloning the repo takes too long, you can use the `clone_branch_directly` option in match.
	[09:48:15]: Checking out branch yellow...
	[09:48:15]: 🔓  Successfully decrypted certificates repo
	[09:48:15]: Verifying that the certificate and profile are still valid on the Dev Portal...
	Available session is not valid any more. Continuing with normal login.
	[09:48:23]: Installing certificate...

	+-------------------+-----------------------------------------------------------------+
	|                                Installed Certificate                                |
	+-------------------+-----------------------------------------------------------------+
	| User ID           | 9DF2XQJMD5                                                      |
	| Common Name       | iPhone Distribution: Yellow, Inc (9DF2XQJMD5)                   |
	| Organisation Unit | 9DF2XQJMD5                                                      |
	| Organisation      | Yellow, Inc                                                     |
	| Country           | US                                                              |
	| Start Datetime    | 2019-08-17 07:24:02 UTC                                         |
	| End Datetime      | 2020-08-16 07:24:02 UTC                                         |
	+-------------------+-----------------------------------------------------------------+

	[09:48:25]: Installing provisioning profile...
	[09:48:26]: Provisioning profile '7f60037c-09ee-4720-9276-b4640b5465ac' is not available on the Developer Portal for the user [email protected], fixing this now for you 🔨

	+-------------------------------------+----------------------------------------------------+
	|                                 Summary for sigh 2.129.0                                 |
	+-------------------------------------+----------------------------------------------------+
	| app_identifier                      | com.yellowhq.district.www                          |
	| username                            | [email protected]                                  |
	| force                               | false                                              |
	| cert_id                             | QW7Z9C8PL3                                         |
	| provisioning_name                   | match AppStore com.yellowhq.district.www           |
	| ignore_profiles_with_different_name | true                                               |
	| team_id                             | 9DF2XQJMD5                                         |
	| platform                            | ios                                                |
	| adhoc                               | false                                              |
	| developer_id                        | false                                              |
	| development                         | false                                              |
	| skip_install                        | false                                              |
	| skip_fetch_profiles                 | false                                              |
	| skip_certificate_verification       | false                                              |
	| readonly                            | false                                              |
	+-------------------------------------+----------------------------------------------------+

	[09:48:26]: Starting login with user '[email protected]'
	Available session is not valid any more. Continuing with normal login.
	[09:48:29]: Successfully logged in
	[09:48:29]: Fetching profiles...
	[09:48:31]: Verifying certificates...
	[09:48:31]: No existing profiles found, that match the certificates you have installed locally! Creating a new provisioning profile for you
	[09:48:36]: Creating new provisioning profile for 'com.yellowhq.district.www' with name 'match AppStore com.yellowhq.district.www' for 'ios' platform
	[09:48:38]: Downloading provisioning profile...
	[09:48:39]: Successfully downloaded provisioning profile...
	[09:48:39]: Installing provisioning profile...
	/var/folders/tr/b1508pgj5gz1dq3b0g2ds34r0000gn/T/d20190817-38918-qfvxnx/profiles/appstore/AppStore_com.yellowhq.district-.www.mobileprovision
	[09:48:39]: Installing provisioning profile...
	[09:48:41]: 🔒  Successfully encrypted certificates repo
	[09:48:41]: Pushing changes to remote git repo...
	[09:48:47]: Finished uploading files to Git Repo [[email protected]:YellowApps/fastlane_certificates.git]

	+---------------------+----------------------------------------------------------------+---------------------------------------------------------+
	|                                                            Installed Provisioning Profile                                                      |
	+---------------------+----------------------------------------------------------+---------------------------------------------------------------+
	| Parameter           | Environment Variable                                     | Value                                                         |
	+---------------------+----------------------------------------------------------+---------------------------------------------------------------+
	| App Identifier      |                                                          | com.yellowhq.district-.www                                    |
	| Type                |                                                          | appstore                                                      |
	| Platform            |                                                          | ios                                                           |
	| Profile UUID        | sigh_com.yellowhq.district.www_appstore                  | 2e15dea3-8f2e-495d-9c85-fe79b40c5ee2                          |
	| Profile Name        | sigh_com.yellowhq.district.www_appstore_profile-name     | match AppStore com.yellowhq.district.www                      |
	| Profile Path        | sigh_com.yellowhq.district.www_appstore_profile-path     | /Users/jsharpe/Library/MobileDevice/Provisioning              |
	|                     |                                                          | Profiles/2e15dea3-8f2e-495d-9c85-fe79b40c5ee2.mobileprovision |
	| Development Team ID | sigh_com.yellowhq.district.www_appstore_team-id          | 9DF2XQJMD5                                                    |
	+---------------------+----------------------------------------------------------+---------------------------------------------------------------+

	[09:48:47]: All required keys, certificates and provisioning profiles are installed 🙌
	[09:48:47]: Setting Provisioning Profile type to 'app-store'
	[09:48:47]: -------------------
	[09:48:47]: --- Step: ionic ---
	[09:48:47]: -------------------
	[09:48:47]: $ ionic cordova prepare ios --no-interactive --release --device --prod
	[09:48:47]: ▸ > ionic-app-scripts build --prod --target cordova --platform ios
	[09:48:51]: ▸ [09:48:51]  ionic-app-scripts 3.2.4
	[09:48:51]: ▸ [09:48:51]  build prod started ...


	# ETC,ETC,ETC


	[09:50:49]: ▸ === BUILD TARGET District OF PROJECT District WITH CONFIGURATION Release ===
	[09:50:49]: ▸ Check dependencies
	[09:50:49]: ▸ Code Signing Error: Provisioning profile "match AppStore com.yellowhq.district.www" doesn't include signing certificate "iPhone Developer: Josh Sharpe (TG37YNE2N4)".
	[09:50:49]: ▸ Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 12.4'
	[09:50:49]: ▸ ** ARCHIVE FAILED **
	[09:50:49]: ▸ The following build commands failed:
	[09:50:49]: ▸ Check dependencies
	[09:50:49]: ▸ (1 failure)
	[09:50:49]: ▸ xcodebuild: Command failed with exit code 65
	[09:50:49]: ▸ [ERROR] An error occurred while running subprocess cordova.
	[09:50:49]: ▸ cordova compile ios --release --device --packageType=app-store --developmentTeam... exited with exit code 65.
	[09:50:49]: ▸ Re-running this command with the --verbose flag may provide more information.
	+------------------------------------+-----------------------------------------------------------------------------------------------+
	|                                                            Lane Context                                                            |
	+------------------------------------+-----------------------------------------------------------------------------------------------+
	| DEFAULT_PLATFORM                   | ios                                                                                           |
	| PLATFORM_NAME                      | ios                                                                                           |
	| LANE_NAME                          | ios build                                                                                     |
	| SIGH_PROFILE_TYPE                  | app-store                                                                                     |
	| MATCH_PROVISIONING_PROFILE_MAPPING | {"com.yellowhq.district.www"=>"match AppStore com.yellowhq.district.www"}                     |
	+------------------------------------+-----------------------------------------------------------------------------------------------+

@josh-m-sharpe
Copy link
Author

After this build, I can open xcode and set the signing profiles manually, and the app builds, however xcode is acting oddly.

First, there's no team set in xcode. Strange since other apps I build under different teams are set correctly. I can select the correct team manually, but it seems I shouldn't have to do that since it was set by fastlane.

Secondly. I can select the "Signing (Debug)" profile without issue ("match Development"), but when I go to select the "Signing (Release)" profile, the only "eligible" profile in that dropdown is the "match Development" profile. The "match AppStore" profile is listed as inelligible -- but If I select "match AppStore", the items in that dropdown shuffle around and the "match Appstore" becomes eligible. Very odd.

After all of that, xcode will build the app.

@josh-m-sharpe
Copy link
Author

As stated above, I run this lane against a few apps on different teams. Only one of them is showing these errors at this point. I couldn't tell you what the difference between the accounts is. For this broken one, I've deleted all certs & profiles directly in the dev portal - and manually out of ~/Library/MobileDevice/Provisioning Profiles, hoping fastlane would recreate them correctly. No dice.

@josh-m-sharpe
Copy link
Author

I take that back - I've managed to break it for another org/team now. :/

@janpio
Copy link
Collaborator

janpio commented Aug 19, 2019

Signing always is a pain, especially for Ionic Cordova projects, that are set up in strange ways (which they are out of the box).

I would create a new Ionic app, and set everything up in a clean way (meaning: no manual changes in Xcode, trying only to use Fastlane for everything and see if you can get it to work as expected that way. If yes, you have your base configuration you can/should create for all other projects to get them to hopefully work.

@tonylucas
Copy link

I fixed it adding device: false

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

3 participants