【问题标题】:How to Publish Latest HTML Reports from Jenkins?如何发布来自 Jenkins 的最新 HTML 报告?
【发布时间】:2020-06-25 11:09:11
【问题描述】:

我们在 Jenkins 上运行 Selenium 测试,selenium 为每天的每个构建/测试和文件夹名称生成多个 HTML 报告

我想发布来自 Jenkins 的最新 HTML 报告,并尝试使用 alwaysLinkToLastBuild 参数,但它对我不起作用。

所以我的问题是,我如何将最新的 HTML 报告指定到 reportFiles 中,因为我有多个不同的名称。

ubuntu@play-0:~/workspace/selenium_tests@2/p1/p2/reports$ tree

|-- oneapihub_extent_report_2020_06_25_093644.html
|-- oneapihub_extent_report_2020_06_24_093904.html
|-- oneapihub_extent_report_2020_06_23_094414.html

        post {
            always {
                //publish HTML report
                    publishHTML target: [
                    allowMissing: false,
                    alwaysLinkToLastBuild: true,
                    keepAll: true,
                    reportDir: 'p1/p2/reports',
                    reportFiles: 'index.html',
                    reportName: 'HTML Report'
                ]                
            }

【问题讨论】:

    标签: jenkins jenkins-pipeline jenkins-plugins


    【解决方案1】:

    一般而言,您使用的插件能够做到这一点,但它只能发布一份报告。所以你需要一个自己生成的index.html,它只携带链接。

    所以你可以运行一个小的 shell 脚本,它会在测试运行后为你生成这个脚本。

    在我们的 index.html 中生成一个条目列表,例如:

    <a href="oneapihub_extent_report_2020_06_25_093644.html">oneapihub_extent_report_2020_06_25_093644.html</a>
    

    已经有很好的答案如何创建静态列表,例如shell script to create a static HTML directory listing

    【讨论】:

    • 对不起,但我不清楚。 sh 应该是什么样子?
    • 添加了另一个 SO 帖子的链接
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-13
    • 2021-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-29
    相关资源
    最近更新 更多