Gitlab 管道作业令牌失败
Gitlab Pipeline Job Token Fail
我有 Gitlab 社区,我正在尝试将它与 SonarQube 集成。 Sonar 托管在 Azure VM Ubuntu 的 Docker 容器中。问题是我真的不知道怎么写gitlab-ci.yml
。我已经尝试过声纳,但本地托管在 Windows 机器上。这是我目前的 gitlab-ci.yml
.
当我用我的电流更换声纳主机时,我不确定我需要在声纳上放什么。登录然后抛出错误:
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
我找到了解决方案。您需要转到您的声纳 MyAccount->Security->Generate Token。
必须在此处添加此令牌:
- SonarScanner.MSBuild.exe begin /k:"somefile" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="8f6658e7684de225a4f45c7cf3466d462a95c1c7"
- SonarScanner.MSBuild.exe end /d:sonar.login="8f6658e7684de225a4f45c7cf3466d462a95c1c7"
和你的声纳 URL。
对于因类似问题而来到这里的任何人,您已经正确设置了东西但突然停止工作,我刚刚遇到过这种情况。我必须生成一个新的身份验证令牌,这样才能正常工作。虽然我没有解释为什么会发生这种情况,但这是一个可以采取的故障排除步骤。
我有 Gitlab 社区,我正在尝试将它与 SonarQube 集成。 Sonar 托管在 Azure VM Ubuntu 的 Docker 容器中。问题是我真的不知道怎么写gitlab-ci.yml
。我已经尝试过声纳,但本地托管在 Windows 机器上。这是我目前的 gitlab-ci.yml
.
当我用我的电流更换声纳主机时,我不确定我需要在声纳上放什么。登录然后抛出错误:
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
我找到了解决方案。您需要转到您的声纳 MyAccount->Security->Generate Token。 必须在此处添加此令牌:
- SonarScanner.MSBuild.exe begin /k:"somefile" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="8f6658e7684de225a4f45c7cf3466d462a95c1c7"
- SonarScanner.MSBuild.exe end /d:sonar.login="8f6658e7684de225a4f45c7cf3466d462a95c1c7"
和你的声纳 URL。
对于因类似问题而来到这里的任何人,您已经正确设置了东西但突然停止工作,我刚刚遇到过这种情况。我必须生成一个新的身份验证令牌,这样才能正常工作。虽然我没有解释为什么会发生这种情况,但这是一个可以采取的故障排除步骤。