How do I make the command to run sonar-runner at the end of the build TFS (Team Foundation Server) in continuous integration? Info: TFS 2013, Windows Server 2008 R2, sonar-runner 2.3
相关问题
- Getting error: File extension specified '.webt
- Using TFS command line tf.exe how can I copy a rep
- TFS Power tools Migrate doesn't actually migra
- What is the difference between tfpt scorch and tfp
- TFS 2017 Agent: and error occured while sending th
相关文章
- SonarQube: How to suppress a warning in Kotlin cod
- Is it possible to do a “destroy history” in TFS?
- How do I make a TeamCity build appear in the TFS B
- TFS vs. JIRA/Bamboo/SVN [closed]
- @Nullable and SonarQube 'Conditionally execute
- Why doesn't my .tfignore file ignore my packag
- Is it possible to create a docker container from T
- How to Move TFS 2010 Build Definition between Proj
There is now an official way to get MsBuild and TeamBuild to work with SonarQube, as part of a collaboration between Microsoft and SonarQube. You can find all the details on the SonarQube website:
http://www.sonarqube.org/announcing-sonarqube-integration-with-msbuild-and-team-build/
And on the Microsoft ALM website:
http://blogs.msdn.com/b/visualstudioalm/archive/2015/04/28/technical-debt-management-announcing-sonarqube-integration-with-msbuild-and-team-build.aspx
There is also documentation prepared by the ALM rangers that describe how to install SonarQube and integrate it with an existing TFS server:
https://vsarguidance.codeplex.com/downloads/get/1452516
The only way to execute arbitrary commands as part of the build process is to add an InvokeProcess activity to the BuildProcessTemplate. This isn't as difficult as it may seem at first.
Make a copy of the DefaultTemplate.xaml which is located in the /BuildProcessTemplates folder of your team project. Name it whatever you want - SonarRunnerTemplate.xaml or something.
Open up the new template in Visual Studio
Hit "Collapse All" at the top right to ease navigation to the proper activity.
Browse to
Process
>Sequence
>Run On Agent
>Try Compule, Test, and Associate Changesets and Work Items
> in theFinally
clause >Revert Workspace and Copy Files
>If DropBuild And DropLocation is Set
In the "Then" box you will see a
Copy Files to Drop Location
activity. Move this into the "Else" box temporarily.Add a
Sequence
activity from the Toolbox into the (now empty) Then boxMove the
Copy Files to Drop Location
(which we moved earlier) back into the Sequence activity you just added to the Then box.Add a
InvokeProcess
activity from the Toolbox to run AFTER the "Copy Files to Drop Location" activityOpen the Properties for the InvokeProcess activity. The
FileName
field is the command which you need to execute. In this case, the command to execute your Sonar runner. It might be easiest to write a batch or powershell script which runs Sonar... and then invoke that.Save the build process template and add it to TFS. You can then use this template for your build definition.
One issue with this approach is that the build will not "finish" until after the InvokeProcess command has returned. So if your sonar run takes a really long time (I know I have seen it take over 24 hours for a large codebase) the build will take forever to complete. This can be mitigated by having your script spawn off the Sonar process asynchronously.