-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Work with Merge Requests #178
Comments
Same request. Current my Sonar plugin only comment when MR have been merged to develop :( |
I've the same issue at the moment. I do the sonar analysis with the follwing command: mvn $MAVEN_CLI_OPTS sonar:sonar -Dsonar.issuesReport.console.enable=true
-Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN
-Dsonar.projectKey=$SONAR_PROJECT_ID -Dsonar.gitlab.all_issues=true
-Dsonar.gitlab.only_issue_from_commit_line=$SONAR_ONLY_COMMIT_LINE
-Dsonar.gitlab.only_issue_from_commit_file=$SONAR_ONLY_COMMIT_FILE
-Dsonar.gitlab.max_blocker_issues_gate=$SONAR_MAX_BLOCKER_ISSUES
-Dsonar.gitlab.max_critical_issues_gate=$SONAR_MAX_CRITICAL_ISSUES
-Dsonar.gitlab.max_major_issues_gate=$SONAR_MAX_MAJOR_ISSUES
-Dsonar.gitlab.max_minor_issues_gate=$SONAR_MAX_MINOR_ISSUES
-Dsonar.gitlab.max_info_issues_gate=$SONAR_MAX_INFO_ISSUES
-Dsonar.gitlab.comment_no_issue=true
-Dsonar.gitlab.project_id=$CI_PROJECT_PATH -Dsonar.analysis.mode=preview
-Dsonar.gitlab.commit_sha=$(git log --pretty=format:%H $CI_MERGE_REQUEST_TARGET_BRANCH_NAME..$CI_COMMIT_SHA | tr '\n' ',')
-Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME Its executed by reacting on merge requests with: ....
only:
- merge_requests
... It the target branch ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME) is the develop branch, everything works fine. But if the the merge request is e. g. from one feature branch to another feature branch I get the following exception and there are no comments added to the merge request:
$CI_COMMIT_REF_NAME and $CI_COMMIT_SHA have a valid value in both cases. |
I got it to work, for my case. I'm not sure if the problem was ne name of the target branch ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME) or the fact that the target branch was not available in the local repository and so the I ended up with justing using commits from the current branch:
Maybe that helps someone. |
I just got this working for a project, it looks like the MR discussion feature (#216) was merged in after the latest release, so I had to download and compile a new version of this plugin for it to work. |
I cannot understand how to configure the plugin to work with Merge Requests. The goal is when a non-master branch is pushed and a MR is created for that branch, to have SonarQube comments on the MR discussion/review. Any advice on how to set this up? Thank you!
The text was updated successfully, but these errors were encountered: