0
votes

The Setup - A jenkins job using jenkins parameters testApp and testEnv. The Execution Batch looks like this:

C:\jmeter\apache-jmeter-3.2\bin\jmeter.bat -n -t 
C:\JMeter\Scripts\API_scripts\%testApp%.jmx -Jtestenv=%testEnv% -JtestApp=%testApp% -JtestBrowser=NA -l 
C:\AUTO_Results\jtl\%testApp%_%testEnv%.jtl

Post-build Actions

Console output (build lob) parsing with a global rule so that the Failures that are logged in the Jenkins Console window will consider the JMeter script failing. (discussed Jenkins shows JMeter script failure even though the script actually passed)

Triggered parameterized build - this is a separate jmeter script that updates a wiki page with either PASS/FAIL and uploads the JMeter report.

enter image description here

The Issue - How do I get the downstream Triggered build to use the parameters from the upstream script? I set the Parameter = Current build parameters but it's not applying those. Also, I wont know the value of the testResult parameter until the upstream build finishes. I tried adding %testResult%=PASS to the 'Predefined parameters' box

1

1 Answers

1
votes

As per Parameterized Trigger Plugin page:

The parameters section can contain a combination of one or more of the following:

  • a set of predefined properties

  • properties from a properties file read from the workspace of the triggering build

  • the parameters of the current build

  • Subversion revision: makes sure the triggered projects are built with the same revision(s) of the triggering build. You still have to make sure those projects are actually configured to checkout the right Subversion URLs.

  • Restrict matrix execution to a subset: allows you to specify the same combination filter expression as you use in the matrix project configuration and further restricts the subset of the downstream matrix builds to be run.

So you basically need to copy over the parameters you would like to have in the "downstream" job from the current one.


As a workaround to current performance plugin limitations you can consider running JMeter using Taurus tool as a wrapper, it has flexible and powerful pass/fail criteria subsystem which will basically return to Jenkins non-zero exit code triggering build failure in case of issue in the test. If everything goes well Taurus exit code will be 0 which is considered successful by Jenkins. Check out How to Run Taurus with the Jenkins Performance Plugin article for more details.