configure sonar in bamboo

2019-02-20 18:56发布

问题:

I want to add a build step in Bamboo in order to analyze code using sonarqube. I do not want to use any plugin like Sonar for Bamboo but wondering if it is possible to write a script as a build step in order to run sonar. I have downloaded sonarqube on our build server and it is up and running having logged in as admin.

When I had setup locally, I installed sonar scanner and generated the MSBuild script which I ran from the project root folder but since it is a build server and I do not have the source code on the server I can't do that and I exploring the ways it can be integrated with Bamboo without using a plugin/addon.

Any help on this is greatly appreciated

回答1:

  1. Add your repository to the plan
  2. Add source code checkout step in the job
  3. add bash or cmd command step to cd ${bamboo_build_working_directory} and execute your sonar script or pass bamboo_build_working_directory as an argument to your sonar script. bamboo_build_working_directory will be replaced with source code root.