将 sonarqube 与 azure 集成时出现 ETIMEOUT 错误
Posted
技术标签:
【中文标题】将 sonarqube 与 azure 集成时出现 ETIMEOUT 错误【英文标题】:Getting ETIMEOUT error while integrating sonarqube with azure 【发布时间】:2021-10-08 00:18:46 【问题描述】:我正在尝试将 sonarqube(企业版)与我的 azure 集成。我正在开发一个 ios 移动应用程序项目。
我添加了以下任务,以准备在我的 Azure 管道中进行声纳分析。
- task: SonarQubePrepare@4
displayName: 'Prepare for Sonar'
inputs:
SonarQube: 'SONARSERVICECONNECTION'
scannerMode: 'CLI'
configMode: 'manual'
cliProjectKey: 'com.ios.demoapp'
cliProjectName: 'com.ios.demo'
cliSources: '.'
extraProperties: |
# Additional properties that will be passed to the scanner,
# Put one key=value per line, example:
sonar.host.url=https://sonarprod.abc.xyz
sonar.login=d8s902h3hhh3jkl2kl2bn2j2l2b2kk2bn2
sonar.test.inclusions=**/*Test*/**
sonar.test.inclusions=*.swift
sonar.exclusions=Pods/**/*
Azure 构建管道在此任务上失败,并出现以下错误:
Starting: Prepare for Sonar
==============================================================================
Task : Prepare Analysis Configuration
Description : Prepare SonarQube analysis configuration
Version : 4.21.0
Author : sonarsource
Help : Version: 4.21.0. [More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================
##[debug]Using node path: /Users/runner/runners/2.189.0/externals/node/bin/node
##[debug]agent.TempDirectory=/Users/runner/work/_temp
##[debug]loading inputs and endpoints
##[debug]loading INPUT_SONARQUBE
##[debug]loading INPUT_SCANNERMODE
##[debug]loading INPUT_CONFIGMODE
##[debug]loading INPUT_CONFIGFILE
##[debug]loading INPUT_CLIPROJECTKEY
##[debug]loading INPUT_CLIPROJECTNAME
##[debug]loading INPUT_CLIPROJECTVERSION
##[debug]loading INPUT_PROJECTVERSION
##[debug]loading INPUT_CLISOURCES
##[debug]loading INPUT_EXTRAPROPERTIES
##[debug]loading ENDPOINT_AUTH_c36045b9-93fa-4ab7-95d0-205b5621232e
##[debug]loading ENDPOINT_AUTH_SCHEME_c36045b9-93fa-4ab7-95d0-205b5621232e
##[debug]loading ENDPOINT_AUTH_PARAMETER_c36045b9-93fa-4ab7-95d0-205b5621232e_USERNAME
##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
##[debug]loading SECRET_P12PASSWORD
##[debug]loading SECRET_KEYCHAINPASSWORD
##[debug]loaded 19
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]SonarQube=c36045b9-93fa-4ab7-95d0-205b5621232e
##[debug]c36045b9-93fa-4ab7-95d0-205b5621232e=https://sonarprod.abc.xyz
##[debug]c36045b9-93fa-4ab7-95d0-205b5621232e auth param apitoken = null
##[debug]c36045b9-93fa-4ab7-95d0-205b5621232e auth param username = ***
##[debug]c36045b9-93fa-4ab7-95d0-205b5621232e auth param password = null
##[debug]organization=null
##[debug]scannerMode=CLI
##[debug]configMode=manual
##[debug]cliProjectKey=com.ios.demoapp
##[debug]cliProjectName=com.ios.demo
##[debug]cliProjectVersion=1.0
##[debug]cliSources=/Users/runner/work/1/s
##[debug][SQ] API GET: '/api/server/version' with query "undefined"
##[debug][SQ] API GET '/api/server/version' failed, error was: "code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"***.**.***.**","port":443
##[debug]task result: Failed
##[error][SQ] API GET '/api/server/version' failed, error was: "code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"***.**.***.**","port":443
##[debug]Processed: ##vso[task.issue type=error;][SQ] API GET '/api/server/version' failed, error was: "code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"***.**.***.**","port":443
##[debug]Processed: ##vso[task.complete result=Failed;][SQ] API GET '/api/server/version' failed, error was: "code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"57.188.3.133","port":443
我无法理解为什么会失败?
我没有安装任何声纳扫描仪。我真的需要安装一个吗?如果是,那么应该安装在哪里?
【问题讨论】:
【参考方案1】:我使用的是企业版 Sonar,但无法连接到 MAC 系统。
所以,我为声纳创建了一个单独的作业,并将代理机器分配为 WINDOWS。由于 sonar 运行静态分析,因此不需要 mac 机器对我的 iOS App 代码进行分析。
- job: Sonar_Analysis
pool:
vmImage: 'windows-2019'
steps:
- task: SonarQubePrepare@4
displayName: 'Prepare for Sonar'
等等……
【讨论】:
以上是关于将 sonarqube 与 azure 集成时出现 ETIMEOUT 错误的主要内容,如果未能解决你的问题,请参考以下文章
将 vs 2012 C# 与 visio 2007 集成时出现 Com 错误