New feature - Add option url+token in sonar-scanner-azdo

What are you trying to accomplish?
I have some extensions for Azure Devops: Publisher solucionespsg - Visual Studio Marketplace (All Free)
I want to create a new one in which it is not necessary to have Sonar installed: it runs on Azure through Docker: I generate a new token, make it available as an output variable and then I want to start: Prepare Analysis Configuration (sonar-scanner-azdo/src/extensions/sonarqube/tasks/SonarQubePrepare at master · SonarSource/sonar-scanner-azdo · GitHub) but I can’t put url and token For example: “$(TokenGeneratedInPreviosTask)”

What’s your specific coding challenge in developing your plugin?
Being able to support small businesses that do not have a sonar server

And, if relevant, please share the code that’s giving you problems:
An option should be added to be able to select between “connectedService:sonarqube” or url + token.
I have been working with .net (c#) for over 20 years. Typescript is not my strong point. Is there a possibility to add this new option to add a server at runtime?
the code is:

and then:

2 Likes

the firts part is easy:

only add:

{
      "name": "SonarQubeServerConnectionType",
      "type": "pickList",
      "label": "SonarQube Server connection type",
      "required": true,
      "helpMarkDown": "Select the type of SonarQube Server connection type.",
      "options": {
        "serverendpoint": "SonarQube Server endpoint",
        "urltoken": "Url + Token"
      },
      "defaultValue": "serverendpoint"
    },
    {
      "name": "SonarQube",
      "type": "connectedService:sonarqube",
      "label": "SonarQube Server Endpoint",
      "required": true,
      "helpMarkDown": "Select the SonarQube server endpoint for your project. To create one, click the Manage link and create a new SonarQube Server Endpoint, enter your server url and token.",
      "visibleRule": "SonarQubeServerConnectionType = serverendpoint"
    },
    {
      "defaultValue": "$(SonarQubeServerUrl)",
      "helpMarkDown": "Specify the SonarQube server url",
      "label": "Sonar Qube Server url",
      "name": "SonarQubeServerUrl",
      "required": true,
      "type": "string",
      "visibleRule": "SonarQubeServerConnectionType = urltoken"
    },
    {
      "defaultValue": "$(SonarQubeServerToken)",
      "helpMarkDown": "Specify the SonarQube server token",
      "label": "Sonar Qube Server token",
      "name": "SonarQubeServerToken",
      "required": true,
      "type": "string",
      "visibleRule": "SonarQubeServerConnectionType = urltoken"
    }
2 Likes

I continue with my github account so that I receive notifications.

My problem is modifying the typescript to take one value or another: sonar-scanner-azdo/src/common/latest/prepare-task.ts at master · SonarSource/sonar-scanner-azdo · GitHub

I also want to know how open the community is so that this modification can be made. This is the most important thing!

The final idea is to be able to run a sonar scan without having sonarqube installed. For this I am going to develop an azure devops extension that will do the following:
start sonar in docker, generate an apitoken and expose it as an output variable. With this token the normal scan is done. As a final step, the sonarqube database will be saved in the azurepipeline artifact so that in the next execution we already have the baseline and all the previous scans.
Also with the help of extensions a report can be generated and this can be uploaded with the Azude Devops extension: Upload Report To Azure Devops Wiki - Visual Studio Marketplace to the project wiki. In this way, by not having a sonar server, the reports can be consulted as they evolved in the different executions.

1 Like

Hey there.

Of course, you’re welcome to develop your own extension to do whatever you like, but we’re not interested in integrating this into our official extension.

For users who don’t want to install SonarQube Server, SonarQube Cloud is an attractive alternative that doesn’t require users to set up any special infrastructure.

Hi. I don’t want to integrate it into the official extension. I just want to be able to configure the way to configure the SonarQube URL and token.