How to generate a common/generic token in Jenkins for all Jobs?

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Sonarqube enterprise edition

  • what are you trying to achieve

We have a CI tool as Jenkins and we have bitbucket as our source code repository and also have Jenkins files. We have around 300 projects and we don’t want to generate 300 separate tokens for each project to integrate Jenkins → Bitbucket ->Sonar. Is there a way we can generate a generic token, that authenticates Jenkins job to scan code in Sonar instead of adding separate tokens for each project?

  • what have you tried so far to achieve this
    We created a token with an admin account but that also didn’t authenticate the project and we are getting the below error.

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project request-transporter: You must define the following mandatory properties for ‘com.wccgroup.pdg:request-transporter’: sonar.organization → [Help 1]

Any help is appreciated.

Hi,

Welcome to the community!

You can certainly generate a user token from a user with global analysis rights and use it for all your pipelines. There’s no need at all to generate a token per project if you don’t want to.

Regarding the error you got, can you provide the full analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.