3

I am trying to use SonarCloud with Travis-CI and getting the following error:

* What went wrong:

Execution failed for task ':sonarqube'.

You're only authorized to execute a local (preview) SonarQube analysis without pushing the results to the SonarQube server. Please contact your SonarQube administrator.

Here is the project on Github that I am trying to setup CI using Travis.

Here is the link for the Travis build that is failing executing the SonarQube step.

Here is the Travis config file

Here is the link for the Sonarcloud project.

On Travis I added the added the Env variable SONAR_TOKEN to 9d2401997a7368e6f351d50d7d99bbf1fae84624 and I see that it is picked up fine on the Travis Job Log.

I am very new to both Travis and Sonarqube, so any help is greatly appreciated.

Thanks, Shashi

Community
  • 1
  • 1
Shashi Deshetti
  • 1,354
  • 2
  • 11
  • 22
  • Possible duplicate of [this](https://stackoverflow.com/questions/38375162/not-authorized-to-execute-any-sonarqube-analysis-with-sonarqube-scanner-on-travi) SO question – Jeroen Heier Aug 18 '18 at 18:32
  • The [onboarding tutorial](https://sonarcloud.io/onboarding) is written for setting up analysis via Travis IIRC. You might try stepping through it. – G. Ann - SonarSource Team Aug 20 '18 at 17:52
  • @JeroenHeier While the error message is the same, but the issue and solution mentioned in the response doesn't seem like the reason for mine. I already setup my Travis file like mentioned in the response: "./gradlew sonarqube --no-daemon -Dsonar.organization=deshetti-github -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN" – Shashi Deshetti Aug 21 '18 at 18:25
  • @G.Ann-SonarSourceTeam Thanks for the response. The link you mentioned in your comment doesn't take me to any tutorial. Instead it just takes me directly to creating another new token. Can you please check the link once again. – Shashi Deshetti Aug 21 '18 at 18:27

1 Answers1

0

You need not set SONAR_TOKEN. If you are getting authorization error, because of a bad encrypted token.

The problem is with the travis encryption.

Correct encryption syntax:

travis encrypt 309473973909Z09R830 -r my-org/my-repo

No variable name, no quote.

If you are running travis encrypt inside your repo directory you can just use

travis encrypt 309473973909Z09R830

Kindly replace you token for309473973909Z09R830

This token can be used in place of secret as specified in the official travis documentation.

Santhosh Tpixler
  • 361
  • 4
  • 12