I am using Azure Devops (ADO), with github hosting the repos.
again: GitHub hosts the repos. ADO is the pipelines.
I had everything working when it was building on the main branch (No PRs).
The global PAT is valid, active for another year. I added a service connection a week ago, good for another year, it’s verified (at least via ADO).
Everything builds and unit tests successfully.
The pipeline portion looks like
* task: SonarCloudAnalyze@4
displayName: ‘performing SonarQube analysis’
inputs:
jdkversion: ‘JAVA_HOME_17_X64’
- task: SonarCloudPublish@4
displayName: 'publishing sonarqube results to sonarcloud.io'
inputs:
pollingTimeoutSec: '300'
However, when setting to a branch (I"m Marc, so I created a marc-dev branch that is PR’ing into a dev branch (which is an integration branch).
PRs automatically are triggered to build/scan, which it does.
However, it fails on finding a PR with key.
ERROR: Could not find the pullrequest with key ‘4’
The scanner engine did not complete successfully
Post-processing failed. Exit code: 1
I’ve googled around. nothing seems obvious. SO I thought, why not just build on that branch I’m PRing.
So I manually fired the build off using the marc-dev branch. IT actually scanned successfully! but puked on publishing the results.
##[error][ERROR] SonarQube Cloud: Error retrieving analysis: API GET '/api/qualitygates/project_status' failed. Axios Error message: Request failed with status code 403.
##[error][ERROR] SonarQube Cloud: Error while executing task Publish: Could not fetch analysis for ID '<my id>'
##[error]Could not fetch analysis for ID '<my id>'
##[section]Finishing: publishing sonarqube results to sonarcloud.io
needless to say, it didn’t actually publish the results to sonarqube. says my default branch hasn’t yet been analyzed.
ok, so let me build on the main branch (which hasn’t changed at all).
Yep. it worked the entire way, built, scanned and published.
trying the marc-dev branch now, straight build (no PR)
Nope. still errors out on that id. I don’t know what that id even is, it’s not any git commits. I did a git log > logs.txt and searched for myid, nothing. I see the latest commit on that branch, not that id.
but the fact that main worked proves that the global token works, and that the service connection works.
Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!