Search code examples
azureazure-devopssonarqubeazure-pipelinessonarqube-scan

Getting ETIMEOUT error while integrating sonarqube with azure


I am trying to integrate sonarqube (enterprise version) with my azure. I am working on an iOS Mobile application Project.

I have added following task for preparing to do sonar analysis in my azure pipeline.

    - 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/**/*

The azure build pipeline fails on this task with the following error:

    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}

I am unable to understand why it is failing?

I haven't installed any sonar scanner. Do I really need to install one? If yes, then where should it be installed?


Solution

  • I was using an entreprise version of Sonar and it failed to connect to MAC systems.

    So, I created a separate job for sonar and assigned the agent machine as WINDOWS. Since sonar runs static analysis, it doesn't require a mac machine to do an analysis of my iOS App code.

    - job: Sonar_Analysis
    
     pool:
        vmImage: 'windows-2019'
    
      steps:
      - task: SonarQubePrepare@4
        displayName: 'Prepare for Sonar'
    

    and so on...