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] Automate phone number selection for "request code via SMS" in 2FA with SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER
env var
#14436
[spaceship] Automate phone number selection for "request code via SMS" in 2FA with SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER
env var
#14436
Conversation
SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER
env var
Thanks for your great work @janpio 🙏 Will test this and give feedback. Is only running |
That should execute that code, yes. But testing in other circumstances (normal spaceship usage) is of course also welcome. |
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.
@janpio I left a few small suggestions about masking numbers and changing some of the CLI output but this is so 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
Documentation part of this PR is taken care of via #14524 which will create https://github.com/fastlane/fastlane/blob/master/spaceship/docs/Authentication.md |
…developer [like me!])
only read ENV var once
eeef6e8
to
00da023
Compare
and some empty lines for structure
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.
This is so goooooood! We are shipping this tomorrow 💪
Hey @janpio 👋 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.121.0 🚀 |
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
2FA with token entry is a hassle to fastlane users. Some use cases also force people to use trusted phone numbers instead of the usual pushed tokens, so we can streamline their workflow by allowing them to skip the pushed token and remove the necessary interaction to get a token sent to a specific phone number.
Description
The new environment variable
SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER
allows you to set a phone number, that is automatically used as the recipient of the 2FA token. You do not have to "escape" the normal input via inputtingsms
and then selecting your phone number from a dropdown any more.Testing
I wrote a few tests for the specific methods I introduced that helped me to make sure they actually do what I expected them to do. Then I manually tested via
bundle exec fastlane spaceauth
as it basically just does the spaceship login - which is what this code impacts.Unrelated changes
This PR also includes a little comment in the cert runner and changes the way
fastlane spaceauth
handles exceptions - before they were just swallowed, but as my new code raises one if it can't find the correct phone number, that was not very good for testing. Now they are bubbled up to the user.closes #13980
Review Notes
phone_id_from_number
, the way I find thephone_id
for the value of the ENV variable via the regex pattern, and especially the way I build it looks really crap and complicated. Is there a better way to do this?