We're using SonarQube 5.6.6 (LTS) with SonarC# plugin version 6.5.0.3766 and TFS 2017 update 2 (SonarQube plugin v. 3.0.2).
We're repeatedly seeing, that issues that were previously marked as resolved (Won't fix) get reopened. My question is: Why does SonarQube behave in this way?
This issue is also mentioned in a number of different posts(1,2,3) on StackOverflow but with no root cause or resolution. Link 3 also states that this is an issue using SonarQube 6.2.
I'm curious as to whether this is due to a misconfiguration on our part or an integrated part of SonarQube?
Our SonarQube server is running on a Win 2012 R2 server with a MS SQL backend if thats relevant?
Furthermore, we're using TFVC for versioning and get blame through the SCM plugin. If an issues has been marked as resolved (won't fix), I've noticed that it appears to be as opened as a new issue (i.e. no history available).
Example: A colleague marked an issue as resolved (won't fix) in a file which was last modified in TFVC back in november 2015. However, this morning the issue was marked as open and assigned to the developer who originally checked in the code There is no history in SonarQube of the issue having previously been in a resolved state. It appears as if it's a new issue in a new file instead of being a known issue which has already been resolved?
To avoid weird issues related to compiling our C# solution we always clean our workspace completely prior to our build. I don't know if that has something to say? Our builds are also executed on different build machines so I don't know if that will make SonarQube think that we're indeed always analyzing new files?
Could the use of different build machines and/or build definitions for the same SonarQube project result in this behavior?
I've also seen from the logs and reports, that SonarQube appears to analyze the ENTIRE solution and not only the changed files. This makes our analysis very time consuming and not at all suitable in a fast feedback loop. I suspect the long analysis period and the issues reopening is related.
Analysis of a projekt with approx 280 KLOC takes approx. 8-10 min. as a background task on the server. That's on subsequent analysis (i.e. not the first run).
Is this related to the above mentioned problem of issues getting reopened by the server?
Strangely enough, leak periods appear to work correctly, i.e. we correctly identify issues within the right leak period. I've not verified this in detail yet, but it's definitely not ALL old issues that get reported as open within the leak period. We only see old issues reappear, if the file that contains them has been modified - this activates all the other issues (from a previous version or leak period) within that file.
I've not specified any additional cmdline parameters for the SonarQube scanner during builds apart from the TFVC SCM plugin and path for coverage data.
We're using the VSTEST task v. 2 as otherwise it's not possible to collect code coverage in SonarQube when using TFS 2017 update 2 and VS 2017.
Please advise of any further data that I should supply to help this further.
Thank you for your help!
Related
Our Jenkins instance is currently reporting BUILDS_ALL_TIME to be 999 for all builds of all jobs. Has anyone else experienced this and understand the path of least resistance to getting it to handle this environment variable as expected?
The back story:
Yesterday morning I updated all of the plugins on our Jenkins instance to the latest stable version. There were half a dozen or more plugins to be updated and I never pay close attention to them but the Credentials Binding plugin stuck out because it turned my monitor red regarding a critical security update and kicked off the whole process.
Yesterday afternoon, my coworker noted that the version number of one of his builds went from 1.0.0.7 to 1.0.0.999 and I was able to confirm the same thing with one of mine. Now all jobs that rely on the BUILDS_ALL_TIME environment variable report 999 for that variable in every build.
The Version Number Plugin is installed & up to date, and here's an excerpt from build.xml from an affected build:
<org.jvnet.hudson.tools.versionnumber.VersionNumberAction plugin="versionnumber#1.9">
<info>
<buildsToday>34</buildsToday>
<buildsThisWeek>40</buildsThisWeek>
<buildsThisMonth>40</buildsThisMonth>
<buildsThisYear>40</buildsThisYear>
<buildsAllTime>24</buildsAllTime> <!-- This is correct, is incremented properly between builds, and is updated appropriately when overridden in the job configuration GUI -->
</info>
<versionNumber>999.0.0</versionNumber> <!-- This is incorrect and NOT incremented properly between builds -->
</org.jvnet.hudson.tools.versionnumber.VersionNumberAction>
The timing of this behavior seems to be associated with an upgrade to plugins (this association is by no means certain but it's the best I've got at this point). Consequently I tried downgrading each plugin with that option available in the management GUI, one-by-painful-one, to see if I can find the one culprit. This was fruitless. I'm not given the option to downgrade the Version Number plugin, but the last release of this thing was two years ago.
Well after a year and a half of workarounds and self-loathing, the problem occurred to me. Somehow, someone set the BUILDS_ALL_TIME environment variable globally on our build server. Once I unset that and restarted Jenkins, our builds' version numbers returned to their appropriate values.
Somehow our TF builds stopped working. When triggered, the build stays within the queue and does nothing. The build was also triggered with high priority.
We have also checked the system events, but there are no TF related errors. We have also restarted the IIS site of the TFS - no success.
Any ideas?
I assume you've already checked to make sure your build agent is running. If so, there's a good chance you've run into a bug I've seen before. If this is the case, do you have the latest updates for TFS? If this is the bug I'm thinking about, it causes the build agent to appear "reserved" when it's not. Getting the latest updates should address that particular issue. I don't know what version of TFS and what updates you have.
I'm going to start with a little background regarding a recurrent problem we've been having with TFS.
A short while ago we upgraded our in-house server to utilise TFS 2013. Some of our projects were embedded with build definitions and continuous delivery prior to the upgrade and worked perfectly. However, after finalising the upgrade our build definitions failed due to what the system assumed were missing files (mainly for AspNetCompileMerge.targets), but after investigating the issue we couldn't find the root cause.
To cut a long story short, we tried a number of ways to fix the problem, the only one which worked was by commenting out the below code within the affected application CSPROJ file.
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">12.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' ==
''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
However, problem number 2 cropped up a few days later when we merged some of the projects onto VSO without the build definitions. The cause of the issue was due to me commenting out the above lines of code. After un-commenting the above code in the CSPROJ file and checking in the project everything started working again... Until today!
This morning I reimplemented the Build Defintions into the affected projects and tried publishing to VSO which is when I started getting the same error mentioned in paragraph 2. As I had already come across this issue before the fix was to comment the code out again.
The above information now leads me to the following questions
Did something change in TFS 2013 for Build Definitions to not work correctly when the above code is implemented?
Why is it that the above code needs to be removed when utilising Build Definitions in TFS 2013?
Is the above code important when Build Definitions are enabled or disabled?
Obviously it isn't a be all and end all if we can check in without the code, however I would like to understand why it breaks on check in.
I initially assumed this was a misconfiguration on our server, however this bug is also evident in the online version as well so this theory went out of the window. The affected applications were originally built in VS 2012 on the MVC 5 platform if this helps.
We're using Visual Studio Online, but we have local Build Controller and Build agent. This has been running fine for the past 6 months or so, but just this week the builds have consistently failed.
The software itself appears to build successfully, and the tests also seem to pass, but it fails due to an error during the publication of the log files (see error below).
The build uses an unmodified Default Template, and is setup so that it "does not copy output files to a drop folder" (in the Build Defaults of the build definition).
After a few hours of head-banging this feels like some sort of permissions thing, but I have no idea how to go about debugging, or verifying this assumption.
Can anyone offer any suggestions, or better yet, a solution! :-)
One other thing to note is that we have been mucking about with our users in Visual Studio Online to change some accounts from Basic to Stakeholder accounts in order to reduce costs. I'm wondering if we've also managed to remove a critical account or permission that has caused this...?
Error
An error occurred while copying diagnostic activity logs to the drop location.
Details: TF270002:
An error occurred copying files from
'C:\Users\tfs\AppData\Local\Temp\BuildAgent\5498\Logs\2853\LogsToCopy\ActivityLog.AgentScope.5498.xml'
to
'ActivityLog.AgentScope.5498.xml'.
Details: BadRequest: Bad Request
An error occurred while copying diagnostic activity logs to the drop location.
Details: TF270002:
An error occurred copying files from
'C:\Users\tfs\AppData\Local\Temp\BuildController\4592\Logs\2853\LogsToCopy\ActivityLog.xml'
to
'ActivityLog.xml'.
Details: BadRequest: Bad Request
Edit
One thing to note is that this error is consistent across all builds for different C# projects that are executed through the same build controller. I've tried removing and re-registering the controller, restarting the build service and the build server itself.
we are also experiencing similar issue. We have not done any changes to VSO permissions, so I doubt it is that.
Two things that coinside this:
1. There was an update to VSOnline during the same timewindow that this issue appeared
2. Our local build controllers/agents were updated with latest Patch Tuesday updates
So the solution to this (in my case anyway) was to upgrade the Build controller software to v12 (TFS 2013).
I have setup a build controller etc and the builds were failing, I have fixed these now and the build failed properly - as in because of an error.
I have fixed the error and checked the code back in but now the code is not being extracted, although sometimes one folder of many is.
I have deleted the code from the build machine and requeued a build but it keeps failing. It complains that it cannot find the solution that I specified as the build solution.
I have checked the check box to build even if nothing has changed.
Have I missed a setting somewhere for extracting the code?
TFS version is 2012 Express
Visual Studio version is 2010 Professional
I had this issue recently with TFS 2012. I think it boils down to this:
In the lastest build definition files, it appears that it performs a Clean task before updating the workspace. This means that if you do something that causes the Clean part of the build to fail, it will never download the new files in order to fix it.
Recently, I was making big changes to my build file and inevitably made a lot of mistakes, I found that if one of these mistakes caused the Clean to break, I had to go onto the Build server and change the file manually to get it working again.
Does this sound like it might be the same issue?
There are several properties in your build definition you can check. I would start with setting the "Clean Workspace" to All to ensure the correct code is being pulled down and built.
There are other checks you can look at as well like the agent set for the build and the "GetVersion" property. Check the below link out. It should be able to help you in more detail.
Define a Build Process that is Based on the Default Template