Just curious whether we can get the jmeter logs printed in Jenkins console. This is what I am using in Jenkins to run the Jmeter
sh "/home/jenkins/jmeter/apache-jmeter-5.1/bin/jmeter.sh -f -n -t my.jmx -l output.jtl -j jmeter.log -p my.properties -e -o results"
archiveArtifacts '**/jmeter.log'
Above can generate the logfile and archive.
My requirement is to see them in Jenkins console logs.
You can try adding -j /dev/stdout switch to your command line, as per JMeter Documentation
-j, --jmeterlogfile jmeter run log file (jmeter.log)
and /dev/stdout is a Linux device file providing read/write access to STDOUT standard stream
Alternatively you can amend JMeter's logging configuration and add one more appender to print the log messages to the STDOUT as well.
And last but not the least according to JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.4.3 (or whatever is the latest stable version which is available at JMeter Downloads page)
Related
I have a pyspark project with few unit test case files
test case files
test_testOne.py
test_testcaseTwo.py
These test classes are executed inside a docker container. While running the tests inside the container i want to get the test coverage reports also. Therefore I added the following line in my requirements.txt file
coverage==6.0.2
And inside the docker container I run he following command
python -m coverage discover -s path/to/test/files
I am getting the following output
/opt/conda/bin/python: No module named coverage
Can anybody help me to run my tests successfully with test coverage. Please note that all test cases r successfully running inside the container with the following command. But its not generating the test coverage
python -m unittest discover -s path/to/test/files
If you are using coverage the command:
python -m unittest discover -s path/to/test/files
Becomes:
coverage run -m unittest discover -s path/to/test/files
As specified in the documentation: Quick Start
Since you are using docker, a good option is to create a volume inside a docker container and when the tests are finished, coverage can generate a report and store it on your host machine. Like that you could automate the whole process and save reports.
Create a volume using -v flag when you start a docker container (more info: Use Volumes)
After the tests, run coverage html -d /path/to/your/volume/inside/docker (look in the documentation for more option: coverage html)
I have this set of services I wish to do some logging for. Some services are running a node app, so the output is directly visible in the docker logs command.
However, a couple are different. Let's use my Java application as an example. It's running in a wrapper but the logging is written to a log file instead of STDOUT.
How can I hook the file as the docker logs output?
ps. The other app is an PHP app on a Nginx server, also with it's own logging file.
-UPDATE
The application is a Java application (.jar file) running in Java Service Wrapper from Tanuki. The built JAR has a Log4j logger writing via a DailyRollingFileAppender to logs/server.log. The Wrapper itself has output which I ignore via >/dev/null 2>&1. I just added to following line to the Dockerfile.
RUN ln -sf /dev/stdout /opt/myserver/logs/server.log
This is not working though. No output is send when I use docker-compose up myserver
Link log file(s) to stdout/stderr. For example in your Dockerfile:
RUN ln -sf /dev/stdout /<path>/logfile.log \
&& ln -sf /dev/stderr /<path>/errors-logfile.log
I found it. Apparently you can write logs from docker containers via
RUN ln -sf /proc/1/fd/1 /opt/myserver/logs/server.log
in your Dockerfile
I'm stuck with this problem and I have no idea to solve it.
I have written a Shell script which will invoke my job using Jenkins CLI by passing my private key.Jenkins version is 2.121.1
java -jar jenkins-cli.jar -s http://localhost:8080 -i ~/.ssh/id_rsa build RTT/RTT-CI-Tools/RTT-CI-Tools-Distribute -s -p SLAVE_REGEX=testserver
Getting Error message as :
ERROR: anonymous is missing the Overall/Read permission
The same script works in another Jenkins (2.7.4). How to fix this issue.
You can also use auth param but you should to type your password in console
java -jar jenkins-cli.jar -s http://localhost:8080/ -auth myLoggin:myPassword list-jobs
Please check for below points
1) USER exist on jenkins server as same on linux machine.
2) SSH Public key shared on Jenkins server is correct.(manage jenkins --> manage user --> click on ${USER} --> click on configure --> then check ssh public key is correct).
3) CMD i used(working) --> java -jar jenkins-cli.jar -ssh -user ${USER} -i ~/.ssh/id_rsa -s http://localhost:8080/jenkins/ build ${JOB_NAME}
please check if you are executing cmd from same user.
4) SSH port should be enable on Jenkins (go to manage Jenkins--> configure Global security --> SSH Server... set SSHD Port Fixed eg 38844)
This issue cropped up for me, too, recently (using the cli to automate installing jenkins). I was able to work around it by setting the denyAnonymousReadAccess flag to false in jenkins' config.xml file, and restarting jenkins:
<authorizationStrategy class="hudson.security.FullControlOnceLoggedInAuthorizationStrategy">
<denyAnonymousReadAccess>false</denyAnonymousReadAccess>
</authorizationStrategy>
I'm using Jenkins to deploy my play application for this I've added SSH support to jenkins and I connect via ssh to the test server and then I run a shel script via ssh.
Thats working fine.
Not working ist finishing the job in jenkins.
The command in the the shell script is the following:
/usr/src/activator-dist-1.3.10/bin/activator "~ run" &
that only should run the activator, build and run the project
But then when The application is build and the activator runs the Jenkins job dosn't finish ... it always hang in console
looks like this:
When you run a script via ssh it will stay open until stdout/stderr are closed or a timeout occurs. In Jenkins it seems as if the script hangs.
So if you run a script as background job, make sure to redirect all its output to somewhere:
nohup yourCommand < /dev/null > /dev/null 2>&1 &
or
nohup yourCommand < /dev/null >> logfile.log 2>&1 &
See SSH Frequently Asked Questions for more details.
I'm trying to find the right sintax for an instrucion that runs a docker image, maps a volume, and calls tests written in Cucumber with a JUnit output.
When I set the following instruction with "Execute command shell" in a job configuration and I don't map any volume, tests run:
docker run docker-registry.dev.xoom.com/agrimaldi/jasper:${VERSION} cucumber -t #co -f junit -o /opt/xbp_stamp_jasper/features/output
Problem is, I need a volume in order to read the output of the tests. So I try out with the following line:
docker run --rm -v /var/lib/jenkins/jobs/qacolombia/workspace/default/features/output:/opt/xbp_stamp_jasper/features/output docker-registry.dev.xoom.com/agrimaldi/jasper:${VERSION} cucumber -t #co -f junit -o /opt/xbp_stamp_jasper/features/output
But Jenkins doesn't seem to recognize the "#" symbol. I've tried with several positions of single quotes, for example: '#co' or 'cucumber -t #co -f junit -o /opt/xbp_stamp_jasper/features/output', using backslashes, double quotes... and Jenkins doesn't recognize the whole instruction. Would you please help me with a suggestion of a way of sending parameters?
Any help is highly appreciated.