Bash - MSBuild - File Logger - file

I'm trying to improve our local build implementation, by using Bash and pending the success of a solution build, run the unit tests.
At the moment I want to pipe the results of the build in quite mode to the console (using default console logger) but pipe the results in more detail to a file using the file Logger.
From the bash I can execute the build fine, providing I don't specificy the FileLogger.
C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe /verbosity:q D:/MyDocs/Main.sln
The minute I do this :
C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe /verbosity:q D:/MyDocs/Main.sln /logger:FileLogger,Microsoft.Build.BuildEngine; /flp:logfile=Build.Log
The build fails and I get a could not load file or assembly Microsoft.Build.BuildEngine.
I've also tried changing dir so that I'm in the framework directory, but still get the same error.
As an aside I'm trying to provide the devs's with a quite verbosity for the local builds, but enable auto execution of the tests if the build is successful. I'll analyse build success by reviewing the contents of the Build.Log file for "Build Succeeded" Or "Build Failed"
I tried pushing the result to file using > "Build.log" but that impacts the colouring of the build output on the console which diminishes some of the value of what I'm trying to achieve.
Any help would be great.
Thanks

Microsoft.Build.BuildEngine is a namespace and not an ILogger. If you replace that portion in:
/logger:FileLogger,Microsoft.Build.BuildEngine;
... with a valid ILogger it's more likely to work.

Related

"UnetStack libraries missing" error received when trying to run UnetStack simulation script from command line

I am trying to run my UnetStack simulation script using command line. My simulation file is in the sample folder, and I open a terminal window in the unet folder (where README.txt exists). I followed the README.txt instructions, and I tried to run other simulations script from the sample folder, but I always get the following error:
ERROR: UnetStack libraries missing...
However, everything works well if I run the simulation using IDE. I will be grateful if you help sort out this problem, so I run the simulation through command line.
I tried to run the simulation script using command line. I followed README. txt instructions, but it didn't work.
I tried this: bin/unet samples/super-tdma/e3-network.groovy and many other simulation scripts.
This is to make sure that my question has been posted, as I can't see it within the listed questions.
You can use v1.3 or
In v1.4, Copy all the Items from the folder "UnetID" to the "root folder", then run the simulation.

Jenkins parameter is getting replaced by a white space

I have a parameterized build (copied from an existing job) in Jenkins. While building, my parameter is getting replaced by a white space. Here I am sharing what I have.
Parameter Name: BuildDate (I tried using %% and ${} but no luck)
Windows batch command:
copy \\Network_drive\dir1\dir2\dir3%BuildDate%\filename*.zip .
Output from Jenkins console:
c:\jenkins\workspace\my_build_job_name>copy \\Network_drive\dir1\dir2\dir3\ \filename*.zip .
\\Network_drive\dir1\dir2\dir3\ \filename*.zip
The system cannot find the path specified. 0 file(s) copied
c:\jenkins\workspace\my_build_job_name>exit 1
Build step 'Execute Windows batch command' marked build as failure
Notifying upstream projects of job completion Finished: FAILURE*
Note: We have a Windows/Linux mixed environment. Whenever we want to run shell scripts, we use Cygwin, batch should directly run.
Finally it turned out that one of the parameters was not populating due to hitting "rebuild last". Re-running the whole pipeline did it work. I still wonder why it was not populating but its all hood now!!!

Nagios Plugin Error: (No output on stdout) ... failed. errno is 2: No such file or directory

I am using custom Nagios plugins for the first time and am running into this error when I create a service for the plugin.
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load.py, ...) failed. errno is 2: No such file or directory
The plugin works when I run it on the command line, however does not work when it runs within Nagios.
I followed these steps to get the plugin into Nagios
https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf
Here is what it looks like in the Nagios UI
The plugin is in the correct path: /usr/local/nagios/libexec and the resource.cfg file has the same path within it.
I tried two separate plugins, both which work on the command line, and the result is the same error.
The error indicates the file location is incorrect, however the plugin is in the specified directory and runs with no errors within that directory.
I am totally stumped and appreciate any help.
For anyone reading this, I solved the problem.
The first time I added the plugin, I forgot to add the python extension. When I updated the already created plugin, Nagios still threw the error.
Once I completely deleted the plugin and re-created it the 'file not found', error went away.
I faced a similar issue when I was trying to add a custom plugin ( I had custom plugins in ruby and python ).
The issue was the missing shebang line at the start of the script (which determines the script's ability to be executed like a standalone executable).
For example, if you have a python plugin custom-plugin.py then make sure this script has shebang at the start of script #!/usr/bin/env python3. Also if you have other scripts (ruby, bash etc.) make sure to add the appropriate path at the start of your scripts.
Also, check the path for plugins Nagios version. For my setup path was /usr/local/nagios/libexec/ and make sure your custom plugin is executable and has correct ownership permissions.
Sample custom template I used :
define command {
command_name check_switch_health
command_line /usr/local/nagios/libexec/check_snmp.rb --host $HOSTADDRESS$ --model "$ARG1$" --community "$ARG2$"
}
The above workaround worked for me.

manage Jenkins build status

I'd like to run batch using jenkins. And the status of build depends of number of files created in a specific folder. My question is how could I manage Jenkins build status depending of number of files created?
You can execute a shell script to count the files and return 1, if the count isn't expected.
Another way would be to use the Text-finder Plugin searching for a pattern in the console log.
Groovy Postbuild Plugin is another alternative:
buildUnstable() - sets the build result to UNSTABLE.
If you like to use the CLI you can use the following command:
java -jar jenkins-cli.jar -s http://...:8080/ set-build-result
Sets the result of the current build. Works only if invoked from within a build.

loading program in econotag (contiki 2.7)

I am currently trying to run my code(written and compiled in contiki 2.7) in econotag. However i wasn't able to do so. I can compile with out any problem using
make TARGET=econotag hello-world.
but when i try to upload using the command
make TARGET=econotag hello-world.upload
the following message appears
../../platform/econotag/Makefile.econotag:10: ../..
make: *** No rule to make target `hello-world.upload'. Stop.
I know it used to work perfectly in contiki-2.6 with TARGET=redbee-econotag. so i tried it but the message was
**** This platform is old and will soon be removed ****
please use TARGET=econotag instead.
(or set ALLOW_OLD_PLATFORMS=1 to proceed)
. Stop.
I have seen some posts about installing the tool chain for uploading on econotag. but they didn't provide step by step procedure.
can anyone tell me what/how i should to install the tool chain to solve this problem and what command i should use after installation.
Here is how my colleague solved it
first compile the program you want to load (in this case hello-world) with
the command
make TARGET=econotag hello-world
note that this will generate a binary file with file name hello-world_econotag.bin (in the same directory with the code)
then go to directory
contiki-2.7/cpu/mc1322x/tools
and execute the pearl script used to upload binary files. (use the following command)
sudo ./mc1322x-load.pl -f "path to your binary file" -t /dev/ttyUSB1
this will upload the binary of your code to the econotag.
then reset your device (either with command or manually)
and the code should be running now

Resources