SonarQube with Azure Pipeline YAML

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Version 7.9.2 (build 30863)
  • what are you trying to achieve
    Run SonarQube analysis with YAML instead of “classic” pipelines
  • what have you tried so far to achieve this
    We went through the entire documentation, tried from various angles. No success so far.

Hi there,

we are running on-prem SonarQube from Azure Pipelines with Azure Pipeline Agent.
We have two pipelines to initiate scans. The first one with classic setup works just fine.
The second one with pure YAML in , that should replace the “classic” one does not.

We have extracted the YAML from the original pipeline without success. We receive the error message during preparation step:
##[error][SQ] API GET '/api/server/version' failed, error was: {"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","hostname":"myserver.mydomain.com","host":"servername.domain.com","port":"1234"}

The error message is quite clear, the login with the token does not appear to be working.

But what puzzles me is that it does work with the exact same token and the same config in the “classic” pipeline.

Is there something that I’m not considering?

Traditional Pipeline


YAML Pipeline
# https://aka.ms/yaml

trigger:
- develop

steps:
- task: SonarQubePrepare@4
  displayName: 'Prepare apex-web code analysis on SonarQube'
  inputs:
    SonarQube: 'WBAD SonarQube'
    scannerMode: CLI
    configMode: 'file'
  timeoutInMinutes: 300    
- task: SonarQubeAnalyze@4
  displayName: 'Run apex-web code analysis on SonarQube'
- task: SonarQubePublish@4
  displayName: 'Publish apex-web analysis results to quality gate on SonarQube'
  inputs:
    pollingTimeoutSec: '300'
  continueOnError: true
  timeoutInMinutes: 300

Dear everyone.
I answered my own question.

The step to define which pool I’m addressing was missing.

pool: "My Private Agent Pool"

after adding that to our YAML it works just fine.

thank me :slight_smile:
roman

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.