当我的项目在jenkins中构建时,我想在我的项目上运行声纳扫描仪。
大多数教程似乎只从 Java 的角度解决这个过程,所以我想知道如果有的话,如何做到这一点。
我正在我的项目中使用 Jenkinsfile 做一些工作:
stage('SonarQube') {
environment {
scannerHome = tool 'SonarQubeScanner'
}
steps {
withSonarQubeEnv('SonarQubeScanner') {
sh "${scannerHome}/bin/sonar-scanner"
}
}
}
我使用以下链接在 SonarQube 中获取项目:https ://nickkorbel.com/2020/02/05/configuring-sonar-with-a-create-react-app-in-typescript/
在 Jenkins 构建期间尝试运行扫描时出现几个不同的错误:
错误 1
Could not find executable in "/opt/app-root/src/.sonar/native-sonar-scanner".
Proceed with download of the platform binaries for SonarScanner...
Creating /opt/app-root/src/.sonar/native-sonar-scanner
Downloading from https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.4.0.2170-linux.zip
(executable will be saved in cache folder: /opt/app-root/src/.sonar/native-sonar-scanner)
ERROR: impossible to download and extract binary: connect ETIMEDOUT
错误 2
ERROR: Failed to download https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.4.0.2170-linux.zip from agent; will retry from master
SonarQube installation defined in this job (sonarqube) does not match any configured installation. Number of installations that can be configured: 1.