哈德逊文件路径通过管道脚本生成诱惑报告时缺少错误

2024-10-01 17:38:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我为管道添加了新阶段:

stage('reports') {
    steps {
    script {
            allure([
                    includeProperties: false,
                    jdk: '',
                    properties: [],
                    reportBuildPolicy: 'ALWAYS',
                    results: [[path: 'target/allure-results']]
            ])
        }
    }
}

但作业失败,错误为:

^{pr2}$

测试是在Python上编写的,并生成xml报告,但不是诱惑报告。在

你能帮我解决这个错误吗?在


Tags: false管道报告错误scriptpropertiesstepsstage
1条回答
网友
1楼 · 发布于 2024-10-01 17:38:27

如我所见,您使用declarative pipeline syntax。在这种情况下,您需要定义agent部分。根据官方文件:

Defining agent none at the top-level of the Pipeline ensures that an Executor will not be assigned unnecessarily. Using agent none also forces each stage section to contain its own agent section.

所以,我认为您在管道的顶层使用agent none,这就是为什么您需要在stage中添加agent部分。像这样:

pipeline {
    agent none 
    stages {
        stage('reports') {
            agent { docker 'openjdk:8-jre' }
            steps {
                script {
                    allure([
                        includeProperties: false,
                        jdk: '',
                        properties: [],
                        reportBuildPolicy: 'ALWAYS',
                        results: [[path: 'target/allure-results']]
                    ])
                }
            }
        }
    }
}

对于scripted pipeline,您需要使用以下语法(有关详细信息,请参阅allure documentation):

^{pr2}$

相关问题 更多 >

    热门问题