在pipeline中加入allure报告的生成代码,并且指定allure报告的存储路径。以下为示例代码:
pipeline { agent any stages { stage('Test') { steps { sh 'mvn clean test' } } } post { always { script { allure([ includeProperties: false, jdk: '', properties: [], reportBuildPolicy: 'ALWAYS', results: [[path: 'target/allure-results']] ]) } } } }
在Jenkins的全局配置里面,设置allure report的安装目录,以便于当前pipeline的脚本能够找到allure-commandline.jar文件。路径需要根据实际安装位置进行修改。
例如:
在Jenkins的“全局工具配置”中,添加allure report,并指定安装目录:
安装目录:/usr/local/bin/allure-commandline-2.13.5/bin
安装名称:Allure Report
重新运行pipeline的构建,并且查看从allure生成的报告。
这样就能够成功生成allure报告,且Executors和Trend不为空了。