来自CircleCI的SonarCloud错误:请检查属性sonar.login和sonar.password



我试图让 SonarCloud.io 使用CircleCI。我有一个有效的CircleCI配置(SonarCloud位除外(,并遵循了SonarCloud中的设置说明。我的 CircleCI config.yml 看起来像这样:

version: 2.1
orbs:
sonarcloud: sonarsource/sonarcloud@1.0.1
jobs:
build:
docker:
- image: circleci/node:9.9
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run: npm test            
- run:
name: Deploy circle-ci to Heroku Master
command: |
git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git +HEAD:master
- sonarcloud/scan
workflows:
main:
jobs:
- build:
context: SonarCloud

我已经为我的团队添加了sonar.projectKeysonar.organizationsonar-project.propertiesSONAR_TOKENSONAR_TEAMSONAR_PROJECT_KEY到CircleCI SonarCloud上下文中。

当管道在 CircleCI 中运行时,我得到以下输出:

NFO: Scanner configuration file: /tmp/cache/scanner/sonar-scanner-4.1.0.1829-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/circleci/repo/sonar-project.properties
INFO: SonarQube Scanner 4.1.0.1829
INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
INFO: Linux 4.15.0-1052-aws amd64
INFO: User cache: /tmp/cache/scanner/.sonar/cache
INFO: SonarQube server 8.0.0
INFO: Default locale: "en", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 3.271s
INFO: Final Memory: 5M/56M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: **Not authorized. Please check the properties sonar.login and sonar.password.**
ERROR: 
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
Exited with code exit status 2

许多其他人似乎都遇到过这个问题,但我看到的答案都不符合我的情况或有效。

查看它想要设置sonar.login的错误。您似乎依赖于SONAR_TOKEN,但根据 https://docs.sonarqube.org/latest/user-guide/user-token/令牌应设置在sonar.login上。使用令牌进行sonar.login无需设置sonar.password

相关内容

最新更新