NDepend VSTS Build task run but do not produce any result - ndepend

I have configured the NDepend VSTS Task as indicated but the dashboard stay empty and redirect me to the configuration doc.
I also checked the "Stop the Build when at least one Quality Gate fails" option and even if NDepend detect 2 gates failed, the build is still considered as successful.
Here is the NDepend task logs:
##[section]Starting: NDependTask
-------------------------------------------------------------
Task : NDepend Task
Description : NDepend Task
Version : 1.7.0
Author : NDEPEND
Help : Replace with markdown to show in help
-------------------------------------------------------------
Preparing task execution handler.
Executing the powershell script: d:\a_tasks\NDependTask_94137ea2-81f0-411a-9527-b1400d722332\1.7.0\ndepend.ps1
System.Management.Automation.ParameterBindingValidationException
Cannot validate argument on parameter 'Url'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
No previous build analyzed by ndepend is found to compare with.
##[warning]The ndproj file is not defined, the default one will be used
D:\a_tasks\NDependTask_94137ea2-81f0-411a-9527-b1400d722332\1.7.0\Integration\VSTS\VSTSAnalyzer.exe /outputDirectory "d:\a\1\a" /sourceDirectory "d:\a\1\s" /excludePattern ".test." /identifier "default" /hub "https://laedit2.visualstudio.com/IASI/_apps/hub/ndepend.ndependextension.NDepend.Hub" /coverageDir "d:\a\1\TestResults;d:\a\1\s;d:\a\1\s" /stopBuild /errorCode 1
Run Analysis!
2 quality gates fail.
- 'Critical Rules Violated' value 2 rules greater than fail threshold 0 rules
- 'Debt Rating per Namespace' value 1 namespaces greater than fail threshold 0 namespaces
##[error]Unexpected exit code 1 returned from tool VSTSAnalyzer.exe
##[section]Finishing: NDependTask
Do I need to configure something else?
The Visual Studio integration of NDepend works perfectly with the same ndproj on my computer.
EDIT:
I use the trial version of the task.
The problem is reproducible with the following steps:
new console application (.net 4.5.2)
NDepend menu in Visual Studio / Attach new NDepend project to solution
publish the project to VSTS and create this build definition based on the Visual Studio proposed:
And the NDepend Build Task:
VSTS Build result despite the Unexpected exit code 1 returned from tool VSTSAnalyzer.exe:
Here are the project with ndproj and the build logs.
I have noticed the following exception:
System.Management.Automation.ParameterBindingValidationException
Cannot validate argument on parameter 'Url'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
But I cannot find the 'Url' parameter anywhere in the NDepend task definition, so I don't know if it is related.

Following email exchange with the VSTS team from NDepend, It appears that there was issues in the NDepend VSTS Build Task but they have been fixed.
That said, it is worth to notice that if the "Stop the Build when at least one Quality Gate fails" option is checked and your project have some quality gates failed, the NDepend result won't be stored.
So if your project never had a successful build, the NDepend dashboard will redirect you to the "How-To" section.

Related

VssServiceResponseException: Forbidden in Azure Pipelines

I'm using Azure Pipelines to run automated tests via VSTest Platform (V2). The deployment group I'm using has no Internet access and is private. I have the task currently set up to run Nunit tests in the project via the test assemblies. The deployment group has VSTest Platform installed on it and I specify the path to vstest.console.exe in the task. The build artifact is downloaded from the pipeline.
The error I'm getting during the VSTest task is this:
Unhandled exception ocurred: Microsoft.VisualStudio.Services.WebApi.VssServiceResponseException: Forbidden
Followed by a stack trace and then this shortly after:
Error: The process 'C:\agent\A1\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.164.2\Modules\DTAExecutionHost.exe' failed with exit code 3762504530
I can attach the full log if need be, but I'm just trying to get some general direction at the moment.
First off, what is VssService? I'm assuming it has something to do with Visual Studio, but the only things I can find with the VSS acronym are Visual SourceSafe (Microsoft source control software from ~2005, so I really doubt that's it) and something to do with Cisco network switches.
Second, what is DTAExecutionHost?
Third, where can I find information on that error code?

