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

[sigh] add force_profile_device_udids option #21733

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bitsofinfo
Copy link

@bitsofinfo bitsofinfo commented Dec 15, 2023

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I see several green ci/circleci builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.
  • I've added or updated relevant unit tests.

Motivation and Context

We have a need to generate provisioning profiles that are restricted to specific subsets of udids rather than the default selection of large sets of matching uuids based on platform & deviceClass oriented.

Description

The net change was a new option (optional) --force_profile_device_udids SIGH_FORCE_PROFILE_DEVICE_UDIDS which lets the user specify a comma delimited list of explicit device udids to restrict the generated/downloaded profile to.

Comma delimited list of specific device udids to include in the provisioning profile. If this option is specified it will override the default behavior of leveraging SIGH_PLATFORM (and optionally SIGH_INCLUDE_MAC_IN_PROFILES) when determining the devices to include in the profile based on deviceClass

fastlane sigh   \
  --development true \
  --provisioning_name my_test_004 \
  --output_path /tmp/pprofile \
  --cert_id XXXXX9WS99 \
  --filename my_test_004.mobileprovision \
  --app_identifier my.custom.id.Whatever \
  --force_profile_device_udids xxxx-dddddd,yyyy-bbbbbb

Overall this involved adding support for filtering the devices returned via apple connect device API using the uuids the user presents via the new argument.

Testing Steps

See unit tests.

@bitsofinfo
Copy link
Author

@lacostej
Copy link
Collaborator

fyi - error in the build related to docs... which looks like something else https://app.circleci.com/pipelines/github/fastlane/fastlane/5954/workflows/a8da031c-a64b-4f0b-a485-07c30f071d30/jobs/94653/parallel-runs/0/steps/0-105

You're right. The issue is fixed in the HEAD of master so if you rebase the branch, the failure will go away.

@bitsofinfo
Copy link
Author

Hi! How can I help move this forward?

profile_qualifies = true
if force_profile_device_udids.length > 0
filtered_devices = current_profile.devices.select { |device| force_profile_device_udids.include?(device.udid) }
if force_profile_device_udids.length != filtered_devices.length
Copy link
Collaborator

Choose a reason for hiding this comment

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

are we here checking that the profile contains all the udids?

Maybe something like

if force_profile_device_udids.length > 0
  # all forced udids found in current_profile
  profile_devices = current_profile.devices.map{|d| d.udid}
  unless (force_profile_device_udids - profile_devices).empty?
    UI...
  end
end

Copy link
Author

Choose a reason for hiding this comment

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

@lacostej this check @ lines 109, 110 is validating that the list of UDIDs in the current_profile contains ALL of the UDIDs that are inforce_profile_device_udids.

example 1:

current state:
force_profile_device_udids = [A,B,E,F]
current_profile.devices = [A,B,C,D]

after the current_profile.devices.select, filtered_devices = [A,B]

force_profile_device_udids.length (4) != filtered_devices.length (2) results in false so it will be skipped.

Your suggestion above would result in:

force_profile_device_udids - profile_devices = [E,F] which is not empty so it will be skipped.

Both of these do the same thing, am I missing something with regards to what you are asking for?

sigh/lib/sigh/runner.rb Outdated Show resolved Hide resolved
@bitsofinfo bitsofinfo requested a review from lacostej April 3, 2024 20:23
@bitsofinfo
Copy link
Author

Hi! How can I help move this forward?

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

Successfully merging this pull request may close these issues.

None yet

4 participants