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

[action][sonar] replace deprecated sonar.login parameter with sonar.token #21736

Merged
merged 2 commits into from Dec 22, 2023

Conversation

Panajev
Copy link
Contributor

@Panajev Panajev commented Dec 17, 2023

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.
  • I've added or updated relevant unit tests.

Motivation and Context

Addresses #21436, for more information see SonarQube deprecation notice of the login property here: https://community.sonarsource.com/t/deprecating-sonar-login-and-sonar-password-in-favor-of-sonar-token/95829

Description

SonarQube has deprecated the login parameters and requires the token passed as -Dsonar.token. Warnings appear in fastlane

Testing Steps

Test changes when submitting data to sonarqube using a recent (5.0.x+) version of the sonar-scanner CLI too.

@Panajev Panajev marked this pull request as ready for review December 17, 2023 10:51
@Panajev Panajev changed the title chore: updated bundled dependencies fix: replaced deprecated sonar.login parameter with sonar.token Dec 17, 2023
@Panajev Panajev changed the title fix: replaced deprecated sonar.login parameter with sonar.token fix: [sonar-scanner][actions] replaced deprecated sonar.login parameter with sonar.token Dec 17, 2023
Copy link
Collaborator

@lacostej lacostej left a comment

Choose a reason for hiding this comment

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

Hello @Panajev Thanks for your first contribution :)

Could you look into the comment and see if it makes sense? Thanks

@Panajev
Copy link
Contributor Author

Panajev commented Dec 17, 2023

Hello @lacostej no worries, I checked your comment and took a stab at it. Added a couple of commits to sort it. Will squash them together to make the delta from my original commit easier.

@Panajev
Copy link
Contributor Author

Panajev commented Dec 17, 2023

The 2 options should conflict each other --> this means that the script should break if they are both set at the same time right?

@Panajev
Copy link
Contributor Author

Panajev commented Dec 17, 2023

I think the conflicting_options array should do the trick in terms of ensuring we cannot pass both options:

          FastlaneCore::ConfigItem.new(key: :sonar_login,
                                       env_name: "FL_SONAR_LOGIN",
                                       description: "Pass the Sonar Login Token (e.g: xxxxxxprivate_token_XXXXbXX7e)",
                                       deprecated: "Deprecated in sonar-scanner >= 5.0.x",
                                       optional: true,
                                       sensitive: true,
                                       conflicting_options: [:sonar_token]),
          FastlaneCore::ConfigItem.new(key: :sonar_token,
                                       env_name: "FL_SONAR_TOKEN",
                                       description: "Pass the Sonar Token (e.g: xxxxxxprivate_token_XXXXbXX7e)",
                                       optional: true,
                                       sensitive: true,
                                       conflicting_options: [:sonar_login]),

What do you think?

@Panajev
Copy link
Contributor Author

Panajev commented Dec 17, 2023

Tested a local project on the local fastlane fork after the changes above:
Screenshot 2023-12-17 at 15 48 56


Using the deprecated option (quick test and I did not re-gress the variable I passed to the old option, but it is just a local var):
Screenshot 2023-12-17 at 16 13 03


Trying to use the deprecated option as well as the old option:
Screenshot 2023-12-17 at 15 51 22


Using the new option only:
Screenshot 2023-12-17 at 15 57 55

@Panajev
Copy link
Contributor Author

Panajev commented Dec 17, 2023

This could still affect people on an old version of SonarQube though (not sure when the sonar.token property was added... I guess we could still use the old option if the user has an older SonarQube instance?).

Edit: This parameter was added to SonarQube (not the client) in March 2023 and SonarCloud should have updated in July ( https://community.sonarsource.com/t/deprecating-sonar-login-and-sonar-password-in-favor-of-sonar-token/95829 ) so it is reasonable to assume it is the default option.

Updated deprecation notice:
Screenshot 2023-12-17 at 16 29 27

@Panajev Panajev changed the title fix: [sonar-scanner][actions] replaced deprecated sonar.login parameter with sonar.token fix: [sonar][actions] replaced deprecated sonar.login parameter with sonar.token Dec 17, 2023
Copy link
Collaborator

@lacostej lacostej left a comment

Choose a reason for hiding this comment

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

LGTM. Anyone else wants to review?

@lacostej lacostej changed the title fix: [sonar][actions] replaced deprecated sonar.login parameter with sonar.token [action][sonar] replace deprecated sonar.login parameter with sonar.token Dec 17, 2023
Copy link
Member

@rogerluan rogerluan left a comment

Choose a reason for hiding this comment

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

Hi @Panajev 👋

Thanks for your PR!

Would you mind merging latest master into this branch? There was a recent fix in CI that needs to be merged into this PR so we can move it forward 🙏

I also left some comments in the PR 🙇

Thank you!

fastlane/lib/fastlane/actions/sonar.rb Outdated Show resolved Hide resolved
fastlane/lib/fastlane/actions/sonar.rb Outdated Show resolved Hide resolved
fastlane/swift/Fastlane.swift Outdated Show resolved Hide resolved
fastlane/lib/fastlane/actions/sonar.rb Outdated Show resolved Hide resolved
@Panajev
Copy link
Contributor Author

Panajev commented Dec 22, 2023

Thanks for your comments, I shall action them and report back :)!

@Panajev
Copy link
Contributor Author

Panajev commented Dec 22, 2023

@rogerluan implemented the suggestions. Resolved most of the conversation, left open the one I still had a question for you on (sorry if I should have closed none of them). Please let me know what you think :).

@rogerluan
Copy link
Member

Thanks @Panajev ! I've replied to the open discussion 😊 No apologies needed, all good with closing the resolved ones 🤗

@Panajev
Copy link
Contributor Author

Panajev commented Dec 22, 2023

@rogerluan thanks again for the kind feedback. Addressed by implementing your suggestion :)!

Copy link
Member

@rogerluan rogerluan left a comment

Choose a reason for hiding this comment

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

Looks good @Panajev ! Thank you for your contribution! 🤗

@rogerluan rogerluan merged commit 445c51e into fastlane:master Dec 22, 2023
2 checks passed
@Panajev Panajev deleted the fix/sonar_action_deprecation branch December 23, 2023 10:09
SubhrajyotiSen pushed a commit to KeepTruckin/fastlane that referenced this pull request Jan 17, 2024
…oken (fastlane#21736)

Co-authored-by: Goffredo Marocchi <goffredo.marocchi@gamesys.co.uk>
Co-authored-by: Roger Oba <rogerluan.oba@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants