You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Encountering branch not found error when Sonar CNES report generation utilizes the BRANCH_NAME Jenkins global environment variable.
Environment:
Sonar CNES Report version 4.1.1 with SonarQube server 9.4 (a recommended workaround has been added to get these two versions to work together).
This error was found while using the following combination of services: Bitbucket, Jenkins, SonarQube w/ PR Decorations enabled, Sonar CNES Report tool and using the Jenkins BRANCH_NAME global env var for the --branch option.
SonarQube PR Decorations enabled and synced with Bitbucket
PR opened in Bitbucket
Bitbucket webhook prompts a build in Jenkins to start
Jenkins global env var, BRANCH_NAME, pulls the PR branch name from Bitbucket (i.e. PR-25)
CNES report tool tries to find this PR branch name in SonarQube
CNES report tool throws error during Jenkins build saying that it cannot find this branch in SonarQube
And here is the actual error that results in Jenkins:
[Pipeline] sh
+ java -jar <cnes-report-jar-file> -t <sonarqube-token> -s <sonarqube-url> -b PR-25
SonarQube URL: <sonarqube-url>
SonarQube online: true
Detected SonarQube version: 9.4.0.54424
[ERROR] Not found error sent by SonarQube server (code 404, URL https://<sonarqube-url>/api/navigation/component?component=<project-name>&branch=PR-25, Error {"errors":[{"msg":"Component \u0027<project-name>\u0027 on branch \u0027PR-25\u0027 not found"}]}), please check cnesreport compatibility with your SonarQube server version.
[Pipeline] }
I've been thinking about how this could be resolved. It doesn't seem like Bitbucket nor Jenkins should change their naming system in this case. It also doesn't seem like SonarQube should change their naming system for PR branches since it doesn't look like their API provides any meaningful data for the Sonar CNES Report tool to use for a PR branch anyways.
In short, it seems like these PR branches may not be useful for generating a CNES report; as such, I thought it would make sense to reach out here to see if there was a way for PR branches specified in the --branch option to be handled/ignored by the Sonar CNES Report tool?
Thanks in advance!
The text was updated successfully, but these errors were encountered:
Encountering branch not found error when Sonar CNES report generation utilizes the BRANCH_NAME Jenkins global environment variable.
Environment:
Sonar CNES Report version 4.1.1 with SonarQube server 9.4 (a recommended workaround has been added to get these two versions to work together).
This error was found while using the following combination of services: Bitbucket, Jenkins, SonarQube w/ PR Decorations enabled, Sonar CNES Report tool and using the Jenkins BRANCH_NAME global env var for the --branch option.
i.e.
java -jar <cnes-report-jar-file> -t <sonarqube-token> -s <sonarqube-url> -p <project-name> -b ${env.BRANCH_NAME}
Steps to Reproduce Error:
And here is the actual error that results in Jenkins:
I've been thinking about how this could be resolved. It doesn't seem like Bitbucket nor Jenkins should change their naming system in this case. It also doesn't seem like SonarQube should change their naming system for PR branches since it doesn't look like their API provides any meaningful data for the Sonar CNES Report tool to use for a PR branch anyways.
In short, it seems like these PR branches may not be useful for generating a CNES report; as such, I thought it would make sense to reach out here to see if there was a way for PR branches specified in the --branch option to be handled/ignored by the Sonar CNES Report tool?
Thanks in advance!
The text was updated successfully, but these errors were encountered: