Search code examples
jenkinsgerritsonarqube-scangerrit-triggersonar-gerrit

Can i do sonar scan on the Gerrit patch?


As part of my precheckin workflow in Gerrit I want to configure sonarqube to perform scan on the submitted patch, I am using sonar-gerrit plugin in my Jenkins and configured gerrit-trigger to run this analysis job. This job is configured with preview mode and runs analysis but the the analysis happens on the repository which doesn’t include the submitted patchset. How can i ensure to run the analysis on the patchset?


Solution

  • Use the "$GERRIT_REFSPEC" variable to configure your job like the following:

    enter image description here