From a7fc29d8da0111485474298b4cc8af895ac8f5bf Mon Sep 17 00:00:00 2001 From: Amar Deep Singh Date: Sun, 27 Aug 2023 15:26:24 +0530 Subject: [PATCH 1/8] feat(upgrades): Jmeter,Linux,newplugins,html reports --- .github/workflows/main.yml | 15 ++++++++++++--- Dockerfile | 8 ++++---- README.md | 28 +++++++++++++++++++++++++--- jmeter-plugin-install.sh | 3 +-- 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c701475..a6a2289 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,16 +5,25 @@ jobs: name: JMeter Test Execution steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 + + - name: generate report dir + run: mkdir reports - name: Run JMeter Tests uses: ./ with: test-plan-path: ./TestPlans/S01_SimpleExample/S01_SimpleExample.jmx - args: "" + args: "-e -o ./reports/html/" - name: Upload Results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: jmeter-results path: result.jtl + + - name: Upload Html Reports + uses: actions/upload-artifact@v3 + with: + name: jmeter-reports + path: reports diff --git a/Dockerfile b/Dockerfile index 9ad6d01..ad75638 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,21 @@ -FROM alpine:3.11 +FROM alpine:3.18 LABEL Author="NaveenKumar Namachivayam" LABEL Website="https://qainsights.com" LABEL Description="Apache JMeter Dockerfile for GitHub Actions with JMeter Plugins" -ENV JMETER_VERSION "5.5" +ENV JMETER_VERSION "5.6.2" 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.3" -ENV JMETER_PLUGIN_MANAGER_VERSION "1.7" +ENV JMETER_PLUGIN_MANAGER_VERSION "1.9" COPY entrypoint.sh /entrypoint.sh COPY jmeter-plugin-install.sh /jmeter-plugin-install.sh # Downloading JMeter -RUN apk --no-cache add curl ca-certificates openjdk9-jre && \ +RUN apk --no-cache add curl ca-certificates openjdk17-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 && \ diff --git a/README.md b/README.md index 5301a7d..d2ba0d0 100644 --- a/README.md +++ b/README.md @@ -30,12 +30,12 @@ Following are the prerequisites for this GitHub Action: ``` - name: JMeter Test - uses: QAInsights/PerfAction@v3.1 + uses: QAInsights/PerfAction@v3.2 with: test-plan-path: ./TestPlans/S01_SimpleExample/S01_SimpleExample.jmx args: "" - name: Upload Results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: jmeter-results path: result.jtl @@ -45,7 +45,7 @@ Following are the prerequisites for this GitHub Action: ``` - name: JMeter Test - uses: QAInsights/PerfAction@v3.1 + uses: QAInsights/PerfAction@v3.2 with: test-plan-path: ./TestPlans/S01_SimpleExample/S01_SimpleExample.jmx args: "-H my.proxy.server -P 8000" @@ -56,6 +56,28 @@ Following are the prerequisites for this GitHub Action: name: jmeter-results path: result.jtl ``` +### Example #3 with arguments to Generate HTML Reports + +``` +- name: JMeter Test + uses: QAInsights/PerfAction@v3.2 + with: + test-plan-path: ./TestPlans/S01_SimpleExample/S01_SimpleExample.jmx + args: "-e -o ./reports/html/" + +- name: Upload Results + uses: actions/upload-artifact@v3 + with: + name: jmeter-results + path: result.jtl + +- name: Upload HTML Reports + uses: actions/upload-artifact@v3 + with: + name: jmeter-html-reports + path: reports + +``` ## Download JMeter Test Results diff --git a/jmeter-plugin-install.sh b/jmeter-plugin-install.sh index 502ccd6..43cbc7a 100644 --- a/jmeter-plugin-install.sh +++ b/jmeter-plugin-install.sh @@ -12,7 +12,7 @@ curl -L https://jmeter-plugins.org/get/ --output ${JMETER_HOME}/lib/ext/jmeter-p java -cp /opt/apache/apache-jmeter-${JMETER_VERSION}/lib/ext/jmeter-plugins-manager-${JMETER_PLUGIN_MANAGER_VERSION}.jar org.jmeterplugins.repository.PluginManagerCMDInstaller cd /opt/apache/apache-jmeter-${JMETER_VERSION}/bin/ -java -jar ${JMETER_HOME}/lib/cmdrunner-${JMETER_CMD_RUNNER_VERSION}.jar --tool org.jmeterplugins.repository.PluginManagerCMD install jpgc-udp=0.4 +java -jar ${JMETER_HOME}/lib/cmdrunner-${JMETER_CMD_RUNNER_VERSION}.jar --tool org.jmeterplugins.repository.PluginManagerCMD install jpgc-udp jpgc-graphs-basic jpgc-graphs-additional jpgc-graphs-dist chmod a+x ${JMETER_HOME}/bin/*.sh @@ -20,4 +20,3 @@ pwd ls -l ${JMETER_HOME}/bin/*.sh -#PluginsManagerCMD install jpgc-udp=0.4 From 525a879df1952814fa6ebb2c9bfc16218f049bde Mon Sep 17 00:00:00 2001 From: Amar Deep Singh Date: Sun, 27 Aug 2023 16:04:37 +0530 Subject: [PATCH 2/8] feat(customresults): configure custom results file --- README.md | 4 +++- action.yml | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d2ba0d0..adf3f72 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,9 @@ Following are the prerequisites for this GitHub Action: * `args` * Optional * Additional arguments you can pass it to your test plan execution - +* `test-results` + * Optional + * If you want your result to have a different extension than jtl such as .csv , default value result.jtl ## Usage ### Example #1 with no arguments diff --git a/action.yml b/action.yml index 3c55d86..303c0a1 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,10 @@ inputs: test-plan-path: required: true description: jmeter test plan to execute + results-file: + required: false + description: Where to store the results e.g., result.csv + default: result.jtl args: required: false description: Optional arguments. For more details https://jmeter.apache.org/usermanual/get-started.html#non_gui @@ -23,5 +27,5 @@ runs: - "-t" - "${{ inputs.test-plan-path }}" - "-l" - - "result.jtl" + - "${{ inputs.results-file }}" - "${{ inputs.args }}" From 054ce2e324c6f9d97950cb0532b9be10b917cde1 Mon Sep 17 00:00:00 2001 From: Amar Deep Singh Date: Sun, 27 Aug 2023 16:59:50 +0530 Subject: [PATCH 3/8] fix(pluginsformat):extra plugin should be comma separated --- jmeter-plugin-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jmeter-plugin-install.sh b/jmeter-plugin-install.sh index 43cbc7a..d9e6412 100644 --- a/jmeter-plugin-install.sh +++ b/jmeter-plugin-install.sh @@ -12,7 +12,7 @@ curl -L https://jmeter-plugins.org/get/ --output ${JMETER_HOME}/lib/ext/jmeter-p java -cp /opt/apache/apache-jmeter-${JMETER_VERSION}/lib/ext/jmeter-plugins-manager-${JMETER_PLUGIN_MANAGER_VERSION}.jar org.jmeterplugins.repository.PluginManagerCMDInstaller cd /opt/apache/apache-jmeter-${JMETER_VERSION}/bin/ -java -jar ${JMETER_HOME}/lib/cmdrunner-${JMETER_CMD_RUNNER_VERSION}.jar --tool org.jmeterplugins.repository.PluginManagerCMD install jpgc-udp jpgc-graphs-basic jpgc-graphs-additional jpgc-graphs-dist +java -jar ${JMETER_HOME}/lib/cmdrunner-${JMETER_CMD_RUNNER_VERSION}.jar --tool org.jmeterplugins.repository.PluginManagerCMD install jpgc-udp,jpgc-graphs-basic,jpgc-graphs-additional,jpgc-graphs-dist chmod a+x ${JMETER_HOME}/bin/*.sh From 5f2ab2691094f2b9be2295321cd6dc9940bafd97 Mon Sep 17 00:00:00 2001 From: Amar Deep Singh Date: Sun, 27 Aug 2023 17:06:40 +0530 Subject: [PATCH 4/8] chore(clean): cleanup --- .github/workflows/main.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a6a2289..0e6b9ee 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,9 +6,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - - name: generate report dir - run: mkdir reports - name: Run JMeter Tests uses: ./ From 52295d42887ceb9b5df61e154481818529f623e1 Mon Sep 17 00:00:00 2001 From: Amar Deep Singh Date: Sun, 27 Aug 2023 20:16:13 +0530 Subject: [PATCH 5/8] feat(optimize): plugin list moved to Dockerfile --- Dockerfile | 1 + jmeter-plugin-install.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad75638..9597554 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,7 @@ ENV JMETER_BIN "${JMETER_HOME}/bin" ENV PATH "$PATH:$JMETER_BIN" ENV JMETER_CMD_RUNNER_VERSION "2.3" ENV JMETER_PLUGIN_MANAGER_VERSION "1.9" +ENV JMETER_PLUGIN_INSTALL_LIST "jpgc-udp,jpgc-graphs-basic,jpgc-graphs-additional,jpgc-graphs-dist" COPY entrypoint.sh /entrypoint.sh COPY jmeter-plugin-install.sh /jmeter-plugin-install.sh diff --git a/jmeter-plugin-install.sh b/jmeter-plugin-install.sh index d9e6412..2e8e7b3 100644 --- a/jmeter-plugin-install.sh +++ b/jmeter-plugin-install.sh @@ -2,7 +2,7 @@ echo ${JMETER_HOME} echo ${JMETER_CMD_RUNNER_VERSION} echo ${JMETER_PLUGIN_MANAGER_VERSION} - +echo ${JMETER_PLUGIN_INSTALL_LIST} 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 @@ -12,7 +12,7 @@ curl -L https://jmeter-plugins.org/get/ --output ${JMETER_HOME}/lib/ext/jmeter-p java -cp /opt/apache/apache-jmeter-${JMETER_VERSION}/lib/ext/jmeter-plugins-manager-${JMETER_PLUGIN_MANAGER_VERSION}.jar org.jmeterplugins.repository.PluginManagerCMDInstaller cd /opt/apache/apache-jmeter-${JMETER_VERSION}/bin/ -java -jar ${JMETER_HOME}/lib/cmdrunner-${JMETER_CMD_RUNNER_VERSION}.jar --tool org.jmeterplugins.repository.PluginManagerCMD install jpgc-udp,jpgc-graphs-basic,jpgc-graphs-additional,jpgc-graphs-dist +java -jar ${JMETER_HOME}/lib/cmdrunner-${JMETER_CMD_RUNNER_VERSION}.jar --tool org.jmeterplugins.repository.PluginManagerCMD install ${JMETER_PLUGIN_INSTALL_LIST} chmod a+x ${JMETER_HOME}/bin/*.sh From bef30b289f1a5bc73589966e7200fbcfaa14a9e4 Mon Sep 17 00:00:00 2001 From: Amar Deep Singh Date: Sun, 27 Aug 2023 20:25:18 +0530 Subject: [PATCH 6/8] fix(reportsdir): issue caused by missing reports dir --- .github/workflows/main.yml | 3 +++ README.md | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e6b9ee..ca96e08 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,6 +6,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + + - name: Create reports directory + run: mkdir reports - name: Run JMeter Tests uses: ./ diff --git a/README.md b/README.md index adf3f72..7b8c3d8 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,12 @@ Following are the prerequisites for this GitHub Action: ``` ### Example #3 with arguments to Generate HTML Reports +make sure you create directory with the name where you want html report to be saved. + ``` +- name: Create reports directory + run: mkdir reports + - name: JMeter Test uses: QAInsights/PerfAction@v3.2 with: From 3685f0acbcba7565d1757da710162185a38772af Mon Sep 17 00:00:00 2001 From: Amar Deep Singh Date: Sun, 27 Aug 2023 20:29:34 +0530 Subject: [PATCH 7/8] fix(indentation): example indentation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b8c3d8..7e4dfbe 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ make sure you create directory with the name where you want html report to be sa ``` - name: Create reports directory - run: mkdir reports + run: mkdir reports - name: JMeter Test uses: QAInsights/PerfAction@v3.2 From 3cee124242dd3f5d50f405076bb78c9402989373 Mon Sep 17 00:00:00 2001 From: Amar Deep Singh Date: Mon, 28 Aug 2023 09:55:01 +0530 Subject: [PATCH 8/8] feat(jpgc-functions): Added Plugin Custom JMeter Functions --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9597554..c1995a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ ENV JMETER_BIN "${JMETER_HOME}/bin" ENV PATH "$PATH:$JMETER_BIN" ENV JMETER_CMD_RUNNER_VERSION "2.3" ENV JMETER_PLUGIN_MANAGER_VERSION "1.9" -ENV JMETER_PLUGIN_INSTALL_LIST "jpgc-udp,jpgc-graphs-basic,jpgc-graphs-additional,jpgc-graphs-dist" +ENV JMETER_PLUGIN_INSTALL_LIST "jpgc-udp,jpgc-graphs-basic,jpgc-graphs-additional,jpgc-graphs-dist,jpgc-functions" COPY entrypoint.sh /entrypoint.sh COPY jmeter-plugin-install.sh /jmeter-plugin-install.sh