Jenkins integration with JMeter - build is failed giving **Error: Unable to access jarfile ApacheJMeter.jar errorlevel=1** - jenkins

Jenkins Cosole output :updated 2
When executing the Jmeter .JMX file using JMeter non GUI mode, it is working fine and I am able to get the .JTL file, but when I am trying to trigger the build using Jenkins it is getting failed giving Error: Unable to access jarfile ApacheJMeter.jar
errorlevel=1 as message from console output .
Please note that I have added Perfomance Plugin in Jenkins and made jmeter.save.saveservice.output_format=xml enabled in JMeter user properties. Please help if I am missing anything to setup the configuration.
Build cmd command
C:\jmeter\bin\jmeter -J jmeter.save.saveservice.output_format=xml -n -t C:\jmeter\bin\edueka.jmx -l C:\jmeter\bin\report3.jtl
code from CMD - JMeter non GUI
JMeter Jar file access from CMD

There is nothing wrong with your command, it should work normally.
Double check that the main JMeter executable .jar exists and the user which executes Jenkins process has correct permissions to access this file:
c:\jmeter\bin\ApacheJMeter.jar
The most common mistake is that users download source bundle of JMeter instead of the binary
Also the correct syntax for passing JMeter Properties via -J command line argument is:
J needs to be capital
remove the space between J and the property name
C:\jmeter\bin\jmeter -Jjmeter.save.saveservice.output_format=xml -n -t C:\jmeter\bin\edueka.jmx -l C:\jmeter\bin\report3.jtl
Also currently there is no need to switch JMeter results format to XML, Jenkins Performance Plugin is capable of processing JMeter results files in .CSV format as well

Related

Jenkins Job to run SOQL query

I'm trying to get a Jenkins job to run sfdx force:data:soql:query commands in order to migrate configuration data sets between our production org and our sandboxes after a refresh. Certain configurations do not persist on a refresh so we need a way to move that data.
Running the queries from the command line on the Jenkins server work as expected, however the job when it runs fails with the following error:
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
Build step 'Execute shell' marked build as failure
The job does three things:
Authorizes to the DevHub, lists out the connected orgs, and then performs a SQOL query to just print some data - 16 lines to be exact. Here are the commands in the shell script of the job:
sfdx force:auth:jwt:grant -i ${CONNECTED_APP_CONSUMER_KEY} -u ${DEV_HUB} -f ${JENKINS_HOME}/certs/prod/server.key -r [...] -a DevHub
sfdx force:org:list
sfdx force:data:soql:query -u ${DEV_HUB} -q "SELECT Id, Name FROM [...tablename...]" -r human
I am completely stumped on why this is happening. Again, running the SOQL command directly on the server through PowerShell or Command Line works as expected. I would appreciate any help with this.
This one stumped me for a long time but we finally got it figured out.
If you are seeing this error, make sure to check your machine's environmental variables. I saw a TON of other answers pointing to this as the issue where the install of SFDX path name had spaces in it as in C:|P:rogram Files\SFDX\bin but only showed some weird command line FOR loop that made no sense what so ever.
What we did was to completely uninstall all of SFDX making sure none of it was left on the machine and reinstalled into a folder we made where there was no spaces in the path name.
Once we did that, our job worked like it was supposed to. I hope this helps others who run into this same issue.

Jenkins/Robot Framework - looking for chromedriver but I think it's in PATH

Hey in Jenkins I'm trying to run robot framework tests:
with command python3 robot -d results mytestsuite.robot, and it has some line to open chrome browser, but the message in log shows me typical: WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see...
Everything works ok locally, and I'm not sure which PATH jenkins wants to use so my questions are:
why do I have to input python3 instead of python (with just python in command it tells me that robot is not found)
why chromedriver is not found, and how to set it up (in what PATH and how) to make it work
Is it possible to set jenkins up to use other drivers ex. geckodriver?
My jenkins job env looks like this:
#!/bin/bash
echo $JENKINS_HOME
which python3
echo $PATH
outputs:
/Users/MYUSER/.jenkins
/usr/bin/python3
/Users/MYUSER/.jenkins/tools/chromedriver:/usr/bin:/bin:/usr/sbin:/sbin
Ok so I've fixed it with:
export PATH=/Library/Frameworks/Python.framework/Versions/3.9/bin/:$PATH
this is the location where I have chromedriver locally.
in the build shell execute but is there a way to make it more permanent (I mean not to use it every time it runs build?)

