Publishing HTML Reports in Pipeline

Publishing HTML Reports in Pipeline

当时steps{step()} 老是报错,后面改成steps{script{}}可以了,

 

Running on autotest-01 in /opt/jenkins_agent/workspace/testforhtml
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Results)
[Pipeline] publishHTML
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at BUILD level /opt/jenkins_agent/workspace/testforhtml to /var/jenkins_home/jobs/testforhtml/builds/13/htmlreports/HTML_20Report
[Pipeline] step
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.NullPointerException
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

stage('Results') {
steps{
step(
publishHTML([allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: false,
reportDir: '/tmp/',
reportFiles: 'dbpay.html',
reportName: 'HTML Report',
reportTitles: ''])
)}}

 

 

stage('Results') {
steps{
script{
publishHTML([allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: false,
reportDir: '/tmp/',
reportFiles: 'dbpay.html',
reportName: 'HTML Report',
reportTitles: ''])
}}}

posted on 2021-04-06 14:06  牛气冲天  阅读(175)  评论(0编辑  收藏  举报