Skip to content

Commit

Permalink
feat: add jmeter action
Browse files Browse the repository at this point in the history
  • Loading branch information
brunohlopes committed Aug 23, 2022
0 parents commit 609c351
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM public.ecr.aws/d5m6a7e4/sre-alpine:latest

LABEL "maintainer" "Central QA"
LABEL "com.github.actions.name"="jmeter-runner-action"
LABEL "com.github.actions.description"="Github action for running a load test using Jmeter. Included with plugins:- concurrency thread, throughput shaping timer"

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 JMETER_CMD_RUNNER_VERSION "2.2"
ENV JMETER_PLUGIN_MANAGER_VERSION "1.6"

COPY entrypoint.sh /entrypoint.sh
COPY jmeter-plugin-install.sh /jmeter-plugin-install.sh

RUN apk --no-cache add curl ca-certificates openjdk9-jre && \
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 && \
mkdir -p /opt/apache && \
mv apache-jmeter-${JMETER_VERSION} /opt/apache && \
rm /tmp/apache-jmeter-${JMETER_VERSION}.tgz && \
rm -rf ${JMETER_HOME}/docs && rm -rf ${JMETER_HOME}/printable_docs \
rm -rf /var/cache/apk/* && \
chmod a+x /entrypoint.sh && \
chmod a+x /jmeter-plugin-install.sh


RUN /jmeter-plugin-install.sh

ENTRYPOINT [ "/entrypoint.sh" ]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# jmeter-runner-action
## Github action for running load test using Jmeter
## Includes plugin - Concurrency Threads and Throughput shaping timer
60 changes: 60 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
name: jmeter-runner-action
description: Github action for running a load test using Jmeter. Included with plugins:- concurrency thread, throughput shaping timer
author: QA-Performance-Engineering <QA-Performance-Engineering@betssongroup.com>

inputs:
testFilePath:
description: The path to the JMX test file
required: true
outputReportsFolder:
description: The folder where the JMeter reports will be published
required: false
default: reports/
args:
required: false
description: |
Optional arguments that are passed to the JMeter tool
Options:
-p, --propfile <argument>
-q, --addprop <argument>
-i, --jmeterlogconf <argument>
-j, --jmeterlogfile <argument>
-s, --server
-E, --proxyScheme <argument>
-H, --proxyHost <argument>
-P, --proxyPort <argument>
-N, --nonProxyHosts<argument>
-u, --username <argument>
-a, --password <argument>
-J, --jmeterproperty <argument>=<value>
-G, --globalproperty <argument>=<value>
-D, --systemproperty <argument>=<value>
-S, --systemPropertyFile <argument>
-f, --forceDeleteResultFile
-L, --loglevel <argument>=<value>
-r, --runremote
-R, --remotestart <argument>
-d, --homedir <argument>
-X, --remoteexit
-g, --reportonly <argument>
runs:
using: 'docker'
image: 'Dockerfile'
args:
- "-n"
- "-t"
- "${{ inputs.testFilePath }}"
- "-l"
- "jmeter_log.log"
- "-e"
- "-f"
- "-o"
- "${{ inputs.outputReportsFolder }}"
- "${{ inputs.args }}"

branding:
color: blue
icon: zap
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

# Export JAVA_HOME Variable within Entrypoint
export JAVA_HOME="/usr/lib/jvm/java-9-openjdk"

jmeter $@
19 changes: 19 additions & 0 deletions jmeter-plugin-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
echo ${JMETER_HOME}
echo ${JMETER_CMD_RUNNER_VERSION}
echo ${JMETER_PLUGIN_MANAGER_VERSION}

echo "Downloading CMDRunner"
curl -L http://search.maven.org/remotecontent?filepath=kg/apc/cmdrunner/${JMETER_CMD_RUNNER_VERSION}/cmdrunner-${JMETER_CMD_RUNNER_VERSION}.jar --output ${JMETER_HOME}/lib/cmdrunner-${JMETER_CMD_RUNNER_VERSION}.jar

echo "Downloading Plugin Manager"
curl -L https://jmeter-plugins.org/get/ --output ${JMETER_HOME}/lib/ext/jmeter-plugins-manager-${JMETER_PLUGIN_MANAGER_VERSION}.jar

java -cp /opt/apache/apache-jmeter-${JMETER_VERSION}/lib/ext/jmeter-plugins-manager-${JMETER_PLUGIN_MANAGER_VERSION}.jar org.jmeterplugins.repository.PluginManagerCMDInstaller

chmod a+x ${JMETER_HOME}/bin/*.sh

${JMETER_HOME}/bin/PluginsManagerCMD.sh install jpgc-udp=0.4
${JMETER_HOME}/bin/PluginsManagerCMD.sh install jpgc-casutg
${JMETER_HOME}/bin/PluginsManagerCMD.sh install jpgc-tst
chmod a+x ${JMETER_HOME}/lib/ext/*.jar

0 comments on commit 609c351

Please sign in to comment.