简体   繁体   English

Gitlab 管道作业令牌失败

[英]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.

相关问题 kubernetes 服务的 gitlab 管道中的证书和服务令牌 - Certicate and Service token in gitlab pipeline for kubernetes service AZ CLI 命令在 GitLab 中触发管道时失败,读取一行时出现错误 EOF - AZ CLI commands fail when trigger the pipeline in GitLab with error EOF when reading a line Azure DevOps 管道中的 AzureResourceManagerTemplateDeployment 失败 - AzureResourceManagerTemplateDeployment fail in Azure DevOps pipeline 在 azure 管道 YAML 中延迟作业 - Delay a job in azure pipeline YAML GitLab CI/CD 管道 - 在 GitLab Runner 上交互式运行 Linux 命令 - GitLab CI/CD Pipeline - Run Linux commands interactively on GitLab Runner 将 Azure 管道与 Gitlab 集成(持续集成) - Integrating Azure pipeline with Gitlab (Continuous Integration) 从另一个管道调用时,被调用管道不会失败 - Called pipeline does not fail when called from another pipeline Azure DevOps 管道失败:序列不是预期的 - Azure DevOps Pipeline Fail: Sequence was not expected 向我们的发布管道添加了无代理作业,但它失败了 - Added agentless job to our release pipeline but it fails 等待 yaml 管道部署作业完成 - Waiting for a yaml pipeline deployment job to finish
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM