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
Increase limit for build query in distribute to handle multiple platforms #21087
Increase limit for build query in distribute to handle multiple platforms #21087
Conversation
The platform condition is filtered on the client side, so enough builds need to be returned to find the correct platform.
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.
OMG, great find! Thanks for the fix 🙌
@@ -157,7 +157,7 @@ def distribute(options, build: nil) | |||
end | |||
end | |||
platform = Spaceship::ConnectAPI::Platform.map(fetch_app_platform) | |||
build ||= Spaceship::ConnectAPI::Build.all(app_id: app.id, version: app_version, build_number: build_number, sort: "-uploadedDate", platform: platform, limit: 1).first | |||
build ||= Spaceship::ConnectAPI::Build.all(app_id: app.id, version: app_version, build_number: build_number, sort: "-uploadedDate", platform: platform, limit: Spaceship::ConnectAPI::Platform.size).first |
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.
With the new release containing this change, our builds are now failing with this error 😬 :
bundler: failed to load command: fastlane (/Users/builder/.rbenv/versions/3.0.4/bin/fastlane)
/Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/pilot/lib/pilot/build_manager.rb:160:in `distribute': \e[31m[!] undefined method `size' for Spaceship::ConnectAPI::Platform:Module\e[0m (NoMethodError)
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/actions/upload_to_testflight.rb:32:in `run'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/actions/actions_helper.rb:69:in `execute_action'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:229:in `chdir'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
from Fastfile:173:in `distribute_testflight'
from Fastfile:15:in `block (2 levels) in parsing_binding'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/lane.rb:33:in `call'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:45:in `chdir'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:45:in `execute'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/lane_manager.rb:47:in `cruise_lane'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/commands_generator.rb:110:in `block (2 levels) in run'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in `run!'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/commands_generator.rb:354:in `run'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/commands_generator.rb:43:in `start'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/fastlane-2.212.2/bin/fastlane:23:in `<top (required)>'
from /Users/builder/.rbenv/versions/3.0.4/bin/fastlane:25:in `load'
from /Users/builder/.rbenv/versions/3.0.4/bin/fastlane:25:in `<top (required)>'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/site_ruby/3.0.0/bundler/cli/exec.rb:58:in `load'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/site_ruby/3.0.0/bundler/cli/exec.rb:58:in `kernel_load'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/site_ruby/3.0.0/bundler/cli/exec.rb:23:in `run'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/site_ruby/3.0.0/bundler/cli.rb:492:in `exec'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/site_ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/site_ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/site_ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/site_ruby/3.0.0/bundler/cli.rb:34:in `dispatch'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/site_ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/site_ruby/3.0.0/bundler/cli.rb:28:in `start'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/bundler-2.4.8/exe/bundle:45:in `block in <top (required)>'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/site_ruby/3.0.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
from /Users/builder/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/bundler-2.4.8/exe/bundle:33:in `<top (required)>'
from /Users/builder/.rbenv/versions/3.0.4/bin/bundle:25:in `load'
from /Users/builder/.rbenv/versions/3.0.4/bin/bundle:25:in `<main>'
rolling back to fastlane 2.212.1
fixes it.
Based on the fastlane
gem doc, there doesn't seem to be a Platform.size
🤔
https://www.rubydoc.info/gems/fastlane/Spaceship/ConnectAPI/Platform
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.
I also got error with fastlane 2.212.2.
bundle exec fastlane run upload_to_testflight distribute
was OK with fastlane 2.212.1.
bundle exec fastlane run upload_to_testflight distribute
filed with fastlane 2.212.2.
bundler: failed to load command: fastlane (/opt/homebrew/lib/ruby/gems/3.2.0/bin/fastlane)
/opt/homebrew/lib/ruby/gems/3.2.0/gems/fastlane-2.212.2/pilot/lib/pilot/build_manager.rb:160:in `distribute': [!] undefined method `size' for Spaceship::ConnectAPI::Platform:Module (NoMethodError)
build ||= Spaceship::ConnectAPI::Build.all(app_id: app.id, version: app_version, build_number: build_number, sort: "-uploadedDate", platform: platform, limit: Spaceship::ConnectAPI::Platform.size).first
^^^^^
from /opt/homebrew/lib/ruby/gems/3.2.0/gems/fastlane-2.212.2/fastlane/lib/fastlane/actions/upload_to_testflight.rb:32:in `run'
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.
I've created an issue here to centralize the discussions :
The platform condition is filtered on the client side, so enough builds need to be returned to find the correct platform.
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 using
fastlane pilot distribute --app_platform
fastlane only queries for one result even though the platform param needs to query on the client side. This makes sure enough entries are returned to do the client side filtering.Description
Increases the limit of the query from
1
toSpaceship::ConnectAPI::Platform.size
.Testing Steps
Have a build that has several platforms and try to distribute them separately on testflight.