Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

STEP 13 contacts notes entitlement #31

Merged
merged 10 commits into from
Dec 9, 2020

Conversation

lpusok
Copy link
Contributor

@lpusok lpusok commented Dec 7, 2020

https://bitrise.atlassian.net/browse/STEP-13

Adding check whether an unsupported entitlement is used, that we can not add on the API.

  • We check this before checking if App ID exist and is valid as as far we know,
    these needed to be added in the provisioning profile generation phase.
    So even if the user creates App ID manually, the step can not generate the correct profiles.
    The extra entitlements require Apple approval, which I could not test,
    so choose to fail early and make the user use the Certificates Installer Step.

Discussed with @istvankovacs-bitrise adding this logic to SyncBundleID -> Capabilities at

// List of capabilities that the API does not support and prevent autoprovisioning
, but decided that is not the same use case, as supposedly the user still can generate App ID manually, and the step will use it (may need the check this logic again as did not validate)

Carplay entitlement: https://developer.apple.com/documentation/carplay/requesting_the_carplay_entitlements
Contacts notes entitlement: https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_contacts_notes

Other entitlements for reference (not yet checked): https://developer.apple.com/documentation/bundleresources/entitlements

…not add on the API.

- We check this before checking if App ID exist and is valid as as far we know,
these needed to be added in the provisioning profile generation phase.
So even if the user creates App ID manually, the step can not generate the correct profiles.
The extra entitlements require Apple approval, which we can not test,
so choose to fail early and make the user use the Certificates Installer Step.
@lpusok lpusok force-pushed the STEP-13-contacts-notes-entitlement branch from 60d5b16 to 8394b5a Compare December 7, 2020 13:53
@lpusok lpusok requested review from godrei and mateherber December 7, 2020 17:33
appstoreconnect/appstoreconnect.go Outdated Show resolved Hide resolved
appstoreconnect/capabilities.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
@lpusok lpusok requested a review from godrei December 9, 2020 14:03
Copy link
Contributor

@godrei godrei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls check my notes

autoprovision/entitlements_test.go Outdated Show resolved Hide resolved
autoprovision/entitlements_test.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
@lpusok lpusok requested a review from godrei December 9, 2020 15:03
@lpusok lpusok merged commit 24a26ed into master Dec 9, 2020
@lpusok lpusok deleted the STEP-13-contacts-notes-entitlement branch December 9, 2020 15:26
@petermnt
Copy link
Contributor

petermnt commented Dec 9, 2020

@lpusok There is actually an undocumented way to create a provisioning profile with this special entitlement through the Appstore Connect api.
Fastlane has this implemented and this works for us. See https://github.com/fastlane/fastlane/blob/2624a24407dee94f67d7e39b5651f9fdc41dcb00/spaceship/lib/spaceship/connect_api/models/profile.rb#L83

The tricky thing is that this templateName is a very specific string that might not even be the same for every developer.
For us this is

  • CarPlay Audio App(Distribution)
  • CarPlay Audio App(Distribution) (Adhoc)
  • CarPlay Audio App(Development)

Passing these to the API will create the correct provisioning profile.

Maybe templateName could be added as a configurable field in the bitrise step for people who need this?

@lpusok
Copy link
Contributor Author

lpusok commented Dec 9, 2020

@petermnt Checking, was not aware of this. How do you specifically look up the template name?

Does the fastlane solution only work when the profile already exists? In that case indeed we could try to look up profiles that contain the correct entitlements, but can not (re)generate them, in case of new devices added or profile expiry.

@petermnt
Copy link
Contributor

petermnt commented Dec 9, 2020

@lpusok The templateName works for creating new profiles.
The only way I know to look up the template name is to look manually in the developer portal.

There is a dropdown where you choose the special entitlement.
There can only be 1 per profile.

It looks like this:

CleanShot 2020-12-09 at 19 10 53@2x

There is another thing to pay attention to, which is that (for us) in Adhoc configuration the visible value in the dropdown does not match the actual value required in the API:

<select id="template" name="template"><option value="Standard">Default</option><option value="CarPlay Audio App(Distribution) (Adhoc)" selected="">CarPlay Audio App(Distribution)</option></select>
<option value="Standard">Default</option>
<option value="CarPlay Audio App(Distribution) (Adhoc)" selected="">CarPlay Audio App(Distribution)</option>
<select id="template" name="template"><option value="Standard">Default</option><option value="CarPlay Audio App(Distribution) (Adhoc)" selected="">CarPlay Audio App(Distribution)</option></select>

Passing the value found in the HTML select element (CarPlay Audio App(Distribution) (Adhoc)) to templateName creates the profile with this dropdown properly select.

For App Store and Development the actual value does match the user visible value.

The API gives an error if a completely wrong templateName is passed.
But it returns a success if a valid templateName is passed to the wrong provisioning profile.
For example passing CarPlay Audio App(Development) to an App Store profile will not give an error from the API, but will have "default" selected in the actual profile.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants