How to build JMeter script using .jmx file in Jenkins - jenkins

I have created the .jmx scripts for performance testing and I tried to run through those scripts using GUI mode and NOn-GUI mode in the local system using command window and Jmeter tool and it worked fine.But I want to run this scripts in Jenkins remotely using GitHub.
So is there any possible way for me to run the JMeter scripts in Jenkins.
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
Build step 'Invoke Artifactory Maven 3' changed build result to FAILURE
Build step 'Invoke Artifactory Maven 3' marked build as failure

Actually it will be the same, you will just need to add a Jenkins build step in order to fetch the .jmx file from Github prior to running JMeter.
For free-style projects it can be configured in GUI
In case of Groovy pipeline it would be something like:
git branch: 'some', credentialsId: 'your_credentials_id', url: 'https://github.com/apache/jmeter'
References:
Jenkins Source Code Management with Git
Jenkins Pipeline Syntax
Continuous Integration 101: How to Run JMeter With Jenkins

Related

Jenkins pipeline to call SonarQube code coverage for node.js project

I am trying to do code coverage for node js project via Jenkins, I’ve one doubt that where to add the “sonar-project.properties” file, it in root repository that means in sonar-scanner installed repository or in the jenkins path i.e. “/var/lib/jenkins/workspace/$JOB_NAME/”,
can some help to fix this I’m getting error while executing the pipeline.
Error log as follows:
/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/sonardemo/bin/sonar-scanner
/var/lib/jenkins/workspace/demosonar#tmp/durable-f32cf5e2/script.sh: 1: /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/sonardemo/bin/sonar-scanner: not found
[Pipeline] }
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeed?

Build step 'Publish Performance test result report' changed build result to FAILURE Finished: FAILURE

Cannot detect file type because of error, and : Failed to copy Build step 'Publish Performance test result report' changed build result to FAILURE Finished: FAILURE. whenever i run the script always i face this..
Take a look into Jenkins Console Output - it should give you the reason for the failure.
Most probably the Performance Plugin fails to find JMeter's .jtl results file in Jenkins Workspace, either the .jtl results file is missing or you're pointing the Performance Plugin to the incorrect location.
If you have a Script step to run a JMeter test like:
jmeter -n -t test.jmx -l result.jtl
You should be able to use simply result.jtl in the Performance Plugin.
Check out:
Performance Trend Reporting
How to Use the Jenkins Performance Plugin
and Running Performance Tests articles for more details on various aspects of Jenkins Performance Plugin use cases.

Setting up Sonar-Gerrit plugin : Failed to execute command 'gerrit review ' on UserAtHost

I'm trying to set up the Sonar-Gerrit plugin on a Jenkin job.
Set up
Jenkins Maven job is launched when a patch set to Gerrit
I see the error in the Jenkins output.
Here is the Jenkins console error output :
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (
default-cli) on project parent: Failed to execute project builder: fr.techad.sonar.GerritProjectBuilder: Failed to execute command 'gerrit review 298816ea2b24645fd971a8c0833582cec1163dac -j' on UserAtHost#55a9f72f [user=jenkins, host=172.21.33.193, port=29418]: reject HostKey: 172.21.33.193 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
What I have tried so far
Looking the [Help 1].It says
this exception is not generated by the Maven core itself but by a plugin.
I tried to log in the Jenkins server and run "mvn sonar:sonar" in the directory(/usr/share/tomcat/.jenkins/workspace/sonar-maven).It runned successfully and I could see the results on the Sonar Dashboard.
Reconfigure Gerrit Trigger plugin.
Then I checked the connection in the Gerrit Trigger,and it sad successful.
Did anyone have this same error? how can I try to fix it?
Software Version
Jenkins 2.101 , Sonar-Gerrit plugin (2.3) ,Gerrit Trigger (2.21.2)
Gerrit 2.14.6
Sonarqube 6.7
your exception says:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin
It's your maven plugin for sonar is failing the job, not the sonar-gerrit plugin.
Failed to execute command 'gerrit review 298816ea2b24645fd971a8c0833582cec1163dac -j'
I don't know what does sonarqube command "gerrit review -j" and it looks like that this sonar-maven-plugin doesn't know it, either.
You could try looking into this question - it may help you to configure sonarqube for your project: Why Maven command MVN sonar:sonar works without any plugin configuration in my POM.xml?
The error is:
Failed to execute command 'gerrit review 298816ea2b24645fd971a8c0833582cec1163dac -j'
Sonar-gerrit uses the gerrit-trigger plugin to vote in Gerrit. It seems there is something wrong with the gerrit-trigger configuration. I know you've checked the connection between gerrit-trigger and Gerrit but this is error is related to the "gerrit review" command.
Check the "gerrit review" command at:
Jenkins > Manage Jenkins > Gerrit Trigger > Edit > Advanced... > Gerrit Verified Commands
For example, it works to me with:
gerrit review <CHANGE>,<PATCHSET> --message 'Job finished <BUILDS_STATS>' --code-review <CODE_REVIEW>
After that, if the error persists, log in the Jenkins server and run the "gerrit review" command manually executing:
ssh -p 29418 jenkins#172.21.33.193 gerrit review
If you get the same error you can try to debug it adding "-vvv" to the command.

When I am running Execute SonarQube Scanner on Jenkins, job always fails

I am running Execute SonarQube Scanner on Jenkins, but the job always fails.
The job log shows:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:
sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project
helpRequestMgmtUI: Not authorized. Please check the properties
sonar.login and sonar.password. -> [Help 1]
In job configuration, I added the following into Analysis properties:
sonar.projectKey=org.sonarqube:javascript-lcov-sq-scanner
sonar.projectName=My project
sonar.projectVersion=1.0
sonar.language=js
sonar.sources=webapp
sonar.sourceEncoding=UTF-8
sonar.javascript.coveragePlugin=jacoco
sonar.login=admin
sonar.password=admin
In the last two lines I have already added user name and password but it does not work for executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603
However, the SonarQube dashboard is created successfully.
How do I avoid this authorization exception, when analysing my project?

Error in Executing Jobs on Slave In Jenkins

I have Master Slave configuration under Jenkins.I wanted to run a job on the slave system under Jenkins I order to do that I have copied the required scripts and files But I have been getting the following error
Started by user anonymous
[EnvInject] - Loading node environment variables.
Building remotely on MySlave in workspace C:\Users\prathamesh.n\workspace\MasterSlave
FATAL: Cannot find executable from the chosen Ant installation "apache-ant-1.9.4"
Build step 'Invoke Ant' marked build as failure
Archiving artifacts
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at PROJECT level C:\Users\sudharshan.r\workspace\Ant\exec\reports\Test 1 to C:\Users\sudharshan.r.jenkins\jobs\Project 11\htmlreports\HTML_Report
ERROR: Specified HTML directory 'C:\Users\sudharshan.r\workspace\Ant\exec\reports\Test 1' does not exist.
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: C:/Users/sudharshan.r/workspace/Ant/exec/reports/Test 1/testng-results.xml
Did not find any matching files.
[BFA] Scanning build for known causes...
[BFA] Done. 0s
Finished: FAILURE
need help on executing ant on slave
Click on Jenkins - > Manage Jenkins -> configure system -> Under Ant, define your installer and then in your job select that ant configuration.
Whats your configuration in your build? Default or let's assume my 1.9.
Now in "configure jenkins": Add a specific ant e.g. with name my 1.9.
easiest way is automatic installation and installation from Apache
if you don't want to do this: uncheck automatic installation and give your path were you installed ant in the field: ANT_HOME

Resources