与 Jenkins 的错误集成 Allure 报告。找不到 allure 命令行 <null>

Error integration Allure reporting with Jenkins. Can't find allure commandline <null>

请帮忙,我只是不知道出了什么问题,我已经尝试了所有方法...这是一个 QA 测试项目,基于 java17、maven、testng。 Jenkins 和 Allure 之间的集成不起作用,出了什么问题?

我在 Jenkins 文件中有 post 条件:

         post {
          always {
             allure includeProperties: false, jdk: '', reportBuildPolicy: 'ALWAYS', results: [[path: 'target/allure-results']]
            deleteDir()

当我在 Jenkins 端 运行 管道时,我在控制台输出中遇到以下错误

Pipeline allure Error when executing always post condition: Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to ubuntu-20.04 at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1797) at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356) at hudson.remoting.Channel.call(Channel.java:1001) at ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation.getMajorVersion(AllureCommandlineInstallation.java:63) at ru.yandex.qatools.allure.jenkins.ReportBuilder.build(ReportBuilder.java:52) at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:312) at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:231) at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:100) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:70) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start[=14=](SynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) java.io.IOException: Can't find allure commandline at ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation$GetMajorVersion.call(AllureCommandlineInstallation.java:74) at ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation$GetMajorVersion.call(AllureCommandlineInstallation.java:65) at hudson.remoting.UserRequest.perform(UserRequest.java:211) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request.run(Request.java:376) at hudson.remoting.InterceptingExecutorService.lambda$wrap[=14=](InterceptingExecutorService.java:78) at java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.lang.Thread.run(Thread.java:833)

在 Jenkins 端正确安装了与 Allure 的集成(我试图从 Jenkins Agent 配置的 HOME 目录中删除“/bin”路径,但没有帮助。 项目使用java17,maven.

Pom file:
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>0</modelVersion>

    <groupId>lol</groupId>
    <artifactId>lol</artifactId>
    <version>1</version>

    <name>lol</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <aspectj.version>1.9.7</aspectj.version>
        <java.version>17</java.version>
        <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
        <maven.surefire.plugin.version>3.0.0-M5</maven.surefire.plugin.version>
        <org.apache.logging.log4j.version>2.14.1</org.apache.logging.log4j.version>
        <org.slf4j.version>1.7.26</org.slf4j.version>
        <com.google.guava.version>27.1-jre</com.google.guava.version>
        <org.apache.commons-lang.version>3.9</org.apache.commons-lang.version>
        <org.apache.commons.version>4.3</org.apache.commons.version>
        <org.testng.version>7.4.0</org.testng.version>
        <io.rest-assured.version>4.3.1</io.rest-assured.version>
        <io.rest-assured.json-schema-validator.version>${io.rest-assured.version}
        </io.rest-assured.json-schema-validator.version>
        <com.google.code.gson.version>2.8.5</com.google.code.gson.version>
        <com.googlecode.json-simple.version>1.1.1</com.googlecode.json-simple.version>
        <org.projectlombok.version>1.18.22</org.projectlombok.version>
        <io.jsonwebtoken.version>0.10.5</io.jsonwebtoken.version>
        <org.bouncycastle.version>1.66</org.bouncycastle.version>
        <io.qameta.allure.version>2.13.8</io.qameta.allure.version>
        <com.fasterxml.jackson.core.version>2.9.9</com.fasterxml.jackson.core.version>
        <org.sonarsource.scanner.maven.version>3.7.0.1746</org.sonarsource.scanner.maven.version>
        <software.amazon.awssdk.verison>2.8.7</software.amazon.awssdk.verison>
        <commons-io.verison>2.6</commons-io.verison>
        <codeborne.version>5.19.0</codeborne.version>
        <org.awaitility.version>4.0.2</org.awaitility.version>
        <jacoco.plugin.version>0.8.6</jacoco.plugin.version>
        <selenium.version>3.141.59</selenium.version>
        <bmp.version>2.1.5</bmp.version>
        <ashot-version>1.5.4</ashot-version>
        <extentreports-version>5.0.8</extentreports-version>
        <resources>src/test/resources/</resources>
        <pathToSuite>test-suites/cf/regression.xml</pathToSuite>
        <sonar.java.source>${java.version}</sonar.java.source>
        <sonar.coverage.jacoco.xmlReportPaths>
            target/site/jacoco/jacoco.xml
        </sonar.coverage.jacoco.xmlReportPaths>
    </properties>

    <dependencies>

        <dependency>
            <groupId>com.aventstack</groupId>
            <artifactId>extentreports</artifactId>
            <version>${extentreports-version}</version>
        </dependency>

        <dependency>
            <groupId>ru.yandex.qatools.ashot</groupId>
            <artifactId>ashot</artifactId>
            <version>${ashot-version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>${org.apache.logging.log4j.version}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <version>${org.slf4j.version}</version>
        </dependency>

        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <version>${org.awaitility.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${com.google.guava.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${org.apache.commons-lang.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>${org.apache.commons.version}</version>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${org.testng.version}</version>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>${io.rest-assured.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>commons-lang3</artifactId>
                    <groupId>org.apache.commons</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-schema-validator</artifactId>
            <version>${io.rest-assured.json-schema-validator.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>${com.google.code.gson.version}</version>
        </dependency>

        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>${com.googlecode.json-simple.version}</version>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${org.projectlombok.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-api</artifactId>
            <version>${io.jsonwebtoken.version}</version>
        </dependency>

        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-impl</artifactId>
            <version>${io.jsonwebtoken.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-jackson</artifactId>
            <version>${io.jsonwebtoken.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk15on</artifactId>
            <version>${org.bouncycastle.version}</version>
        </dependency>

        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-testng</artifactId>
            <version>${io.qameta.allure.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${com.fasterxml.jackson.core.version}</version>
        </dependency>

        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>aws-sdk-java</artifactId>
            <version>${software.amazon.awssdk.verison}</version>
        </dependency>

        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>cloudwatchlogs</artifactId>
            <version>${software.amazon.awssdk.verison}</version>
        </dependency>

        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>url-connection-client</artifactId>
            <version>${software.amazon.awssdk.verison}</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons-io.verison}</version>
        </dependency>

        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-java-commons</artifactId>
            <version>${io.qameta.allure.version}</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.codeborne</groupId>
            <artifactId>selenide</artifactId>
            <version>${codeborne.version}</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-remote-driver</artifactId>
            <version>${selenium.version}</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>net.lightbody.bmp</groupId>
            <artifactId>browsermob-core</artifactId>
            <version>${bmp.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <configuration>
                    <argLine>
                        -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                    </argLine>
                    <suiteXmlFiles>
                        <suiteXmlFile>${resources}${pathToSuite}</suiteXmlFile>
                    </suiteXmlFiles>
                    <systemPropertyVariables>
                        <testng.dtd.http>true</testng.dtd.http>
                    </systemPropertyVariables>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <release>${java.version}</release>
                    <encoding>${project.build.sourceEncoding}</encoding>
                    <forceJavacCompilerUse>true</forceJavacCompilerUse>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>${org.sonarsource.scanner.maven.version}</version>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>regression</id>
        </profile>
        <profile>
            <id>sanity</id>
        </profile>
    </profiles>

</project>

Allure jenkins install config

我自己找到了答案,这是新版本的 allure-commandline 中的某种问题,尝试:

  1. 安装旧版本,例如 2.8.0
  2. 然后你可以安装任何新版本

似乎在旧版本中,在安装时,它正在以正确的方向创建路径(在我的例子中是 ubuntu),然后用新的路径更新...或者您可以手动插入安装目录并最初安装一个新版本