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

Bugfix: Do not rely on provisioning profile ordering on disk for xcode-project use-profiles #308

Merged

Conversation

priitlatt
Copy link
Contributor

@priitlatt priitlatt commented Feb 6, 2023

Two invocations of xcode-project use-profiles can lead to different modifications to Xcode project files even though the very same set of provisioning profiles are discovered. This can happen because the script code_signing_manager.rb, which is used internally for updating *.xcodeproj files, depends on the order of provisioning profiles that are passed to it.

In order to avoid such inconsistencies, make sure that profiles are sorted in a stable manner before serializing them for code_signing_manager.rb. The changes in this PR ensure that profiles are ordered so that

  • Non-wildcard/strict matching provisioning profiles have higher priority than wildcard profiles.
  • The more specific the bundle identifier is, the higher the priority. For example
    • com.example.app.extension is more specific than com.example.app and
    • com.example.app.* is more specific than com.example.*, which is more specific than just *.
  • Provisioning profiles with the same level of namespacing (number of dots in bundle identifier) are order alphabetically by comparing bundle identifier values.
  • Finally in case of bundle identifiers are the same, more recently generated provisioning profile comes first.

For example this is how those provisioning profiles would be ordered.

Bundle identifier Created at
io.codemagic.banaan.UITests.xctrunner 2023-01-20 13:17:03
io.codemagic.banaan.Clip 2023-01-20 13:17:03
io.codemagic.banaan 2023-01-20 13:17:02
io.codemagic.capybara 2023-01-20 13:29:58
io.codemagic.* 2022-09-28 10:40:41
io.codemagic.* 2022-03-24 10:02:42
* 2023-02-02 13:14:11
* 2022-11-14 10:15:54

Updated actions:

  • xcode-project use-profiles

@priitlatt priitlatt added the bug Something isn't working label Feb 6, 2023
@priitlatt priitlatt self-assigned this Feb 6, 2023
@priitlatt priitlatt marked this pull request as ready for review February 6, 2023 14:19
@priitlatt priitlatt requested a review from VeArnold February 6, 2023 14:19
@priitlatt priitlatt assigned VeArnold and unassigned priitlatt Feb 6, 2023
Copy link
Contributor

@VeArnold VeArnold left a comment

Choose a reason for hiding this comment

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

:shipit:

@priitlatt priitlatt merged commit 9ed1e93 into master Feb 6, 2023
@priitlatt priitlatt deleted the bugfix/xcode-project-use-profiles-action-profiles-ordering branch February 6, 2023 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants