Integrate sonar 25.2 with Jenkins pipeline
- SonarQube ID information
- Server ID:
Version: 25.2.0.102705
Date: 2025-02-20 - Deployment: zip
- Database: Postgress 17.2
Driver Version: 42.7.5 - java.runtime.version 17.0.14+7-LTS
We have just migrated from version 8.9 to version 9.9 and to version 25.2.
We are currently testing that 25.2 works with our pipelines and IDS. In order to do that we have cloned the current job that builds the different projects to compare 8.9 and 25.2. With the same code build and the same pipeline we’ve got a failure in 25.2 that we don’t get in 8.9.
The failure raises when the pipeline is requesting for the quality profiles (or so we think) http://sonarurl/api/qualityprofiles/search?projectKey=proyect.pr_number → this call brings 3 different quality profiles for the same language.
The same call to our older server returns only one.
Here are the logs from Jenkins pipeline:
07:27:21 07:27:21.631 Failed to request and parse 'http://sonarurl/api/qualityprofiles/search?projectKey=proyect.pr_number': Sequence contains more than one matching element
07:27:21 Unhandled exception. System.InvalidOperationException: Sequence contains more than one matching element
07:27:21 at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
07:27:21 at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
07:27:21 at SonarScanner.MSBuild.PreProcessor.SonarWebService.<>c__DisplayClass6_0.<TryGetQualityProfile>b__0()
07:27:21 at SonarScanner.MSBuild.PreProcessor.SonarWebService.DoLogExceptions[T](Func`1 op, String url, Action`1 onError)
07:27:21 at SonarScanner.MSBuild.PreProcessor.SonarWebService.TryGetQualityProfile(String projectKey, String projectBranch, String organization, String language, String& qualityProfileKey)
07:27:21 at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, List`1& analyzersSettings)
07:27:21 at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings)
07:27:21 at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.Execute(String[] args)
07:27:21 at SonarScanner.MSBuild.BootstrapperClass.PreProcess()
07:27:21 at SonarScanner.MSBuild.BootstrapperClass.Execute()
07:27:21 at SonarScanner.MSBuild.Program.Execute(String[] args, ILogger logger)
07:27:21 at SonarScanner.MSBuild.Program.Execute(String[] args, Boolean showDeprecatedWarning)
07:27:21 at SonarScanner.MSBuild.Program.Main(String[] args)
I’ve done some extra double checks:
- There is only 1 default profile for the language.
- The other 2 profiles are empty:
To keep the post short I’ve attached 2 files:
- response-3-quality-profiles → the response from the 25.2 version
- response-1-quality-profile → The response from the 8.9 version
Are we missing some configuration in the new version to avoid the problem?
Thanks in advance.
response-3-quality-profiles.json (1.7 KB)
response-1-quality-profile.json (590 Bytes)