[英]Gitlab Pipeline Job Token Fail
I have Gitlab Community and I am trying to integrate it with SonarQube.我有 Gitlab 社区,我正在尝试将它与 SonarQube 集成。 The Sonar is hosted on Azure VM Ubuntu in a Docker container.
声纳托管在 Docker 容器中的 Azure VM Ubuntu 上。 The problem is that I really don't know how to write
gitlab-ci.yml
.问题是我真的不知道怎么写
gitlab-ci.yml
。 I already try sonar, but locally hosted on a Windows machine.我已经尝试过声纳,但本地托管在 Windows 机器上。 Here is my current
gitlab-ci.yml
.这是我当前
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
MSBuild 5.0.4 的声纳扫描仪
Using the .NET Framework version of the Scanner for MSBuild使用 MSBuild 的扫描仪的 .NET 框架版本
Pre-processing started.预处理开始。
Preparing working directories...正在准备工作目录...
18:35:07.168 Updating build integration targets...18:35:07.168 更新构建集成目标...
18:35:07.394 The token you provided doesn't have sufficient rights to check license.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
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.
我没有解释为什么会发生这种情况,但这是一个可以采取的故障排除步骤。
I found the solution.我找到了解决方案。 You need to go to your sonar MyAccount->Security->Generate Token.
您需要 go 到您的声纳 MyAccount->Security->Generate Token。 This token must be added here:
必须在此处添加此令牌:
- 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"
and your sonar URL.和你的声纳 URL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.