Skip to content

[deliver] keep an explicitly set platform when a pkg is present - #30224

Merged
iBotPeaches merged 3 commits into
fastlane:masterfrom
anandghegde:deliver-keep-explicit-platform
Sep 15, 2026
Merged

iBotPeaches merged 3 commits into
fastlane:masterfrom
anandghegde:deliver-keep-explicit-platform

Conversation

@anandghegde

Copy link
Copy Markdown
Contributor

Credit to @Loupv for the detailed report and root-cause analysis in #30213.

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 GitHub Action builds in the "All checks have passed" section of my PR.
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.
  • I've added or updated relevant unit tests.

Motivation and Context

Deliver::DetectValues#find_platform sets platform to osx whenever pkg is set. pkg defaults to any *.pkg in the current directory, so a metadata-only iOS lane run from a folder that happens to contain a pkg gets its explicit platform: "ios" replaced with osx. deliver then creates a macOS version on the app record, skips release notes as "first version of the app", and exits 0.

Resolves #30213

Description

The fix suggested in the issue (options[:platform] ||= 'osx') doesn't work on its own: platform has default_value: "ios", so options[:platform] is never nil and ||= would never pick osx. That would break macOS uploads that rely on the pkg to infer the platform, e.g. upload_to_app_store after gym builds a pkg.

Instead, find_platform now only infers osx from the pkg when the user hasn't set a platform. "Set" means passed in directly, set through DELIVER_PLATFORM, or set in the Deliverfile, which are the non-default sources Configuration#fetch reads from.

The ipa branch is unchanged, and it still takes precedence when both an ipa and a pkg are present.

Testing Steps

Added find_platform specs in deliver/spec/detect_values_spec.rb. Each one builds real Deliver::Options in a temp dir that contains a MyApp.pkg or MyApp.ipa:

  • pkg present, no platform -> osx
  • pkg present, platform: 'ios' passed -> ios (fails on master)
  • pkg present, DELIVER_PLATFORM=ios -> ios (fails on master)
  • pkg present, platform('ios') in Deliverfile -> ios
  • ipa present, no platform -> ios

I also tried the plain ||= change, and the "no platform -> osx" example fails with it.

Run in a ruby:3.3 container:

  • bundle exec rspec deliver/spec/detect_values_spec.rb: 14 examples, 0 failures
  • bundle exec rspec deliver: 243 examples, 0 failures
  • bundle exec rubocop on the two changed files: no offenses
  • bundle exec rspec from the root: 7861 examples, 2 failures. Both are in fastlane/spec/plugins_specs/plugin_generator_spec.rb (the generated plugin's rubocop/rake checks) and fail the same way on unmodified master in the same container.

@iBotPeaches iBotPeaches left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! Take a look at this PR to see an alternative approach to the chdir so our parallel tests don't stomp on themselves - #30221

@lacostej

Copy link
Copy Markdown
Collaborator

@anandghegde BTW one of the PR builds had failed. It caught an unrelated test stability issue we just fixed in #30225. I relaunched it to get it green.

… specs

Use an around block with Dir.mktmpdir and the block form of Dir.chdir,
as in fastlane#30221, instead of a before/after chdir pair.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01MA8JGs7pCoXFL2W6jEJ8sD
@anandghegde

Copy link
Copy Markdown
Contributor Author

@iBotPeaches thanks, switched the find_platform specs to the #30221 pattern in b79e6bf: an around block with its own Dir.mktmpdir and the block form of Dir.chdir, so the before/after chdir pair is gone. bundle exec rspec deliver (random order, merged with current master) gives 243 examples and 0 failures, and rubocop is clean.

@lacostej thanks for relaunching the build.

Comment thread deliver/lib/deliver/detect_values.rb Resolved
Move the check for whether an option was passed in, set through an
environment variable or read from the config file into Configuration,
next to fetch, so deliver can call options.specified?(:platform).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01MA8JGs7pCoXFL2W6jEJ8sD

@lacostej lacostej left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@iBotPeaches
iBotPeaches merged commit f05f95e into fastlane:master Sep 15, 2026
22 checks passed

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey @anandghegde 👋

Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a month, and your PR will be included in the next one.

Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀"

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Congratulations! 🎉 This was released as part of fastlane 2.240.1 🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deliver: an explicit platform: "ios" is overwritten by "osx" when any *.pkg sits in the working directory, then the run uploads nothing and exits 0

3 participants