Obtaining parameters post-analysis

Hi all,

This is related to my continued Sonar automation project, but seemed a distinct enough query to warrant its own thread.

TL;DR version: is there a way to obtain the parameters that were passed to SonarQube Cloud after performing an analysis? I’m specifically after sonar.projectVersion.

I was hoping I could pull this from report-task.txt, but it seems limited to:

organization={}
projectKey={}
serverUrl=https://sonarcloud.io
serverVersion={}
dashboardUrl=https://sonarcloud.io/dashboard?id={}&branch={}
ceTaskId={}
ceTaskUrl=https://sonarcloud.io/api/ce/task?id={}

I’ve tried retrieving the ceTask from the API using the supplied link, but it doesn’t seem to include the parameters either.

I was hoping to use this information to make some inferences on how a project is handling versioning, and auto-configure the new code properties based on that inference.

Cheers,

Jack.

Hi,

Appending &additionalFields=scannerContext to the URL from ceTaskUrl will cause the API to return the scannerContext field, which contains a text description of all global and project settings, as well as scanner properties. This may be useful for your use case.

Perfect, thanks! In the interim I’d adopted an alternative approach using the project-analyses endpoint, but this is much neater (and probably more reliable too).

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