parallelshell command not found

When I run parallelshell command (I installed parallelshell using npm install -g parallelshell), on the server, it works. But when Jenkins runs the command, I get the error, parallelshell command not found.
Why is Jenkins not recognizing the command? the command works for me when I log into the server.
Jenkins may be running under different user(That is default in Windows service, or linux installations). This will have different path variable and other user-specific settings.
You must give absolute path to command.

fpm is not recognised if executing script with jenkins and ssh

I am trying to execute a script over ssh connexion with Jenkins. I am using the SSH plugin and it is well configured. I arrive to execute the first part of the script, but when I try to execute a fpm command it says:
fpm: command not found
If I connect to the instance and run the same script that I call via Jenkins it runs and there is no error (fpm is installed).
So, I have created a test like a script test.sh:
#!/bin/bash -x
fpm
but, with Jenkins, I get the same error: fpm: command not found, while if I execute it I get a normal "parameter needed":
Missing required -s flag. What package source did you want? {:level=>:warn}
Missing required -t flag. What package output did you want? {:level=>:warn}
No parameters given. You need to pass additional command arguments so that I know what you want to build packages from. For example, for '-s dir' you would pass a list of files and directories. For '-s gem' you would pass a one or more gems to package from. As a full example, this will make an rpm of the 'json' rubygem: `fpm -s gem -t rpm json` {:level=>:warn}
Fix the above problems, and you'll be rolling packages in no time! {:level=>:fatal}
What am I missing? Why it cannot find fpm if it is installed?
Make sure fpm is in /usr/bin..
It seems that the problem came because the fpm was installed in the /home/user2connect/bin/, and the command was not recognised. For fixing this I had to call it wit the whole path:
/home/user2connect/bin/fpm ...
I have chosen to reinstall the fpm using sudo, so now it works.

How to enter chroot on Jenkins

Hi i am trying to automate the process of sync and build chromium builds on a Jenkins server
http://www.chromium.org/chromium-os/quick-start-guide
./chromite/bin/cros_sdk --enter
i am trying to run something like this ,the desired output is expected to be a chroot prompt with a changed home directory, I have a Jenkins slave and when i do these steps manually, i am able to enter chroot without any issues and it provides me with the changed home directory and the path shows up where i need it to be for the next step ,
But when i roll this into a Jenkins Execute Shell on the same machine and same credentials, it is not able enter chroot,
./chromite/bin/cros_sdk --enter --log-level=debug
15:59:05: DEBUG: Cache dir lookup.
15:59:05: DEBUG: Configured cache_dir to '/media/1TB/home/qcaswnbu/jenkins1/workspace/Brillo_trial/.cache'
This is what i get in Jenkins
Manually though
./chromite/bin/cros_sdk --enter --log-level=debug
17:27:05: DEBUG: Cache dir lookup.
17:27:05: DEBUG: Configured cache_dir to '/media/1TB/home/qcaswnbu/jenkins1/workspace/Brillo_trial/.cache'
17:27:05: DEBUG: Configured cache_dir to '/media/1TB/home/qcaswnbu/jenkins1/workspace/Brillo_trial/.cache'
i get an extra line with the same message , could there be a chance its quitting half way through when it is initiated from Jenkins job ?
any input is greatly appreciated.
Thanks
Prem
when you run cros_sdk by itself, it expects an interactive prompt. i imagine Jenkins has no terminal attached (by design) which means trying to use it that way doesn't make much sense.
we've designed the tool so it can easily be scripted. if you have some command you want to run inside of the chroot, simply pass it as an argument:
$ cros_sdk -- ls /
bin build dev etc home lib lib32 lib64 ....
i think that should get you everything you need.

Resources