如何解决错误:您无权运行分析。请联系 GitLab 集成中的项目管理员

我正在为 .NET 项目配置 GitLab ci 管道。我正在尝试使用声纳云运行代码分析。当我运行分析时,我遇到了错误说

ERROR: You’re not authorized to run analysis. Please contact the project administrator. ,

似乎生成了分析报告,当它尝试将分析报告上传到声纳云时,执行失败并出现错误。请建议如何克服此错误并成功运行分析。

PowerShell 脚本中用于运行分析的命令:

echo "sonarqube installation"
dotnet tool install --global dotnet-sonarscanner --version 5.2.0

dotnet sonarscanner begin /k:"proj1" /d:sonar.login="auth-token" /d:sonar.host.url="https://sonarqube-server.com" /d:project.settings="C:buildsproj1sonar-project.properties"

# dotnet build command

dotnet sonarscanner end /d:sonar.login="auth-token"
echo "sonar scanning completed"

这是我的声纳项目.properties。我现在已经删除了这些值。

# required metadata
sonar.projectKey=proj1
sonar.projectName=proj1
sonar.projectVersion=1.6
sonar.organization=proj1
sonar.sources='sources list'
sonar.javascript.lcov.reportPath=
sonar.javascript.jstest.reportsPath=

#ignore rules
sonar.issue.ignore.multicriteria=

# function complexity
sonar.issue.ignore.multicriteria.e1.ruleKey=
sonar.issue.ignore.multicriteria.e1.resourceKey=

# unused variable
sonar.issue.ignore.multicriteria.e2.ruleKey=
sonar.issue.ignore.multicriteria.e2.resourceKey=

# function with too many line
sonar.issue.ignore.multicriteria.e3.ruleKey=
sonar.issue.ignore.multicriteria.e3.resourceKey=

# trailing comma
sonar.issue.ignore.multicriteria.e4.ruleKey=
sonar.issue.ignore.multicriteria.e4.resourceKey=

# === and  !==
sonar.issue.ignore.multicriteria.e5.ruleKey=
sonar.issue.ignore.multicriteria.e5.resourceKey=

# Commented Code
sonar.issue.ignore.multicriteria.e6.ruleKey=
sonar.issue.ignore.multicriteria.e6.resourceKey=

# Nested If Depth
sonar.issue.ignore.multicriteria.e7.ruleKey=
sonar.issue.ignore.multicriteria.e7.resourceKey=

sonar.issue.ignore.multicriteria.e8.ruleKey=
sonar.issue.ignore.multicriteria.e8.resourceKey=

# Trailing Whitespace
sonar.issue.ignore.multicriteria.e9.ruleKey=
sonar.issue.ignore.multicriteria.e9.resourceKey=

# Literal boolean values
sonar.issue.ignore.multicriteria.e10.ruleKey=
sonar.issue.ignore.multicriteria.e10.resourceKey=

# Variables and functions redeclared
sonar.issue.ignore.multicriteria.e11.ruleKey=
sonar.issue.ignore.multicriteria.e11.resourceKey=

# Unused function argument
sonar.issue.ignore.multicriteria.e12.ruleKey=
sonar.issue.ignore.multicriteria.e12.resourceKey=

我已经尝试授予在声纳云中运行分析的所有权限。

stack overflow How to resolve ERROR: You're not authorized to run analysis. Please contact the project administrator in GitLab Integration
原文答案

答案:

作者头像

对我来说,在Sonar生成新令牌后未解决(sonarcloud-> Account-> myaccount-> security-> security--> enter token name--> generate-> generate->复制令牌)并配置带有nevirational nation的环境变量的代币,Sonar_token用于Bitbucket存储库。删除在Bitbucket中配置的任何旧Sonar_token。以前配置的令牌被某人撤销,这导致未授权错误。

查看Gitlab集成中是否有效