简体   繁体   中英

Using JMeter plugins with justb4/jmeter Docker image results in error

Goal

I am using Docker to run JMeter in Azure Devops. I am trying to use Blazemeter's Parallel Controller, which is not native to JMeter. So, according to the justb4/jmeter image documentation, I used the following command to get the image going and run the JMeter test:

docker run --name jmetertest -i -v /home/vsts/work/1/s/plugins:/plugins -v $ROOTPATH:/test -w /test justb4/jmeter ${@:2}

Error

However, it produces the following error while trying to accommodate for the plugin (I know the plugin makes the difference due to testing without the plugin):

cp: can't create '/test/lib/ext': No such file or directory

As far as I understand, this is an error produced when one of the parent directories of the directory you are trying to make does not exist. Is there something I am doing wrong, or is there actually something wrong with the image?

References

For reference, I will include links to the image documentation and the repository.

Image: https://hub.docker.com/r/justb4/jmeter

Repository: https://github.com/justb4/docker-jmeter

Looking into the Dockerfile :

ENV JMETER_HOME /opt/apache-jmeter-${JMETER_VERSION}

Looking into entrypoint.sh

if [ -d /plugins ]
then
    for plugin in /plugins/*.jar; do
        cp $plugin $(pwd)/lib/ext
    done;
fi

It basically copies the plugins from /plugins folder (if it is present) to /lib/ext folder relative to current working directory

I don't know why did you add this stanza -w /test to your command line but it explicitly "tells" the container that local working directory is /test , not /opt/apache-jmeter-xxxx , that's why the script is failing to copy the files.


In general I don't think that the approach is very valid because:

  • In Azure DevOps you won't have your "local" folder (unless you want to add plugins binaries under the version control system)

  • Some JMeter Plugins have other.jars as the dependencies so when you're installing the plugin you should:

    • put the plugin itself under /lib/ext folder of your JMeter installation
    • put the plugin dependencies under /lib folder of your JMeter installation

So I would recommend amending the Dockerfile, download JMeter Plugins Manager and installed the plugin(s) you need from the command line

Something like:

RUN wget https://jmeter-plugins.org/get/ -O /opt/apache-jmeter-${JMETER_VERSION}/lib/ext/jmeter-plugins-manager.jar
RUN wget https://repo1.maven.org/maven2/kg/apc/cmdrunner/2.2/cmdrunner-2.2.jar -P /opt/apache-jmeter-${JMETER_VERSION}/lib/
RUN java -cp /opt/apache-jmeter-${JMETER_VERSION}/lib/ext/jmeter-plugins-manager.jar org.jmeterplugins.repository.PluginManagerCMDInstaller
RUN /opt/apache-jmeter-${JMETER_VERSION}/bin/./PluginsManagerCMD.sh install bzm-parallel

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