I'm relatively new to Jenkins and I'm attempting to add JSHint to my build process. Currently, I have the "Checkstyle Plug-in", "JSHint Report Plug-in", and "Violations plugin" installed on my Jenkins server. In 'Jenkins->Configure->Build->Execute shell' I have the following:
jshint --verbose --reporter=checkstyle > jshint.xml || exit 0
But I'm not exactly sure what's going on here. I found similar commands on other tutorials, but they were half-baked and didn't fully explain what this line of code does.
My goal is to run JSHint on my Jenkins server and send the output/results from JSHint to a file that I can then email to the admin. Any explanation about what the above line of code is suppose to do would be much appreciated. Any links or suggestions on how to add JSHint to a Jenkins build would also be helpful. Thanks ahead of time!
First part of command:
jshint --verbose --reporter=checkstyle
is jshint call with two parameters to turn on verbose mode and export report in checkstyle compatibile format. (Checkstyle is used because Jenkins was originaly designed for Java and Checkstyle is one of Java linting tools -> Jenkins Checkstyle plugin can pick up such formatted report)
Second part:
> jshint.xml
Is linux shell redirection from standard console into file called jshint.xml. This will save your report into file.
Third part:
|| exit 0
Seem to me unnecessary because it does logical OR with exit code values of commands on both sides. Command on right side is saving jshint report into file and command on right side returns 0 error code. So final error code seem to be output of command on right side anyway.
Related
I am trying to build a Taurus yaml file for the below Jmeter scenarios, I have 2 threads where I am passing the Number Of Threads and Duration. Now with the regular command line, I use the below command to start the script, I use this same command from Jenkins too. This works fine and generate reports but not blazemeter one, so i am trying Taurus integration...
nohup /ssd/jmeter/apache-jmeter-5.3/bin/jmeter3g -Jquoteoff.threads=20 -Jquote.threads=20 -n -t /ssd/jmeter/scripts/PerformanceTesting/src/PS/OFFLINE_ONLINE.jmx
My below YML give me error, i am not sure if i am missing anything.
execution:
- scenario:
properties:
quote.threads: 20
quoteoff.threads: 20
onduration: 3600
script: /ssd/jmeter/scripts/PerformanceTesting/src/PS/OFFLINE_ONLINE.jmx
Also is there any direct command like shell we can use to invoke this script? I have seen a few places directly calling JMX script in Jenkins but not sure how to pass parameters in that scenarios.
I have no clue what's wrong here but below line is what causing the failure when i am trying to run bzt script.jmx
log.debug( vars.get("QUOTE_ID"));
To fix it when I changed log.debug to log.info it fixed the below problem I was facing. This is the partial answer as i am not sure about the reason for failure, but this should solve an issue where the script runs fine in Jmeter but bzt gives an error for XML parsing.
Wouldn't that be easier to add BlazeMeter Uploader plugin to your JMeter test plan, the plugin can be installed using JMeter Plugins Manager
It's possible to run existing .jmx script without creating any YAML
bzt /path/to/your/test.jmx
The correct syntax to define properties is:
execution:
- scenario: simple
scenarios:
simple:
script: tests/jmx/dummy.jmx
properties:
quote.threads: 20
#etc
Parameters can be passed via -o command-line argumententer link description here
So I am having trouble uploading our dotCover results from Jenkins to our Sonar instance. We are using the SonarScanner for MSBuild plugin. All of the documentation I have found like here: https://docs.sonarqube.org/pages/viewpage.action?pageId=6389770#CodeCoverageResultsImport(C#,VB.NET)-dotCover
Shows how to do it from the command line. We are using the plugin. There is an area for additional arguments that I have added what I assume is an added argument like on the command line. Here is how I have it set up:
So that is the argument that everything shows to add to the end of the command line portion, but for some reason it doesn't add coverage to Sonar. Does anyone see anything obvious I am missing here? I have been stuck on this for a while. Thanks!!
So as it turns out I had:
/d:sonar.cs.dotcover.reportsPath=
It should have been with an s at the end:
/d:sonar.cs.dotcover.reportsPaths=
I am trying to generate code from RhapsodyCL using a batch script. When I run this batch script using cmd, the code is generated just fine but when I try to generate code via Jenkins I am getting error in the Jenkins build output which I think is because of trying to start RhapsodyCL due to 'license not found'.
The error in Jenkins console output looks like:
11:33:10 C:\Test>rhapsodyCL.exe -f C:\Test1\Test-BitBucket\script.bat
11:33:13
11:33:13 C:\Test>exit -1
-1 is the rhapsody return code for license not found.
So is this a Jenkins issue that it can not find the Rhapsody license ? Or is it something else ?
There are not many details in your question but rhapsody code generation via jenkins has worked for me in the past so:
Is it rhapsody installed for All Users in the jenkins machine?
I am looking at using Jenkins on Windows.
I currently have an ant script. It works pretty well. Except for instance, when the build breaks because of a syntax error, I can not see the error in the Jenkins console log.
So I am thinking may be ant is not the best tool for use on Windows.
What do most of you use for Jenkins on Windows?
If it is ant, how do you send the build output, VStudio, to the Jenkins console?
Thanks
Primarily I use Jenkins with maven projects, although you should see the ANT output in the online logs regardless.
What are you building? Are you building Java projects? Ant is what you use. If you are bulding a C project, you should use Make. If you're building a VisualStudio project, you should use msbuild. You use the build tool for your project. Jenkins will execute them without a problem.
Take a look at the build in question. On the left side of the screen, there's a Console output item. Click on that. Is there any output. No matter what tool you use, Jenkins captures the STDOUT and STDERR in that console output. If nothing else, you should see the exact commands Jenkins is executing to checkout and to build your project. Try executing those commands.
Still, you didn't give us much to go on. No idea what you're building or what you're doing with Ant. You didn't state any error, the console output, or even what the Jenkins error log is stating.
Jenkins does two things:
It watches your repository for changes.
Once it detects the changes, it executes the very commands you'd execute to build the project.
Jenkins doesn't care whether you use Ant, Maven, Make, or simply do a del /s/q. Jenkins will simply execute the commands you tell it to execute.
Addendum
It is c, c++, Java and InstallShield. I use ant to do file copy and move, call msdev.exe project. Some Javac calls, InstallShield command line builds..
Jenkins can execute multiple step builds in a single job. After you specify the build step, you can press the Add button to add another build step. There's no reason that all the build steps even have to be of the same type. Just select a "Freestyle" build, and use the right build tools for the job.
There's an optional MSBUILD plugin in Jenkins that should do your MS Build. This should give you the complete output from MSBuild, so you can see any errors.
After you do your MSBuild step, you can create a second build step to run an Ant task to build your InstallShield. After that, you could run another build step to do the copying you need either on the command line or through something like Ant (or Nant.
Whatever the output of the various tools is the output you'll get in the build console.
dev.cmd shows the output and I continue to use ant.
I can't seem to run a build execute shell step in Jenkins. I've worked with Hudson in the past on windows and I was able to create shell/batch steps without a problem but I seem to be be missing something here.
It's a fresh jenkins install and I go to "add build step", "execute shell" and enter "echo hi" in the command. I run the build and when I look in the console output, nothing happens.
I've also tried executing a test.sh file which also just echoes hi. I've tested this in both a linux install and an os X installed Jenkins server.
What am I missing in the configuration to run a shell script?
The console output shows that the shell script steps were skipped completely
Started by user admin
Finished: SUCCESS
It looks like Jenkins is not being able to redirect the output from the system. What version of Java are you using? If you're using OpenJDK, could you try with Sun Java/Sun JDK?
First test to try to check if anything is executing at all: add the following to your "Execute Shell"
#!/bin/bash
echo "HELLO WORLD" > /tmp/testfile
Run this and check if there is a /tmp/testfile in on your Linux system, and if it contains the HELLO WORLD text, it means your script is in fact executing.
Which version of Jenkins do you have?
The last good version that I can attest to (last one I know works well at least for us) is 1.447. If you're not using that one, would you be able to try with it?
Also, could you add #!/bin/sh or #!/bin/bash before echo hi on your "Execute Shell" for the Linux system and see if that works.
Also, try running a script using source /path/to/script and see if that works. The script should contain #!/bin/sh or #!/bin/bash as the first line, just to see if that makes a difference.
Note: none of this should be required, but is helpful just to get more information on what's going on. Couldn't fit all this into a comment. I'll update my answer based on your answers to the above, or delete if I can't get anything..
Putting this here for posterity.
I had a Jenkins project configured with Maven running clean test and a execute shell in the pre steps. The logs from Maven where not coming through and the script was not executing. Once I unchecked Build modules in parallel under the Maven build options my logs and scripts started working.
Make sure its in a location where Jenkins can see it, check permissions.