-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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] migrate YAML.safe_load to support psych v4.0 #18825
Conversation
316659e
to
301c9ca
Compare
@@ -72,6 +67,24 @@ def run | |||
return self | |||
end | |||
|
|||
def load_cookies(content) | |||
# When Ruby 2.5 support is dropped, we can safely get rid of the latter branch. | |||
if YAML.name == 'Psych' && Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1') |
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.
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.
Maybe we can include it in the code as a comment as a reference?
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.
Hmm not really? There's no explanation for this logic there. I can add another comment on what this comparison means if you want?
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 read the diff to understand the reasoning with Psych lib etc but I leave it to your criteria😁
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.
🚀
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.
👏 Thank you for finding and fixing this! You are the 3.0 hero ❤️
Hey @ainame 👋 Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉 Please let us know if this change requires an immediate release by adding a comment here 👍 |
Congratulations! 🎉 This was released as part of fastlane 2.185.1 🚀 |
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 validMotivation and Context
Closes #18768
#17931 (comment)
psych
v4.0.0 was released lately and it has a breaking change that breaks fastlane in two ways. One is to breakhttp-cookie
gem, another is by removing legacy positional parameters used inspaceauth_runner.rb
.JFYI:
psych
is a backend implementation of YAML used by default in Ruby.psych
gem is categorised as "default" gem which means it's bundled in Ruby but you can update it to whatever version you want optionally. Ruby 3.0.1 bundlespsych
v3.3.0 but on the master branch ofruby/ruby
it now points to v4.0.1, which means that it is very likely fastlane users using the next Ruby version (Ruby 3.1.0) are going to see errors due topsych
v4.0.1.Thanks to this ticket #18768,
http-cookie
is now fixed. This PR migratesspaceauth_runner.rb
using the legacy positional parameters onYAML.safe_load
which are removed inpsych
v4.0.0.Description
It is a bit tricky that we need to maintain legacy positional parameters to keep Ruby 2.5 support. Otherwise, it is very straightforward.
v4.0.1 (bundled in Ruby head) https://github.com/ruby/psych/blob/v4.0.1/lib/psych.rb#L323
It's cleaned up. It no longer contains positional arguments for options.
v3.3.0 (bundled in Ruby 3.0.1) https://github.com/ruby/psych/blob/v3.3.0/lib/psych.rb#L329
There are positional parameters named as
legacy
to keep compatibility.v3.0.2 (bundled in Ruby 2.5.0) https://github.com/ruby/psych/blob/v3.0.2/lib/psych.rb#L313
There is not keyword arguments for options yet.
Testing Steps
I believe unit tests cover this change but you can give
spaceauth
a try to see if serialised cookie object is restored from yaml file.