First of all please keep in mind that I am just discovering how "things" work in the DevOps world and my knowledge is pretty limited - especially in scripting (PS and C#).
So I have to figure it out how to set up some Javascript unit tests for an app - specifically to get the "Test Results Analyzer" widget up and running on the Jenkins website.
I am currently recycling code from another Jenkins pipeline (def) and using the already existing "run unit tests" stage in the makefile.include of the project which (from what the main Dev of the project told me) it never worked - was never tested - to try and make the tests run.
I thought the best way (without breaking anything on the main app) is to test locally via cygwin.
I have mapped the project as a workspace in Perforce and tried to run the command from the makefile.include
$ make runRoutingPlannerCSTests
Which is working about half way and after it prompts me with some missing files errors which I was not able to find anywhere on my local project folder.
CSC : error CS0006: Metadata file 'D:\src\project\ServicePlanning\BackendAPI\Comtec.Portal.OSPBackend.ApiModel\bin\Release\Comtec.Portnd [D:\src\project\ServicePlanning\Frontend_RoutingPlanner\Comtec.ServicePlanning.Frontend.RoutingPlanner.Tests\Comtec.ServicePlanning
CSC : error CS0006: Metadata file 'D:\src\project\ServicePlanning\Frontend_RoutingPlanner\Comtec.ServicePlanning.Frontend.RoutingPlannngPlanner.dll' could not be found [D:\src\project\ServicePlanning\Frontend_RoutingPlanner\Comtec.ServicePlanning.Frontend.RoutingPlanntingPlanner.Tests.csproj]
CSC : error CS0006: Metadata file 'D:\src\project\ServicePlanning\Frontend_RoutingPlanner\Comtec.ServicePlanning.Frontend.RoutingPlannFrontend.RoutingPlanner.Model.dll' could not be found [D:\src\project\ServicePlanning\Frontend_RoutingPlanner\Comtec.ServicePlanning.Flanning.Frontend.RoutingPlanner.Tests.csproj]
Makefile.include:121: recipe for target `buildRoutingPlannerCSTests' failed
make: *** [buildRoutingPlannerCSTests] Error 1
and also
$ make runTests
Which gets stuck somewhere after running the Specrunner.html
######################################################
# run unit tests
######################################################
runTests: runRoutingPlannerJasmineTests runRoutingPlannerCSTests
runRoutingPlannerJasmineTests:
$(RoutingPlanner_TESTS_UTILITIES_DIR)/bin/phantomjs.exe $(RoutingPlanner_TESTS_DIR)/Scripts/jasmine.js $(RoutingPlanner_TESTS_DIR)/jsTests/SpecRunner.html
buildRoutingPlannerCSTests:
$(MSBUILD) `cygpath -a -w $(RoutingPlanner_TESTS_DIR)/Comtec.ServicePlanning.Frontend.RoutingPlanner.Tests.csproj` $(MSBUILD_OPTIONS) /t:Build /property:Configuration=$(VS_CONFIG) /fileloggerparameters:LogFile=`cygpath -a -w $(RoutingPlanner_TESTS_DIR)/Comtec.ServicePlanning.Tests-Build-$(VS_CONFIG).log`
runRoutingPlannerCSTests: buildRoutingPlannerCSTests
#rm -f '$(shell cygpath -aw '$(RoutingPlanner_TESTS_DIR)/bin/$(VS_CONFIG)/Comtec.ServicePlanning.Frontend.RoutingPlanner.Tests.trx')'
$(DOTNET_UNIT_MSTEST) /nologo '/testcontainer:$(shell cygpath -aw '$(RoutingPlanner_TESTS_DIR)/bin/$(VS_CONFIG)/Comtec.ServicePlanning.Frontend.RoutingPlanner.Tests.dll')' '/resultsfile:$(shell cygpath -aw '$(RoutingPlanner_TESTS_DIR)/bin/$(VS_CONFIG)/Comtec.ServicePlanning.Frontend.RoutingPlanner.Tests.trx')'
This section has an additional section at the begging of the script where the paths have been added.
RoutingPlanner_FRONTEND_API_DIR ?= $(RoutingPlanner_FRONTEND_DIR)/Comtec.ServicePlanning.Frontend.RoutingPlanner
RoutingPlanner_TESTS_DIR = $(RoutingPlanner_FRONTEND_DIR)/Comtec.ServicePlanning.Frontend.RoutingPlanner.Tests
RoutingPlanner_TESTS_UTILITIES_DIR = $(RoutingPlanner_TESTS_DIR)/Utilities/phantomjs-2.0.0-windows
RoutingPlanner_UTILITIES_DIR = $(PREPARESETUPDIR)/RoutingPlannerPortalUtilities
To be honest I am not even sure if I am following the right path to this since the steps I have found on the internet are different from what I found in the project and what I believe should be done.
For example: https://wiki.jenkins.io/display/JENKINS/Test+Results+Analyzer+Plugin
Mainly I believe this might be a simple "wrong path" issue but since my scripting skills are close to zero I am not sure what to modify and where.
I do not expect the solution at hand but I would really like to understand what the issues is or the proper way to actually make this work.
Thank you in advance.
Related
I was trying to move a build to a new build server and I was getting the following error:
..\packages\DllExport.1.5.2\tools\net.r_eg.DllExport.targets(70,7): error MSB3073: The command "NSBin.bat "" "SPDbUtil" "true"" exited with code 9009.
'NSBin.bat' is not recognized as an internal or external command, (TaskId:52)
The project has a reference to the following DllExport:
In looking at the following .targets file, it appears when running the Exec command the $(DllExportMetaLibFullPath), where the NSBin.bat file lives, is blank at the time it is called:
When I checked out the project and try and build it, it fails the first time and succeeds on consecutive builds.
If I add "echo $(DllExportMetaLibFullPath)" to the <PreBuildEvent> of the project- it builds successfully the first time.
Does anyone know why this happens? Am I missing something? BTW: this is an older project that I was trying to move to a new build system. The previous builds were completing because the build defs "Clean" option was "false". I can keep the echo in there but would be nice to know the correct way to handle this or have a definitive answer for the devs.
Thanks
So I am getting the rather common HTTP Error 502.5 - Process Failure now that I've hosted my project on a server VM running Windows Server 2016. While troubleshooting, I've attempted most of the solutions proposed for the same error:
ASP.NET Core 1.0 on IIS error 502.5.
Nothing else helped, so I'm looking at the answer that received the most upvotes. This mentions running the following command to receive a more meaningful message describing the error:
C:\fullpath\dotnet C:\fullpath\PROJECT.dll
I am honestly not sure how to execute that. What I did was navigate to the published project's containing folder on the server through the cmd, and issue the command like so:
dotnet .\My_Project Integration.dll
But the console prints this in response:
No executable found matching command "dotnet-.\My_Project"
Notice how the DLL is titled 'My_Project Integration.dll, however the word 'Integration' is absent from the console response. I do not know whether the underscore is to blame here, but any help is appreciated getting the command to run.
And of course, if you know of a solution to the actual 502.5, that is welcome as well.
You've likely got this issue: https://github.com/aspnet/Home/issues/1931. The ASP.NET Core IIS Module reads the Web.config to determine what to execute to run the app.
You said running dotnet ".\My_Project Integration.dll" worked successfully and enabling stdout showed the same issue of the path being truncated after the space.
Two options:
Remove the space from your project (this would be the easiest option)
Update your Web.config
If you do #2, your Web.config needs to have something like this for the arguments attribute:
arguments='".\My_Project Integration.dll"'
I have the official SonarQube docker image running successfully under http://localhost:32768/ (it is the one provided by Docker)
We want to perform some code analysys with C#.NET, this application is located in a folder called c:\myapplication (that is where I have the prj and sln)
My question is HOW! how can I tell my SonarCube, running in my docker http://localhost:32768/ , I want to analyse my C# code?
Thanks a lot!
Since the second answer provided seemed to be windows specific I decided to write down how it can be done in Linux, including the sonarqube installation.
1.) Run the command:
$sudo docker pull sonarqube
This will pull the docker image.
2.) Run the server using the command:
$sudo docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube
This will run the sonarqube server. You can then go to Firefox and visit the server at http://localhost:9000 and login with the password "admin" and user "admin.
------------------------------ Analyzing projects -------------------------------------------------------------------
1.) Download the sonarqube scanner from here:
https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild
2.) Unzip and place the files in a folder.
3.) Give executable permissions to the sonarcube file as follows:
$chmod +x <path-to-extracted-folder>/sonar-scanner-3.2.0.1227/bin/sonar-scanner
4.) Create a project using the user interface in firefox (localhost:9000).
5.) Go to the directory where the sln file is at and run the project commands. They will have one of the following forms:
$SonarScanner.MSBuild.exe begin /k:"project-key"
$MSBuild.exe /t:Rebuild
$SonarScanner.MSBuild.exe end
or
$dotnet <path to SonarScanner.MSBuild.dll> begin /k:"project-key"
$dotnet build
$dotnet <path to SonarScanner.MSBuild.dll> end
Either should work. Afterward you can see the your results in firefox.
To be pedantic about it, SonarQube doesn't analyze code. It presents the results of analyses to you (okay, it does actually do some further metric aggregation and calculation server-side). Instead, you want to tell the SonarQube Scanner for MSBuild to analyze your code. Doing so is fully documented.
Essentially
install the scanner
execute the Begin step (this tells the scanner to start listening)
(re)build your solution
execute the End step (tells the scanner to stop listening and process what it heard)
browse your project in the SonarQube interface.
The specific commands would look something like this:
SonarQube.Scanner.MSBuild.exe begin /k:"org.sonarqube:sonarqube-scanner-msbuild" /n:"Project Name" /v:"1.0"
MSBuild.exe /t:Rebuild
SonarQube.Scanner.MSBuild.exe end
Thanks for your answers, but after a couple of hours, I decided to write a post in my blog in how to do it step by step.
I know that there is plenty of documentation, but there are many bits and pieces to touch before you can see the analysis done properly.
I decided to shared my views and result with you guys,
http://netsourcecode.blogspot.co.uk/2017/01/continuous-code-quality-with-net.html
have fun!
I've the source code of ffmpeg and would like to build it in my win7. I've minGW installed on my machine. I found a step by step instruction from this link:
http://www.gooli.org/blog/building-ffmpeg-for-windows-with-msys-and-mingw/
The link 'Download updated bash for MSYS' did not follow. It showed the file is not found. When I try to build the program the way explained in the site, it shows an error:
Unknown option “–extra-cflags=-mno-cygwin”.
See ./configure –help for available options.
./myconfig: –extra-ldflags=-Wl,–add-stdcall-alias: command not found
./myconfig: –target-os=mingw32: command not found
From a similar question posted here, I followed the link http://ffmpeg.arrozcru.org/ but the static build downloaded from the site was corrupted. Pls help.
yeah, those instructions are really old, refer to old version of mingw/msys
better, new instructions (visual walk through ) available at http://ingar.satgnu.net/devenv/mingw32/base.html
you install msys, not bash, it comes with MinGW shell, /bin/sh.exe, and you use it to drive configure, just like ingar does with a whole bunch of other projects above
the usual magic incantation is
sh configure --enable-static --enable-shared
make test
make install
Our company was glad to see the release of the C# plugins for sonar, and jumped on the first release. However, we seem to be running into an execption reported by the ProjectLinkSensor. Here's what we did:
On a Windows XP machine, we installed the following:
Windows 7 Development kit (to get to FxCop)
Fxcop 10.0
Gallio
Sonar 2.9 RC1 (running the Derby database)
Maven
2.2.1
Then we checked out the solution, and placed the following pom.xml in the directory where the sln file is:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.rolfje</groupId>
<artifactId>SomeSilverlightProject</artifactId>
<version>1.0-SNAPSHOT</version>
<name>SomeSilverlightProject</name>
<properties>
<sonar.language>cs</sonar.language>
</properties>
<build>
<sourceDirectory>${basedir}</sourceDirectory>
</build>
</project>
In the home directory of the user that's running the maven build we've placed the following settings.xml:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>dotnet</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.gallio.mode>skip</sonar.gallio.mode>
<sonar.gallio.installDirectory>C:/Program Files/Gallio</sonar.gallio.installDirectory>
<sonar.fxcop.mode>skip</sonar.fxcop.mode>
<sonar.fxcop.installDirectory>D:/Program Files/Microsoft Fxcop 10.0</sonar.fxcop.installDirectory>
<sonar.partcover.mode>skip</sonar.partcover.mode>
<sonar.partcover.installDirectory>C:/Program Files/PartCover/PartCover .NET 4.0</sonar.partcover.installDirectory>
<sonar.gendarme.mode>skip</sonar.gendarme.mode>
<sonar.gendarme.installDirectory>C:/Program Files/gendarme-2.6-bin</sonar.gendarme.installDirectory>
<sonar.gendarme.mode>skip</sonar.gendarme.mode>
<sonar.stylecop.installDirectory>C:/Program Files/Microsoft StyleCop 4.3.2.1</sonar.stylecop.installDirectory>
<sonar.jdbc.url>jdbc:derby://localhost:1527/sonar</sonar.jdbc.url>
<sonar.jdbc.driver>org.apache.derby.jdbc.ClientDriver</sonar.jdbc.driver>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<sonar.host.url>http://localhost:9000</sonar.host.url>
</properties>
</profile>
</profiles>
</settings>
Please note that I put "skip" in front of all modules. I did this one by one, hoping that switching off one of these modules would remove the error and I would be able to give you a clearer bug report. However this did not help.
When I go into the project directory (where the sln file is) and I run the following command:
mvn -e clean sonar:sonar
I see that the maven sonar plugin does analysis, fetches settings from the local sonar instance, and generates the expected output files (target/sonar/stylecop-msbuild.xml for instance). However, these reports do not get uploaded to sonar, and I see the following error being reported by maven:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Can not execute Sonar
Embedded error: org.sonar.plugins.core.sensors.ProjectLinksSensor has unsatisfied dependency: class org.apache.maven.project.MavenProject among unsatisfiable dependencies: [[class org.apache.maven.project.MavenProject]] where org.sonar.batch.bootstrap.ProjectModule#2c507f:135<I<org.sonar.batch.bootstrap.BatchModule#659812:139<I<org.picocontainer.DefaultPicoContainer#eb1882:44<| was the leaf container being asked for dependencies.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
Aside from the rather unhelpful error (ProjectModule#2c507f doesn't really tell me much), this looks like a nasty bug, which is causing the sonar upload (at least for me) to not work.
Did anybody else have this issue? What is causing this and why is the error reporting so terrible in this case?
Please note taht I've also reported this as a bug on Jira, because I really think the Sonar/C-Sharp plugin ecosystem is leaving me in the dark here. However, it was put into the "Wont't fix" state without additional information. The Jira bug is here: https://jira.codehaus.org/browse/SONARPLUGINS-1264
I don't know if this will solve your problem, but I noticed that you refer to the C drive in all of your <sonar.*.installDirectory> tags, except for <sonar.fxcop.installDirectory>.
Oh, and you could also try to disable the stylecop module since you've accidentally copy-pasted <sonar.gendarme.mode>skip</sonar.gendarme.mode> in front of that module...
I am one of the main developers of sonar for c#.
I did not seen your jira ticket before. I actually agree with Fabrice, you should have send a mail to the user mailing-list.
About your issue, my first guess is that there is an error with your pom.xml file.
If you use "mvn -e clean sonar:sonar", you need to declare in the pom.xml file the "maven-dotnet-plugin" plugin. The "clean" part will be performed by this plugin.
Also, the correct command line would rather be "mvn clean package sonar:sonar", there will not be any assembly to analyse.
For more information on the maven-dotnet-plugin you can check out the documentation on :
http://maven-dotnet-plugin.appspot.com
You will find a pom example here :
http://maven-dotnet-plugin.appspot.com/configuration.html
Hope it helps