Issue with adding ProjectFeature aka ProjectExtensions for SonarQube servers profile using TeamCity API
Hi Forum, Greetings!
We are in process of automating Sonar Integration (sonar-plugin) with Team City and currently we are stuck with creating a ProjectFeature for setting up SonarQube Server Profile using the Rest API - http://<teamcity.domain.name>/app/rest/projects/<Project Name>/projectFeatures
When we POST the below XML (consisting of SonarQube Server Profile settings) to REST API, it gives an error that the type parameter cannot be empty (Attribute of projectFeature element). However, when I provide a random type (say "sonar-plugin) the project extension gets added to - C:\ProgramData\JetBrains\TeamCity\config\projects\<projectName>\project-config.xml but the SonarQuebe Server profile does not created and is not visible under SonarQube Server. Refer the screeshot below
The crux of the issue is that the SonarQube Server profile is detected as a legitimate ProjectFeature only when the type parameter is left Empty. But irony of the API is that it does not allow to post the XML with an empty type attribute.
Any help in fixing the issue or pointer to work around would be greatly appreciated. Thanks in advance !
<projectFeature id="PROJECT_EXT_1" type="sonar-plugin" href="/app/rest/projects/id:HabitatDev/projectFeatures/id:PROJECT_EXT_1">

Please sign in to leave a comment.
Hello Vidhishar,
This seems to be a bug in the sonarQube plugin as it indeed saves internal settings XML of form "<extension id="PROJECT_EXT_1" type="">". We will get with a comment on this shortly.
BTW, you have posted your password from the settings (though in the scrambled form). Make sure this exposed password it is not used anywhere.
Hi Yegor, Thanks so much for reverting on the issue.
Yes, I reckon this to be a bug as well. Looking forward to an early fix so that we can move forward in the right direction of automating the devops pipeline in Teamcity.
Between, the password here has no significance as this belongs to a test environment for POC.
Thanks once again ! Regards
Hello,
I've updated the plugin. Now project feature type is "sonar-qube". Old configs won't be lost - they will be automatically migrated at next edit.
You can download the new version for TeamCity 2017.1+ here