Skip to content

Commit

Permalink
GH-18 Adding In JMeter Plugin Capability (#19)
Browse files Browse the repository at this point in the history
* GH-18 adding in gitignore and jmeter plugins

* GH-18 adding in gitignore and jmeter plugins

* GH-18 adding in gitignore and jmeter plugins

* feature/gh-18 jmeter-plugins (#20)

Adding in plugin capabilities

Co-authored-by: Michael Meyers <[email protected]>
  • Loading branch information
rbhadti94 and mrmeyers99 authored Sep 15, 2021
1 parent 3a6c719 commit 0fdb63a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,26 @@ ENV JMETER_VERSION "5.4.1"
ENV JMETER_HOME "/opt/apache/apache-jmeter-${JMETER_VERSION}"
ENV JMETER_BIN "${JMETER_HOME}/bin"
ENV PATH "$PATH:$JMETER_BIN"
ENV CMD_RUNNER_VERSION 2.2
ENV JMETER_PLUGIN_VERSION 1.6
ENV MAVEN_REPO "https://repo1.maven.org/maven2/kg/apc"

COPY entrypoint.sh /entrypoint.sh
COPY cleanup.sh /cleanup.sh

RUN apk --no-cache add curl ca-certificates openjdk9-jre && \
RUN apk --no-cache add curl ca-certificates openjdk9-jre parallel && \
curl -L https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_VERSION}.tgz --output /tmp/apache-jmeter-${JMETER_VERSION}.tgz && \
tar -zxvf /tmp/apache-jmeter-${JMETER_VERSION}.tgz && \
tar -zxf /tmp/apache-jmeter-${JMETER_VERSION}.tgz && \
mkdir -p /opt/apache && \
mv apache-jmeter-${JMETER_VERSION} /opt/apache && \
rm /tmp/apache-jmeter-${JMETER_VERSION}.tgz && \
curl ${MAVEN_REPO}/cmdrunner/${CMD_RUNNER_VERSION}/cmdrunner-${CMD_RUNNER_VERSION}.jar --output ${JMETER_HOME}/lib/cmdrunner-${CMD_RUNNER_VERSION}.jar && \
curl ${MAVEN_REPO}/jmeter-plugins-manager/${JMETER_PLUGIN_VERSION}/jmeter-plugins-manager-${JMETER_PLUGIN_VERSION}.jar --output ${JMETER_HOME}/lib/ext/jmeter-plugins-manager-${JMETER_PLUGIN_VERSION}.jar && \
java -cp ${JMETER_HOME}/lib/ext/jmeter-plugins-manager-${JMETER_PLUGIN_VERSION}.jar org.jmeterplugins.repository.PluginManagerCMDInstaller && \
chmod +x ${JMETER_HOME}/bin/PluginsManagerCMD.sh && \
rm -rf ${JMETER_HOME}/docs && rm -rf ${JMETER_HOME}/printable_docs \
rm -rf /var/cache/apk/* && \
chmod a+x /entrypoint.sh
chmod a+x /entrypoint.sh && \
chmod a+x /cleanup.sh

ENTRYPOINT [ "/entrypoint.sh" ]
11 changes: 11 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ inputs:
description: The folder where the JMeter reports will be published
required: false
default: reports/
plugins:
description: List of jmeter plugins to install
required: false
dependencyFolder:
description: Folder that contains custom jmeter plugins or dependencies
required: false
args:
required: false
description: |
Expand Down Expand Up @@ -46,6 +52,11 @@ inputs:
runs:
using: 'docker'
image: 'Dockerfile'
post-entrypoint: '/cleanup.sh'
env:
PLUGINS: ${{ inputs.plugins }}
DEPENDENCY_FOLDER: ${{ inputs.dependencyFolder }}
REPORT_FOLDER: ${{ inputs.outputReportsFolder }}
args:
- "-n"
- "-t"
Expand Down
2 changes: 2 additions & 0 deletions cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
rm -rf ${REPORT_FOLDER}
14 changes: 13 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,16 @@
# Export JAVA_HOME Variable within Entrypoint
export JAVA_HOME="/usr/lib/jvm/java-9-openjdk"

jmeter $@
if [ -n "$DEPENDENCY_FOLDER" ]
then
cp ${GITHUB_WORKSPACE}/${DEPENDENCY_FOLDER}/*.jar ${JMETER_HOME}/lib/
fi

if [ -n "$PLUGINS" ]
then
echo "$PLUGINS" | tr "," "\n" | parallel -I% --jobs 5 "${JMETER_HOME}/bin/PluginsManagerCMD.sh install %"
fi

jmeter $@
status=$?
[ $status -eq 0 ] && exit 0 || echo "JMeter exited with status code $status" && exit $status

0 comments on commit 0fdb63a

Please sign in to comment.