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

Increase limit for build query in distribute to handle multiple platforms #21087

Merged

Conversation

eric
Copy link
Contributor

@eric eric commented Feb 28, 2023

The platform condition is filtered on the client side, so enough builds need to be returned to find the correct platform.

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.

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 to Spaceship::ConnectAPI::Platform.size.

Testing Steps

Have a build that has several platforms and try to distribute them separately on testflight.

The platform condition is filtered on the client side, so enough builds need
to be returned to find the correct platform.
Copy link
Member

@joshdholtz joshdholtz left a 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 🙌

@joshdholtz joshdholtz merged commit 3b937c0 into fastlane:master Feb 28, 2023
@@ -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

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

cc @joseignacioojeda

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'

Choose a reason for hiding this comment

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

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

Successfully merging this pull request may close these issues.

None yet

4 participants