I'm trying to create add build step in jenkins pipeline to make performace reports visible and below is the code snippet
But my problem is that the file name the plugin generates is not fixed (yyyymmdd is prepended). ex: 20210723-jmeter-resultFile.csv
Could someone suggest?
stage('Execute Jmeter') {
post{
always{
dir("/target/jmeter/results/"){
sh 'pwd'
perfReport '20210723-jmeter-resultFile.csv'
}
}
}
}
You can remove this "prepended" timstamp by adding the next lines to your pom.xml file:
<configuration>
<testResultsTimestamp>false</testResultsTimestamp>
</configuration>
You can calculate the current timestamp in the pipeline like:
def reportFileName = new Date().format('yyyyMMdd') + '-jmeter-resultFile.csv'
You can use Ant FileSet style expression to specify path(s) to the result file(s) like:
perfReport '**/*.csv'
More information: How to Use the Jenkins Performance Plugin