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
[spaceship] Fix filtering of Mac devices when trying to create a macOS profile #21915
Conversation
Seems like ASC updated the values used in of `deviceClass` attribute to now return `APPLE_SILICON_MAC` and `INTEL_MAC` instead of just `MAC` like currently still documented in the API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🔥
One little misspelling mentioned in a comment below.
@@ -31,8 +31,9 @@ module DeviceClass | |||
APPLE_TV = "APPLE_TV" | |||
MAC = "MAC" | |||
|
|||
# As of 2022-11-12, this is not officially supported by App Store Connect API | |||
# As of 2024-03-1082, this is not _officially_ supported by App Store Connect API (according to API docs)—yet still used in the API responses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2024-03-08?
I also wanted to ask about the need of adding |
Seems like ASC updated the values used in of
deviceClass
attribute to now returnAPPLE_SILICON_MAC
andINTEL_MAC
(instead of justMAC
like currently still documented in the API)Checklist
bundle exec rspec
from the root directory to see all new and existing tests passbundle exec rubocop -a
to ensure the code style is validci/circleci
builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)Motivation and Context
When trying to update my provisioning profiles for
macOS Development
usingmatch
today using this lane:I kept getting the following error from the API:
It turns out that when
match
tries to list all Mac devices (internally usingdevices_for_platform(platform: 'mac')
and filter the found devices bydevice_class
, none of the Mac devices haddevice_class = 'MAC'
, and thus the subsequent request done by spaceship to create the macOS profile with an empty list of devices made the API complain.Description
When running
fastlane spaceship
in Playground mode to debug what was happening, and callingSpaceship::ConnectAPI::Device.all
, I saw that amongst all the devices returned, none of them hadMAC
asdevice_class
, andSpaceship::ConnectAPI::Device.all.map(&:device_class).uniq
returned"APPLE_SILICON_MAC", "IPHONE", "IPOD", "IPAD", "INTEL_MAC", "APPLE_WATCH", "APPLE_TV", "APPLE_VISION_PRO"
This to fix the issue, this PR:
INTEL_MAC
constant toDeviceClass
DeviceClass::APPLE_SILICON_MAC
andDeviceClass::INTEL_MAC
to the list ofdevice_classes
to filter on—alongside theDeviceClass::MAC
that was already there—whenplatform
is:macos
Testing Steps
I tested this by doing the same modifications as in this PR directly in the
vendor/bundle/ruby/3.2.0/gems/fastlane-2.219.0/spaceship/lib/spaceship/connect_api/models/device.rb
of my project's working copy (like an animal 😅 ) then re-run our lane that callsmatch
without any change, and this time it finally passed and created the profile as expected.