- ALM used: Azure DevOps
- CI system used: Azure DevOps
- Scanner command used when applicable (private details masked):
The command that is failing:
- task: SonarCloudPublish@1
displayName: 'Publish Quality Gate Result'
condition: always()
continueOnError: true
The commands that are executed prior to the above command which are working fine:
# Any $(Variables) are correctly filled in via parameters/variables defined in the pipeline, that's all working fine.
# Just after project restore, but before any build steps
- task: SonarCloudPrepare@1
displayName: 'Prepare analysis on SonarCloud'
inputs:
SonarCloud: SonarCloud
organization: spotonmedics
scannerMode: MSBuild
projectKey: $(SonarProjectKey)
projectName: $(SonarProjectName)
projectVersion: $(GitVersion.MajorMinorPatch)
extraProperties: |
sonar.projectKey=$(SonarProjectKey)
sonar.projectName=$(SonarProjectName)
sonar.token=<REDACTED>
sonar.host.url=https://sonarcloud.io
sonar.projectBaseDir=$(Build.SourcesDirectory)\Source
sonar.verbose=true
sonar.pullrequest.vsts.token.secured=<REDACTED>
sonar.pullrequest.provider=vsts
# After some dotnet tests/build commands:
- task: SonarCloudAnalyze@1
inputs:
jdkversion: 'JAVA_HOME'
displayName: 'Run Code Analysis'
condition: always()
- Languages of the repository: C#
- Error observed
Error logs
Author : sonarsource
Help : Version: 1.16.0. [More Information](https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarcloud-extension-for-azure-devops/)
==============================================================================
##[debug]Using node path: C:\agents\3.236.1\externals\node10\bin\node.exe
##[debug]agent.TempDirectory=D:\a\_temp
##[debug]loading inputs and endpoints
##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
##[debug]loading INPUT_POLLINGTIMEOUTSEC
##[debug]loading SECRET_SONARQUBE_ENDPOINT
##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
##[debug]loaded 6
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]SONARQUBE_SCANNER_PARAMS={"sonar.host.url":"https://sonarcloud.io","sonar.token":"<REDACTED>","sonar.organization":"spotonmedics","sonar.projectKey":"SpotOnMedics_DataConversions","sonar.projectName":"DataConversions","sonar.projectVersion":"1.0.25","sonar.branch.name":"refs/pull/3651/merge","sonar.scanner.metadataFilePath":"D:\\a\\_temp\\sonar\\10874\\a06b0880-850f-0d83-88d3-1782fc934334\\report-task.txt","sonar.projectBaseDir":"D:\\a\\1\\s\\Source","sonar.verbose":"true","sonar.pullrequest.vsts.token.secured":"<REDACTED>","sonar.pullrequest.provider":"vsts"}
##[debug]SONARQUBE_ENDPOINT=***
##[debug]SONARQUBE_ENDPOINT=***
##[debug][SQ] API GET: '/api/metrics/search' with full URL "https://sonarcloud.io/api/metrics/search?f=name&ps=500" and query "{"f":"name","ps":500}"
##[debug]Not using a proxy agent
##[debug]pollingTimeoutSec=300
##[debug][SQ] API GET: '/api/server/version' with full URL "https://sonarcloud.io/api/server/version" and query "undefined"
##[debug]Not using a proxy agent
##[debug][SQ] Server version: 8.0.0.53374
##[debug]SONARQUBE_SCANNER_REPORTTASKFILE=D:\a\_temp\sonar\10874\a06b0880-850f-0d83-88d3-1782fc934334\report-task.txt
##[debug]SONARQUBE_SCANNER_REPORTTASKFILE=D:\a\_temp\sonar\10874\a06b0880-850f-0d83-88d3-1782fc934334\report-task.txt
##[debug]findPath: 'D:\a\_temp\sonar\10874\a06b0880-850f-0d83-88d3-1782fc934334\report-task.txt'
##[debug]findOptions.allowBrokenSymbolicLinks: 'false'
##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
##[debug]findOptions.followSymbolicLinks: 'true'
##[debug]findOptions.skipMissingFiles: 'false'
##[debug] D:\a\_temp\sonar\10874\a06b0880-850f-0d83-88d3-1782fc934334\report-task.txt (file)
##[debug]1 results
##[debug][SQ] Searching for D:\a\_temp\sonar\10874\a06b0880-850f-0d83-88d3-1782fc934334\report-task.txt - found 1 file(s)
##[debug][SQ] Read Task report file: D:\a\_temp\sonar\10874\a06b0880-850f-0d83-88d3-1782fc934334\report-task.txt
##[debug][SQ] Parse Task report file: organization=spotonmedics
projectKey=SpotOnMedics_DataConversions
serverUrl=https://sonarcloud.io
serverVersion=8.0.0.53374
branch=refs/pull/3651/merge
dashboardUrl=https://sonarcloud.io/dashboard?id=SpotOnMedics_DataConversions&branch=refs%2Fpull%2F3651%2Fmerge&resolved=false
ceTaskId=AY5Q0MJfwdlYw3sh-ECd
ceTaskUrl=https://sonarcloud.io/api/ce/task?id=AY5Q0MJfwdlYw3sh-ECd
##[debug][SQ] Waiting for task 'AY5Q0MJfwdlYw3sh-ECd' to complete.
##[debug][SQ] API GET: '/api/ce/task' with full URL "https://sonarcloud.io/api/ce/task?id=AY5Q0MJfwdlYw3sh-ECd&additionalFields=warnings" and query "{"id":"AY5Q0MJfwdlYw3sh-ECd","additionalFields":"warnings"}"
##[debug]Not using a proxy agent
##[debug][SQ] Publish task error: Cannot read property 'status' of undefined
##[debug]task result: Failed
##[error]Cannot read property 'status' of undefined
##[debug]Processed: ##vso[task.issue type=error;]Cannot read property 'status' of undefined
##[debug]Processed: ##vso[task.complete result=Failed;]Cannot read property 'status' of undefined
Finishing: Publish Quality Gate Result
- Steps to reproduce: Please see the explanation below.
- Potential workaround: None that I know of
More details
Last Friday I removed a user from our SonarCloud organization. That person was the original user that had setup our SonarCloud organization and pipeline flow, but is no longer active within our company so we had to disable/remove his account everywhere.
Our pipelines stopped working, obviously because his DevOps PAT was used and also his Project Tokens (from SonarCloud) were used in the pipeline.
We changed the PAT to a new user with sufficient access, as well as generated a new project token in the SonarCloud dashboard, and that solved the first problem (401 and 403 status codes when running the sonar SonarCloudPrepare@1
and SonarCloudAnalyze@1
tasks).
However, one task is still failing: SonarCloudPublish@1
, with the following error:
##[error]Cannot read property 'status' of undefined
Everything worked fine before the user was removed from the organization in SonarCloud.
Any help will be greatly appreciated, I’ve already tried:
- Changing the DevOps PAT in SonarCloud to a new valid token with sufficient permissions. (Solved some errors, but not the last error).
- Changing the project token (
sonar.token=
) used in the pipeline to a new token configured on the project that I was testing on, and also to one “generic” token for all projects. This solved more 401/403 errors, but still this last error is not yet fixed. - Checked the setup guides here: Driving continuous quality of your code with SonarCloud | Azure DevOps Hands-on-Labs and here https://docs.sonarsource.com/sonarcloud/advanced-setup/ci-based-analysis/sonarcloud-extension-for-azure-devops/ (and other configuration pages on the docs).
- Uninstalled the SonarCloud Extension in DevOps and re-installed it.