Azure pipelines problem

Using Azure devops (see pipelines) we have SonarCloud performing the analysis, we are using the following Azure pipelines tasks:

- ${{ if eq(parameters.runSonarqubeAnalysis, true) }}:

      - task: SonarCloudPrepare@1

        displayName: 'Prepare SonarCloud Analysis'

        inputs:

          SonarCloud: ${{ parameters.sonarCloudEndpoint }}

          organization: ${{ parameters.sonarCloudOrg }}

          scannerMode: ${{ parameters.sonarCloudScannerMode }}

          configMode: ${{ parameters.sonarCloudConfigMode }}



    - ${{ if eq(parameters.runSonarqubeAnalysis, true) }}:

      - task: SonarCloudAnalyze@1

        displayName: 'SonarCloud Analysis'

    - ${{ if eq(parameters.runSonarqubeAnalysis, true) }}:

      - task: SonarCloudPublish@1

        displayName: 'SonarCloud Quality Gate'

        inputs:

          pollingTimeoutSec: ${{ parameters.sonarCloudQGTimeout }}

We are observing that it works on feature branch analysis but fails on PR analysis. Worked on both PR’s and feature branches before today and has done for months.

Error observed in a PR analysis:

INFO: ------------------------------------------------------------------------

INFO: EXECUTION FAILURE

INFO: ------------------------------------------------------------------------

INFO: Total time: 23.398s

INFO: Final Memory: 7M/27M

INFO: ------------------------------------------------------------------------

##[error]ERROR: Error during SonarScanner execution

ERROR: Not authorized. Please check the properties sonar.login and sonar.password.

ERROR:

ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

ERROR: Error during SonarScanner execution

ERROR: Not authorized. Please check the properties sonar.login and sonar.password.

ERROR:

ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

##[error]The process '/home/vsts/work/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.23.0/sonar-scanner/bin/sonar-scanner' failed with exit code 2

We use gated commits so having this broke at a PR level is preventing any code merges from occurring.

Thanks,

Neil

Hi,

It seems like an authorization issue.
Could you check that both tokens are still valid:

  • the Azure token, configured on SonarCloud organization (Administration > Organization settings > Azure DevOps connectivity management > Personal Access Token, the status check should say “is valid”)

  • the SonarCloud token, configured on Azure DevOps Project (Project settings > Service connections > select SonarCloud service > click Verify, the verification should say “Verification Succeeded”)

This has all been done.

We have also raised with Azure DevOps.

As it works on feature branches but not on PR’s.

It stopped working yesterday (August the 10th 2021) having worked for months.

It looks like the prepare task is playing up.

Here is one from a feature branch that works.

Here is one from a PR:

Interestingly this line is missing from the prepare statement.

SYSTEMVSSCONNECTION exists true

Thanks Neil

Also came across this:

“Not authorized. Please check the properties sonar.login and sonar.password.” for PR automated pipelines - Get help / SonarCloud - SonarSource Community

Going to give that a whirl.

Yes the above fixed it.

So in summary:

CI’s use the service connection and PR’s use the SonarCloud Org Token.

Thanks,

Neil

1 Like

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