- SonarQube 8.9 LTS Developer edition, maven 3.6.3
- want to analyze repository brances - auto detection branches done but not getting analysed
- As per sonar docs and sonar qube dev edition configuration project steps followed exactly.
Service connection created and token from sonar qube generated and project configured.
Its java project. Below pipeline tasks configured.- Prepare analaysis task (from sonar qube Azure dev ops extension from marketplace)
- Maven build by selecting the check box of Run Sonar qube or sinar cloud analysis from advanced code anlysis option
- Publish code analysis results
All 3 are configured as 3 stages each having a job for above by pointing self hosted agent. Execution is successful. But source code is not getting analyzed. However if we configure same tasks under 1 single job as 3 different steps its failing with error as “No agent found in pool SonarQubeCodeAnalyser-Agent which satisfies the specified demands: agent.name -equals SonarQubeCodeAnalyserVM, maven, Agent.Version -gtVersion 2.163.1”
Below is the Yaml.
trigger:
- master
stages: - stage: A
jobs:-
job: Analyser
pool:
name: SonarQubeCodeAnalyser-Agent
demands:
- agent.name -equals SonarQubeCodeAnalyserVMsteps:
-
task: CmdLine@2
inputs:
script: ‘echo Hello world’ -
task: SonarQubePrepare@5
inputs:
SonarQube: ‘SonarQubeDevEditionForGenNXT’
scannerMode: ‘Other’
extraProperties: ‘sonar.projectKey=GenNXT_GenNXT’
-
-
- stage: B
jobs:-
job: Build
pool:
name: SonarQubeCodeAnalyser-Agent
demands:- agent.name -equals SonarQubeCodeAnalyserVM
steps:
- task: Maven@3
inputs:
mavenPomFile: ‘D:/Selfhostedagents/_work/2/s/ParentProject/pom.xml’
publishJUnitResults: true
testResultsFiles: ‘**/surefire-reports/TEST-*.xml’
javaHomeOption: ‘JDKVersion’
jdkVersionOption: ‘1.8’
mavenVersionOption: ‘Path’
mavenDirectory: ‘C:\Maven\apache-maven-3.6.3\bin’
mavenSetM2Home: false
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: true
sqMavenPluginVersionChoice: ‘pom’
goals: ‘package’
-
- stage: C
jobs:-
job: Publishser
pool:
name: SonarQubeCodeAnalyser-Agent
demands:- agent.name -equals SonarQubeCodeAnalyserVM
steps:
- task: SonarQubePublish@5
inputs:
pollingTimeoutSec: ‘600’
-