Gitlab 管道作业令牌失败

3 ubuntu azure docker sonarqube gitlab-ci

我有 Gitlab 社区,我正在尝试将其与 SonarQube 集成。Sonar 托管在 Docker 容器中的 Azure VM Ubuntu 上。问题是我实在不知道怎么写gitlab-ci.yml。我已经尝试过声纳,但本地托管在 Windows 计算机上。这是我当前的gitlab-ci.yml.

当我用当前的声纳主机更换时,我不确定需要在声纳上安装什么。然后登录会抛出错误:

SonarScanner for MSBuild 5.0.4
使用 .NET Framework 版本的 Scanner for MSBuild
预处理已启动。
正在准备工作目录...
18:35:07.168 正在更新构建集成目标...
18:35:07.394 您提供的令牌没有足够的权限来检查许可证。

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
Run Code Online (Sandbox Code Playgroud)

小智 7

也许您的 SonarQube 扫描仪已过时

我遇到了同样的问题错误信息

我通过这个命令 dotnet tool update --global dotnet-sonarscanner 解决了这个问题

在此输入图像描述

之后它就起作用了

在此输入图像描述