StashIssueReportingPostJob not enabled - how to enable?

892 views Asked by At

using the AmadeusIT sonar-stash plugin...

After branching from main for feature/sprint we updated code locally and added, committed and pushed to BitBucket, creating a pull request. We'd like to run a scan and see the issues presently only for the code we just issued a PR for... I run sonar-scanner with this invocation:

sonar-scanner -Dsonar.analysis.mode=preview -Dsonar.stash.pullrequest.id=8 -
Dsonar.stash.repository=StaticAnalysisPOC -Dsonar.stash.login=myLogin -
Dsonar.stash.password=myPassword -Dsonar.login=sonarLogin -
Dsonar.password=sonarPword -
Dsonar.projectKey=com.company.static:StaticAnalysisPOC -
Dsonar.projectName=stat -Dsonar.projectVersion=1.0.3

output was:

INFO: Executing post-job org.sonar.plugins.stash.StashIssueReportingPostJob
INFO: org.sonar.plugins.stash.StashIssueReportingPostJob@43294e9b 
not enabled, skipping

Tech Stack/Versions;

SonarQube 6.x - latest

BitBucket (on prem) 4.x - latest

Thanks!

2

There are 2 answers

0
Julien H. - SonarSource Team On BEST ANSWER

According to the code of the plugin, you have to add parameter -Dsonar.stash.notification=true

0
randomNerdboy On

My resolution to success was as follows:

  1. Create feature branch off master

  2. Run a clean, vanilla scan with following invocation on master (for baseline scan) as such: "$ sonar-scanner" - this should be called when you are attached to the master on your local machine i.e. "$ git branch" returns "master"

  3. Issue a pull request for master to update your local master in local repo i.e. "$ git pull origin master"

  4. Switch to feature branch on your local machine as such: "$ git checkout "featureBranchName"

5.In Eclipse, if you have the project already open, you can verify you are now attached to feature branch referenced above.

6.Now you may perform your code changes, fixes, etc. as per your desired work on the feature branch.

  1. When work is complete, add, commit and push your changes as such:

    "$ git add ." "$ git commit -m "my commit comment" "$ git push origin myBranchName"

  2. Go to Bitbucket and create a pull request from your newly pushed changes in your feature branch

  3. Take feature branch "pull request id" and append it to this invocation of sonar scanner:

    $ sonar-scanner -Dsonar.analysis.mode=preview -Dsonar.stash.pullrequest.id= <yourPullRequestIDFromAbove> -Dsonar.stash.repository=<YourStashRepo> - Dsonar.stash.login=<StashLoginUser> -Dsonar.stash.password=<stashPassword> - Dsonar.login=<SonarLogin> - Dsonar.password=<sonarPassword> -Dsonar.stash.notification=true - Dsonar.projectKey=<ProjectKey> -Dsonar.projectName=<projectNameInSonar> - Dsonar.stash.project=<StashProjectName> -Dsonar.projectVersion= <projectVersion>

10.Review the issues as found in Bitbucket for your pull request ID