I’m using SonarQube Scanner as a plugin in Jenkins and I’m trying to configure it on a Jenkins Job which is triggered on a pull request in GitHub.
I normally use SonarQube Scanner on my main Jenkins Job the following way and everything works:
- SonarQube Scanner Begin Analysis (with setup Project Key, Name and Version)
- SonarQube Scanner End Analysis
I’m trying to put it on the pull request job in preview mode so whenever a pull request is made the Jenkins job is triggered and the SonnarQube Scanner makes his analysis without pushing it to the real project in Sonnar and post the errors as a comment on GitHub.
I have an example of this thing working with Jenkins Pipeline and from there I saw that there are a couple of arguments that need to be set up in order for the Scanner to work this way and I figure it out that these arguments can be passed in the Additional arguments field as follows:
/d:sonar.github.repository=[GitHub Repository Url]
/d.sonar.github.oauth=[some Sonnar Key for GitHub i guess]
Unfortunately, I can’t understand where should I get this OATH key and is this the right way to do this kind of integration or there is some other way to do this that is more appropriate?
Thanks in advance for any help!