Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab Pipeline Job Token Fail

I have Gitlab Community and I am trying to integrate it with SonarQube. The Sonar is hosted on Azure VM Ubuntu in a Docker container. The problem is that I really don't know how to write gitlab-ci.yml. I already try sonar, but locally hosted on a Windows machine. Here is my current gitlab-ci.yml.

When I change sonar host with my current and I am not sure what I need to put on sonar. Login then throws an error:

SonarScanner for MSBuild 5.0.4
Using the .NET Framework version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories...
18:35:07.168 Updating build integration targets...
18:35:07.394 The token you provided doesn't have sufficient rights to check license.

sonar-check:
  image:
    name: sonarsource/sonar-scanner-cli:latest
    entrypoint: [""]
  cache:
    key: "${CI_JOB_NAME}"
    paths:
      - .sonar/cache
  dependencies:
    - build
  script:
    - choco install sonarqube-scanner.portable
    - SonarScanner.MSBuild.exe begin /k:"somefile" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="8f6658e7684de225a4f45c7cf3466d462a95c1c7"   
    - nuget restore -ConfigFile .\nuget.config
    - MsBuild.exe ./Process /t:Rebuild
    - SonarScanner.MSBuild.exe end /d:sonar.login="8f6658e7684de225a4f45c7cf3466d462a95c1c7"
  only:
    - merge_requests
    - master
    - develop
    - GitLabQualityTool

2 Answers

Maybe your SonarQube scanner is out of date

I faced the Same Issue Error Message

I solved this issue by this command dotnet tool update --global dotnet-sonarscanner

enter image description here

And it worked right after

enter image description here

like image 128
Kareem Mersal Avatar answered Mar 23 '26 08:03

Kareem Mersal


For anyone coming here for a similar problem where you had things set up correctly and suddenly they stopped working, I just experienced this. I had to generate a new auth token and that got things working correctly. I don't have an explanation for why that occurred though, but this is a troubleshooting step one could take.

like image 29
nibudd Avatar answered Mar 23 '26 08:03

nibudd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!