简体   繁体   中英

Pipeline Docker-Jenkins-Jmeter

I am trying to configure the Pipeline Docker-Jenkins-Jmeter Expected result : take test plans from my computer, run them on Jmeter with the help of Jenkins using docker container

Below I will write what I've done and a question

  1. I downloaded Jenkins image on Docker, created the container and configured it.
  2. In Jenkins I downloaded plugins: performance plugin (for Jmeter)
  3. Then I create Freestyle project and add data在此处输入图像描述

Build action C:\Users\Aliaksandra\Desktop\JMETER\apache-jmeter-5.4.1_old\apache-jmeter-5.4.1\bin>jmeter jmeter -Jjmeter.save.saveservice.output_format=xml -n -t C:\Users\Aliaksandra\Desktop\JMETER\apache-jmeter-5.4.1_old\apache-jmeter-5.4.1\bin\R.jmx -l C:\Users\Aliaksandra\Desktop\JMETER\apache-jmeter-5.4.1_old\apache-jmeter-5.4.1\bin\R_result_report.jtl

the code above perfectly runs from my cmd command line on Windows but in Jenkins no with this error在此处输入图像描述

Post-build action C:\Users\Aliaksandra\Desktop\JMETER\apache-jmeter-5.4.1_old\apache-jmeter-5.4.1\bin\R_result_report.jtl

As I understand, my Jenkins image cannot run my test plan because it doesn't have Jmeter installed?? Do I need (or is it possible) to install Jmeter with the help of command line CLI on Jenkins container OR do I need to Install the second container Jmeter? I am stuck.

PS I have Jmeter on my Windows computer and from command line everything perfectly runs

  1. Looking at /var/jenkins_home.... path you're seem to be using default Linux containers therefore you need to change your Windows paths c:\users\aliaksandra.... to their Linux equivalents.

  2. We don't know where you "downloaded the Jenkins image" from and how exactly you have "configured" it but my expectation is that the Jenkins image won't contain JMeter installation and you will have to download and install JMeter there (either in the image or in the container). In case of building the image from the Dockerfile you will need to add a couple of lines there, something like:

     ARG JMETER_VERSION=5.4.3 RUN mkdir -p /jmeter \ && cd /jmeter \ && wget -q https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_VERSION}.tgz \ && tar -xzf apache-jmeter-${JMETER_VERSION}.tgz \ && rm apache-jmeter-${JMETER_VERSION}.tgz
  3. As the continuation of the point 1 you will need to switch to "Execute shell" build step and re-configure it as:

    在此处输入图像描述

    alternatively you can use Docker Volumes so the container would use JMeter installation and the test plan from the host, but I'm not 100% sure this is something you're trying to achieve.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM