Very similar to Could not find the pullrequest with key
This used to work fine for us and then stopped a few months ago. We are using the stand alone Sonar Scanner for analysis. The “Run Code Analysis”(v 1.40.0) optional Task fails anytime a new PR is created. The pipeline itself “Generic analysis with SonarCloud-CI” can be ran successfully but not when invoked for a PR.
Do I indeed need to delete the entire project from SonarCloud and recreate it?
YAML FILE:
pool:
name: Azure Pipelines
demands: java
timeoutInMinutes: 1000000000
steps:
- task: SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01-2965cd301255.SonarCloudPrepare@1
displayName: 'Prepare analysis on SonarCloud'
inputs:
SonarCloud: SonarCloud
organization: ***************
scannerMode: CLI
configMode: manual
cliProjectKey: '******'
cliProjectName: **********
extraProperties: |
# Additional properties that will be passed to the scanner,
# Put one key=value per line, example:
# sonar.exclusions=**/*.bin
sonar.exclusions=**/*.java,/Cloud/DBs/K8S/**/*,Website/jwplayer-7.11.3,Website/fabric.js-1.5.0*/**/*,Website/High*/**/*
sonar.inclusions=Website//**/*,Cloud/**/*
timeoutInMinutes: 15
- task: SonarSource.sonarcloud.ce096e50-6155-4de8-8800-4221aaeed4a1.SonarCloudAnalyze@1
displayName: 'Run Code Analysis'
timeoutInMinutes: 30
- task: SonarSource.sonarcloud.38b27399-a642-40af-bb7d-9971f69712e8.SonarCloudPublish@1
displayName: 'Publish Quality Gate Result'
timeoutInMinutes: 15
Can you verify that the PR exists in your DevOps platform before analysis runs?
Also can you provide the analysis log of the failing PR analysis?
The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.
Included the Analysis output, but the issue doesn’t seem to be the analysis itself. I can manually execute the pipeline against a specific branch like “develop” but I can’t execute it against a user specific branch for a PR.
I have the same issue. Our PAT did expire, but I created a new one and updated SonarCloud. However, I still get the same error. It seems like it won’t fetch PR information if the PAT expired once, irrespective of whether you create a new one or not.
Some solutions I’ve seen suggest recreating the SonarCloud projects, but that’s a problem. I have a LOT of projects that will need to be recreated. Also, I don’t want to lose the history that’s been accumulated so far.
As Charl mentionned, your issue is probably related to an expired PAT (personal access token) or with incorrect rights.
We advise to always setup your PAT at organization level (Administration > Organization settings > Azure devops connectivity management) and remove all PAT at project level (that way when it expires, you only update it once at org level).
I’m looking into this now. I had previously updated the PAT on the SonarCloud side. I am looking on the Azure side according to your suggestion and will update this shortly.
It appears you are correct.
I had updated a PAT token previously, but I think I had done it at the project level and it had originally been setup at the organization level.
We’ve been messing with this for a few days and I have noticed more than a few threads along a similar vain. Now that I see it and have gone through it, it seems as straight forward as we thought it would be. That said, I think it’s worth asking why the nature of the issue itself isn’t more apparent or where the common disconnect is that is keeping users for recognizing both the issue and its remediation steps.
Constructive feedback from a customer that enjoys your product and the value it delivers to our team!
Keep up the fantastic work!
Happy it solved your problem, and thank you for the feedback.
We also noticed that you are not the only person being mislead by this error message, for sure we will have a look into it