首页 > 解决方案 > Jenkins Publish HTML 报告不发布 html 报告

问题描述

我正在尝试发布从我的 newman 脚本生成的 HTML 报告,并在 Jenkins 作业中使用以下设置。

    HTML directory to archive   : ./newman
    Index page[s]   : myReport.html
    Report title    : My Report

我正在工作区的 /newman 目录中生成 newman 报告。但是,在项目仪表板上,我可以看到报告的链接,但是当我单击它时,它在处理报告时显示错误,因为找不到“”。为什么这试图从不正确的目录中读取报告?

控制台输出中有一条消息:

    Archiving HTML reports...
    [htmlpublisher] Archiving at BUILD level 
    /export/jenkins_slave/workspace/<teamPath>/ProjectName/newman to 
    /net/<company name>/jenkins_homes/<team path with 
    /job>/<ProjectName>/builds/2/htmlreports/ReportFolder

记录测试结果

脚本:

            always {

            sh label: '', script: '''cd /target
                                tar -czf report.html output'''

            emailext attachmentsPattern: '**/target/report.html', body: '''CreateProject_Pipeline - Build # $BUILD_NUMBER - $BUILD_STATUS:

                                            ${JELLY_SCRIPT,template="html"}

                                            Check console output at $BUILD_URL to view the results.''', 
                                            recipientProviders: [requestor()], subject: 'VDP_CreateProject_Pipeline-API Test Results', to: 'abc@abc.com'

            cleanWs()

    }
}

标签: jenkinsjenkins-pipelinejenkins-pluginsjenkins-groovy

解决方案


我认为你需要改变路径。

要归档的 HTML 目录:./newman

/新人


推荐阅读