How to get Roslyn Analizer results in VSTS Build Definition?

I'm working on DevSecOps. Related to that, I want to secure my application with the help of Roslyn Analyzer. For that I created an MVC Web Application along with custom ruleset in Visual Studio and it's working fine with outputs clearly.
But, when I tried to do same thing with the help of VSTS Build task in my Build Definition in VSTS account. By referring the link, I known that with the help of MSBuild task we can get the Roslyn Analyser results by default. But I didn’t get the results of Roslyn Analyzer results after running my Build Definition. Can you suggest me to “How to overcome this situation”?
If that works locally when run msbuild in command line, then you can try below items to narrow down the issue:
Add a command line task to run the msbuild command line script
directly.
Change another hosted agent.
Deploy an private agent on your dev machine, then check if that works
with the private agent.
You can also reference below articles to troubleshoot the issue:
Using, configuring and distributing Roslyn analysers in teams
Running Code Analyzers on Build Server

Fail a Build if Code Coverage is Low in Visual Studio Online

I'm trying to fail builds in Visual Studio Online when Code Coverage is below a threshold.
Is there anyway to do it under Visual Studio Online or I have to do it using the XAML Build Definitions.
It is possible to control build result with code coverage percentage result in both vNext build system and XAML build.
In vNext build, you need to add the PowerShell step in the build definition, and run one PowerShell script to determine whether the build failed or succeed. Check this blog for the details of the PowerShell script: http://blogs.msdn.com/b/tfssetup/archive/2015/11/06/controlling-build-result-with-code-coverage-percentage-using-build-vnext.aspx
If you work with one XAML build, you need to create a custom build activity in which contains the logic to fail or pass a build based on code coverage result. Then include to use the build activity in the build definition. See: http://blogs.msdn.com/b/tfssetup/archive/2015/11/06/controlling-build-result-based-on-code-coverage-percentage-for-xaml-builds.aspx
My preferred method is to use the standard XAML build process in Azure DevOps pipeline. Use the code analysis task to fail the build if coverage is below a threshold.
See: https://learn.microsoft.com/en-us/archive/blogs/tfssetup/controlling-build-result-based-on-code-coverage-percentage-for-xaml-builds

jenkins + ghprbhook - how to set status message?

I've installed the ghprbhook plugin to my jenkins system. It triggers when I send a PR but isn't setting the result text properly. The 'success' / 'failure' message is working but the rest is Build finished. No test results found.
The disconnect seems to be between the gradle build plugin and the ghprbhook service. In the ghprbhook source it's checking for hudson.tasks.junit.TestResultAction to be set and apparently it isn't.
Question:
Is it possible to have gradle set the appropriate values? If so, how?
Turns out that I was looking in the wrong place. The way to get useful values to show up in github is to add the Publish JUnit Test Result Report post-build step to your jenkins job. Assuming that you have gradle and junit outputting xml you should see the output in github when you build.

TFS Manual Mstest Publish Results?

Following a MSDN web page, I am trying to manually run mstest within my tfsbuild.proj and put the results into the pass/fail logic so the build will fail if this particular test fails. It's kind of like running a FxCop or something else from CMD and capturing a "0" or "1" and force-fail the build.
MSTest /testcontainer:test.dll /publish:http://ourtfsmachine:8080 /teamproject:ProjectName /publishbuild:BuildNumber01 /platform:AnyCpu /flavor:Release
I could understand running this inside an Exec task, butI don't know what the BuildNumber is, for example.
Help?
Instructions for getting the Build Number from http://msdn.microsoft.com/en-us/library/ms243151%28VS.100%29.aspx:
Open Visual Studio and connect to a Team Foundation Server.
Open Team Explorer.
Open your team project and expand the team project node.
Under the build, double-click All Build Types or a specific build type to see its builds. Build names that you can use are in the Name column.